Instructions to use pythonstudentiam/tinyllm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use pythonstudentiam/tinyllm with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf pythonstudentiam/tinyllm:F16 # Run inference directly in the terminal: llama cli -hf pythonstudentiam/tinyllm:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf pythonstudentiam/tinyllm:F16 # Run inference directly in the terminal: llama cli -hf pythonstudentiam/tinyllm:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf pythonstudentiam/tinyllm:F16 # Run inference directly in the terminal: ./llama-cli -hf pythonstudentiam/tinyllm:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf pythonstudentiam/tinyllm:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf pythonstudentiam/tinyllm:F16
Use Docker
docker model run hf.co/pythonstudentiam/tinyllm:F16
- LM Studio
- Jan
- vLLM
How to use pythonstudentiam/tinyllm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pythonstudentiam/tinyllm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pythonstudentiam/tinyllm", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pythonstudentiam/tinyllm:F16
- Ollama
How to use pythonstudentiam/tinyllm with Ollama:
ollama run hf.co/pythonstudentiam/tinyllm:F16
- Unsloth Studio
How to use pythonstudentiam/tinyllm with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pythonstudentiam/tinyllm to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pythonstudentiam/tinyllm to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for pythonstudentiam/tinyllm to start chatting
- Docker Model Runner
How to use pythonstudentiam/tinyllm with Docker Model Runner:
docker model run hf.co/pythonstudentiam/tinyllm:F16
- Lemonade
How to use pythonstudentiam/tinyllm with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull pythonstudentiam/tinyllm:F16
Run and chat with the model
lemonade run user.tinyllm-F16
List all available models
lemonade list
- Atomic Chat
| license: cdla-sharing-1.0 | |
| datasets: | |
| - roneneldan/TinyStories | |
| - roneneldan/TinyStoriesInstruct | |
| language: | |
| - en | |
| pipeline_tag: text-generation | |
| tags: | |
| - llama | |
| - tiny | |
| - educational | |
| - gguf | |
| # tinyllm β instruction-tuned | |
| A 15.7M-parameter Llama-architecture language model trained from | |
| random initialization on [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories). | |
| Built as a complete walk through the model lifecycle β tokenizer, architecture, | |
| pretraining, evaluation, instruction tuning, packaging, quantization, and local | |
| serving. It is small enough to train in about 45 minutes on a free Colab T4 and | |
| to run on a 2-core laptop CPU with no GPU. | |
| ## Architecture | |
| | | | | |
| |---|---| | |
| | Parameters | 15,735,168 (12,589,440 non-embedding) | | |
| | Layers | 8 | | |
| | Hidden size | 384 | | |
| | Attention heads | 6 query / 2 key-value (GQA) | | |
| | Head dim | 64 | | |
| | MLP | SwiGLU, intermediate 1024 | | |
| | Normalization | RMSNorm (eps 1e-05) | | |
| | Position encoding | RoPE (theta 10000) | | |
| | Context length | 512 | | |
| | Vocabulary | 8192 (SentencePiece BPE, byte fallback) | | |
| | Embeddings | tied input/output | | |
| ## Training | |
| | | | | |
| |---|---| | |
| | Tokens | 164M (~10 per parameter) | | |
| | Steps | 2,500 at 65,536 tokens/step | | |
| | Optimizer | AdamW (betas 0.9/0.95, wd 0.1 on matrices only) | | |
| | Schedule | cosine, 200 warmup steps, peak LR 0.0006 | | |
| | Precision | fp16 AMP with loss scaling | | |
| | Hardware | 1x NVIDIA T4 (Colab free tier) | | |
| ## Usage | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| tok = AutoTokenizer.from_pretrained("pythonstudentiam/tinyllm") | |
| model = AutoModelForCausalLM.from_pretrained("pythonstudentiam/tinyllm") | |
| messages = [{"role": "user", "content": "Write a story about a lost puppy."}] | |
| prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) | |
| ids = tok(prompt, return_tensors="pt") | |
| out = model.generate(**ids, max_new_tokens=250, do_sample=True, temperature=0.8) | |
| print(tok.decode(out[0], skip_special_tokens=True)) | |
| ``` | |
| ### With llama.cpp | |
| GGUF conversions are included in this repo. | |
| ```bash | |
| llama-server -m tinyllm-Q8_0.gguf -c 512 --host 127.0.0.1 --port 8080 | |
| ``` | |
| ## Limitations | |
| This model has 15.7M parameters and a 8192-token vocabulary, | |
| trained exclusively on synthetic children's stories. Be concrete about what that means: | |
| - **It only does one thing.** It writes simple short stories in the TinyStories | |
| style. Anything else β code, arithmetic, factual questions, translation, | |
| summarization of arbitrary text β produces confident nonsense. | |
| - **Its vocabulary is small.** Words outside a children's-story vocabulary fall | |
| back to individual bytes, which it handles poorly. | |
| - **Context is 512 tokens.** There is no long-range coherence to be had. | |
| - **No safety tuning of any kind.** It has had no alignment work beyond | |
| instruction tuning on story prompts. | |
| - **Quantization hurts more than usual.** Small models have less parameter | |
| redundancy to absorb rounding error; Q4_K_M is measurably worse here than the | |
| usual "negligible loss" guidance for 7B+ models would suggest. | |
| Not suitable for any production use. It is a teaching artifact. | |
| ## Training data | |
| [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories) β synthetic | |
| short stories generated by GPT-3.5/GPT-4, constrained to the vocabulary of a | |
| 3-4 year old. Licensed CDLA-Sharing-1.0. | |
| Instruction tuning used [TinyStoriesInstruct](https://huggingface.co/datasets/roneneldan/TinyStoriesInstruct). | |