Instructions to use yahya94812/Tiny-GPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yahya94812/Tiny-GPT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yahya94812/Tiny-GPT", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("yahya94812/Tiny-GPT", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yahya94812/Tiny-GPT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yahya94812/Tiny-GPT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yahya94812/Tiny-GPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yahya94812/Tiny-GPT
- SGLang
How to use yahya94812/Tiny-GPT 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 "yahya94812/Tiny-GPT" \ --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": "yahya94812/Tiny-GPT", "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 "yahya94812/Tiny-GPT" \ --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": "yahya94812/Tiny-GPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use yahya94812/Tiny-GPT with Docker Model Runner:
docker model run hf.co/yahya94812/Tiny-GPT
TinyGPT
A small GPT-style decoder-only language model, trained from scratch on TinyStories.
- Architecture: 8-layer, 16-head, 1024-dim decoder-only transformer (fused QKV attention via
scaled_dot_product_attention, GELU MLP, pre-LayerNorm, tied input/output embeddings). - Tokenizer: character-level over ASCII code points 0–127 (
vocab_size=128), i.e.id == ord(char). - Context length: 1024 tokens.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "yahya94812/Tiny-GPT"
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo_id, trust_remote_code=True)
inputs = tokenizer("Once upon a time", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=200, do_sample=True, temperature=0.8)
print(tokenizer.decode(out[0]))
trust_remote_code=True is required because this model uses a custom architecture
(modeling_tinygpt.py) rather than one built into transformers.
Limitations
This is a small research/educational model trained on TinyStories; it generates simple, short children's-story-style text and will not perform general-purpose language tasks.
- Downloads last month
- -