Instructions to use hayder86al/tinystories-50m-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hayder86al/tinystories-50m-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hayder86al/tinystories-50m-instruct", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("hayder86al/tinystories-50m-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hayder86al/tinystories-50m-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hayder86al/tinystories-50m-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hayder86al/tinystories-50m-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hayder86al/tinystories-50m-instruct
- SGLang
How to use hayder86al/tinystories-50m-instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hayder86al/tinystories-50m-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hayder86al/tinystories-50m-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "hayder86al/tinystories-50m-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hayder86al/tinystories-50m-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hayder86al/tinystories-50m-instruct with Docker Model Runner:
docker model run hf.co/hayder86al/tinystories-50m-instruct
tinystories-50m-instruct
A ~50M-parameter GPT-style transformer (6 layers, 12 heads, 768 embd, 1024
context) trained from scratch on TinyStories and instruction-fine-tuned to
chat in a User: ... / Assistant: ... format.
Quick start
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("hayder86al/tinystories-50m-instruct")
model = AutoModelForCausalLM.from_pretrained("hayder86al/tinystories-50m-instruct", trust_remote_code=True)
def chat(prompt):
text = f"User: {prompt}\nAssistant:"
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(
**inputs, max_new_tokens=120, do_sample=True, temperature=0.5,
top_k=40, use_cache=False,
pad_token_id=tokenizer.pad_token_id, eos_token_id=tokenizer.eos_token_id,
)
text_out = tokenizer.decode(outputs[0], skip_special_tokens=True)
return text_out.split("Assistant:")[-1].strip()
print(chat("What is 2+2?"))
trust_remote_code=True is required because this repo defines a custom
architecture (modeling_minigpt.py / configuration_minigpt.py) โ review
that code before running it.
Limitations
Single-turn only (no conversation memory), 1024-token context, small model โ expect simple, sometimes ungrammatical answers, not factual accuracy.
- Downloads last month
- 197