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
tinyllm: instruction-tuned
Browse files- README.md +102 -0
- chat_template.jinja +1 -0
- config.json +32 -0
- generation_config.json +12 -0
- model.safetensors +3 -0
- tokenizer.json +144 -0
- tokenizer.model +3 -0
- tokenizer_config.json +12 -0
- training_metadata.json +164 -0
README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cdla-sharing-1.0
|
| 3 |
+
datasets:
|
| 4 |
+
- roneneldan/TinyStories
|
| 5 |
+
- roneneldan/TinyStoriesInstruct
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- llama
|
| 11 |
+
- tiny
|
| 12 |
+
- educational
|
| 13 |
+
- gguf
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# tinyllm — instruction-tuned
|
| 17 |
+
|
| 18 |
+
A 15.7M-parameter Llama-architecture language model trained from
|
| 19 |
+
random initialization on [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories).
|
| 20 |
+
|
| 21 |
+
Built as a complete walk through the model lifecycle — tokenizer, architecture,
|
| 22 |
+
pretraining, evaluation, instruction tuning, packaging, quantization, and local
|
| 23 |
+
serving. It is small enough to train in about 45 minutes on a free Colab T4 and
|
| 24 |
+
to run on a 2-core laptop CPU with no GPU.
|
| 25 |
+
|
| 26 |
+
## Architecture
|
| 27 |
+
|
| 28 |
+
| | |
|
| 29 |
+
|---|---|
|
| 30 |
+
| Parameters | 15,735,168 (12,589,440 non-embedding) |
|
| 31 |
+
| Layers | 8 |
|
| 32 |
+
| Hidden size | 384 |
|
| 33 |
+
| Attention heads | 6 query / 2 key-value (GQA) |
|
| 34 |
+
| Head dim | 64 |
|
| 35 |
+
| MLP | SwiGLU, intermediate 1024 |
|
| 36 |
+
| Normalization | RMSNorm (eps 1e-05) |
|
| 37 |
+
| Position encoding | RoPE (theta 10000) |
|
| 38 |
+
| Context length | 512 |
|
| 39 |
+
| Vocabulary | 8192 (SentencePiece BPE, byte fallback) |
|
| 40 |
+
| Embeddings | tied input/output |
|
| 41 |
+
|
| 42 |
+
## Training
|
| 43 |
+
|
| 44 |
+
| | |
|
| 45 |
+
|---|---|
|
| 46 |
+
| Tokens | 164M (~10 per parameter) |
|
| 47 |
+
| Steps | 2,500 at 65,536 tokens/step |
|
| 48 |
+
| Optimizer | AdamW (betas 0.9/0.95, wd 0.1 on matrices only) |
|
| 49 |
+
| Schedule | cosine, 200 warmup steps, peak LR 0.0006 |
|
| 50 |
+
| Precision | fp16 AMP with loss scaling |
|
| 51 |
+
| Hardware | 1x NVIDIA T4 (Colab free tier) |
|
| 52 |
+
|
| 53 |
+
## Usage
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 57 |
+
|
| 58 |
+
tok = AutoTokenizer.from_pretrained("pythonstudentiam/tinyllm")
|
| 59 |
+
model = AutoModelForCausalLM.from_pretrained("pythonstudentiam/tinyllm")
|
| 60 |
+
|
| 61 |
+
messages = [{"role": "user", "content": "Write a story about a lost puppy."}]
|
| 62 |
+
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 63 |
+
ids = tok(prompt, return_tensors="pt")
|
| 64 |
+
out = model.generate(**ids, max_new_tokens=250, do_sample=True, temperature=0.8)
|
| 65 |
+
print(tok.decode(out[0], skip_special_tokens=True))
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### With llama.cpp
|
| 69 |
+
|
| 70 |
+
GGUF conversions are included in this repo.
|
| 71 |
+
|
| 72 |
+
```bash
|
| 73 |
+
llama-server -m tinyllm-Q8_0.gguf -c 512 --host 127.0.0.1 --port 8080
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
## Limitations
|
| 77 |
+
|
| 78 |
+
This model has 15.7M parameters and a 8192-token vocabulary,
|
| 79 |
+
trained exclusively on synthetic children's stories. Be concrete about what that means:
|
| 80 |
+
|
| 81 |
+
- **It only does one thing.** It writes simple short stories in the TinyStories
|
| 82 |
+
style. Anything else — code, arithmetic, factual questions, translation,
|
| 83 |
+
summarization of arbitrary text — produces confident nonsense.
|
| 84 |
+
- **Its vocabulary is small.** Words outside a children's-story vocabulary fall
|
| 85 |
+
back to individual bytes, which it handles poorly.
|
| 86 |
+
- **Context is 512 tokens.** There is no long-range coherence to be had.
|
| 87 |
+
- **No safety tuning of any kind.** It has had no alignment work beyond
|
| 88 |
+
instruction tuning on story prompts.
|
| 89 |
+
- **Quantization hurts more than usual.** Small models have less parameter
|
| 90 |
+
redundancy to absorb rounding error; Q4_K_M is measurably worse here than the
|
| 91 |
+
usual "negligible loss" guidance for 7B+ models would suggest.
|
| 92 |
+
|
| 93 |
+
Not suitable for any production use. It is a teaching artifact.
|
| 94 |
+
|
| 95 |
+
## Training data
|
| 96 |
+
|
| 97 |
+
[TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories) — synthetic
|
| 98 |
+
short stories generated by GPT-3.5/GPT-4, constrained to the vocabulary of a
|
| 99 |
+
3-4 year old. Licensed CDLA-Sharing-1.0.
|
| 100 |
+
|
| 101 |
+
Instruction tuning used [TinyStoriesInstruct](https://huggingface.co/datasets/roneneldan/TinyStoriesInstruct).
|
| 102 |
+
|
chat_template.jinja
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{{ '<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"head_dim": 64,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 384,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 1024,
|
| 15 |
+
"max_position_embeddings": 512,
|
| 16 |
+
"mlp_bias": false,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 6,
|
| 19 |
+
"num_hidden_layers": 8,
|
| 20 |
+
"num_key_value_heads": 2,
|
| 21 |
+
"pad_token_id": 3,
|
| 22 |
+
"pretraining_tp": 1,
|
| 23 |
+
"rms_norm_eps": 1e-05,
|
| 24 |
+
"rope_parameters": {
|
| 25 |
+
"rope_theta": 10000.0,
|
| 26 |
+
"rope_type": "default"
|
| 27 |
+
},
|
| 28 |
+
"tie_word_embeddings": true,
|
| 29 |
+
"transformers_version": "5.13.1",
|
| 30 |
+
"use_cache": true,
|
| 31 |
+
"vocab_size": 8192
|
| 32 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 1,
|
| 3 |
+
"eos_token_id": 2,
|
| 4 |
+
"pad_token_id": 3,
|
| 5 |
+
"do_sample": true,
|
| 6 |
+
"temperature": 0.8,
|
| 7 |
+
"top_p": 0.95,
|
| 8 |
+
"top_k": 40,
|
| 9 |
+
"repetition_penalty": 1.1,
|
| 10 |
+
"max_new_tokens": 256,
|
| 11 |
+
"transformers_version": "5.13.1"
|
| 12 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb1646ce3e70f0b72a5329948d8c02de5939999ef33fa322f29a5304387b700a
|
| 3 |
+
size 62948736
|
tokenizer.json
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "1.0",
|
| 3 |
+
"truncation": null,
|
| 4 |
+
"padding": null,
|
| 5 |
+
"added_tokens": [
|
| 6 |
+
{
|
| 7 |
+
"id": 0,
|
| 8 |
+
"content": "<unk>",
|
| 9 |
+
"single_word": false,
|
| 10 |
+
"lstrip": false,
|
| 11 |
+
"rstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"special": true
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"id": 1,
|
| 17 |
+
"content": "<s>",
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"normalized": false,
|
| 22 |
+
"special": true
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"id": 2,
|
| 26 |
+
"content": "<|im_end|>",
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"lstrip": false,
|
| 29 |
+
"rstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"special": true
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"id": 3,
|
| 35 |
+
"content": "<pad>",
|
| 36 |
+
"single_word": false,
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"rstrip": false,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"special": true
|
| 41 |
+
}
|
| 42 |
+
],
|
| 43 |
+
"normalizer": null,
|
| 44 |
+
"pre_tokenizer": {
|
| 45 |
+
"type": "Metaspace",
|
| 46 |
+
"replacement": "▁",
|
| 47 |
+
"prepend_scheme": "first",
|
| 48 |
+
"split": false
|
| 49 |
+
},
|
| 50 |
+
"post_processor": {
|
| 51 |
+
"type": "TemplateProcessing",
|
| 52 |
+
"single": [
|
| 53 |
+
{
|
| 54 |
+
"SpecialToken": {
|
| 55 |
+
"id": "<s>",
|
| 56 |
+
"type_id": 0
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"Sequence": {
|
| 61 |
+
"id": "A",
|
| 62 |
+
"type_id": 0
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
],
|
| 66 |
+
"pair": [
|
| 67 |
+
{
|
| 68 |
+
"SpecialToken": {
|
| 69 |
+
"id": "<s>",
|
| 70 |
+
"type_id": 0
|
| 71 |
+
}
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"Sequence": {
|
| 75 |
+
"id": "A",
|
| 76 |
+
"type_id": 0
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"SpecialToken": {
|
| 81 |
+
"id": "<s>",
|
| 82 |
+
"type_id": 1
|
| 83 |
+
}
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"Sequence": {
|
| 87 |
+
"id": "B",
|
| 88 |
+
"type_id": 1
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
],
|
| 92 |
+
"special_tokens": {
|
| 93 |
+
"<s>": {
|
| 94 |
+
"id": "<s>",
|
| 95 |
+
"ids": [
|
| 96 |
+
1
|
| 97 |
+
],
|
| 98 |
+
"tokens": [
|
| 99 |
+
"<s>"
|
| 100 |
+
]
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
},
|
| 104 |
+
"decoder": {
|
| 105 |
+
"type": "Sequence",
|
| 106 |
+
"decoders": [
|
| 107 |
+
{
|
| 108 |
+
"type": "Replace",
|
| 109 |
+
"pattern": {
|
| 110 |
+
"String": "▁"
|
| 111 |
+
},
|
| 112 |
+
"content": " "
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"type": "ByteFallback"
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"type": "Fuse"
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"type": "Strip",
|
| 122 |
+
"content": " ",
|
| 123 |
+
"start": 1,
|
| 124 |
+
"stop": 0
|
| 125 |
+
}
|
| 126 |
+
]
|
| 127 |
+
},
|
| 128 |
+
"model": {
|
| 129 |
+
"type": "BPE",
|
| 130 |
+
"dropout": null,
|
| 131 |
+
"unk_token": null,
|
| 132 |
+
"continuing_subword_prefix": null,
|
| 133 |
+
"end_of_word_suffix": null,
|
| 134 |
+
"fuse_unk": true,
|
| 135 |
+
"byte_fallback": true,
|
| 136 |
+
"ignore_merges": false,
|
| 137 |
+
"vocab": {
|
| 138 |
+
"<unk>": 0,
|
| 139 |
+
"<s>": 1,
|
| 140 |
+
"<|im_end|>": 2
|
| 141 |
+
},
|
| 142 |
+
"merges": []
|
| 143 |
+
}
|
| 144 |
+
}
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c89d5b8716d7431c6e3c0b2ba8cab7dfbac48af8e0a6303c93d5d66dee3c6d7b
|
| 3 |
+
size 134480
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": null,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"model_max_length": 512,
|
| 8 |
+
"pad_token": "<pad>",
|
| 9 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 10 |
+
"unk_token": "<unk>",
|
| 11 |
+
"use_default_system_prompt": false
|
| 12 |
+
}
|
training_metadata.json
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"config": {
|
| 3 |
+
"project": "tinyllm",
|
| 4 |
+
"hub": {
|
| 5 |
+
"user": "pythonstudentiam",
|
| 6 |
+
"model_repo_suffix": "tinyllm",
|
| 7 |
+
"ckpt_repo_suffix": "tinyllm-checkpoints",
|
| 8 |
+
"model_repo": "pythonstudentiam/tinyllm",
|
| 9 |
+
"ckpt_repo": "pythonstudentiam/tinyllm-checkpoints"
|
| 10 |
+
},
|
| 11 |
+
"tokenizer": {
|
| 12 |
+
"vocab_size": 8192,
|
| 13 |
+
"model_type": "bpe",
|
| 14 |
+
"character_coverage": 1.0,
|
| 15 |
+
"train_sentences": 400000,
|
| 16 |
+
"max_sentence_length": 8192,
|
| 17 |
+
"unk_id": 0,
|
| 18 |
+
"bos_id": 1,
|
| 19 |
+
"eos_id": 2,
|
| 20 |
+
"pad_id": 3,
|
| 21 |
+
"unk_piece": "<unk>",
|
| 22 |
+
"bos_piece": "<s>",
|
| 23 |
+
"eos_piece": "</s>",
|
| 24 |
+
"pad_piece": "<pad>",
|
| 25 |
+
"im_start": "<|im_start|>",
|
| 26 |
+
"im_end": "<|im_end|>",
|
| 27 |
+
"user_defined_symbols": [
|
| 28 |
+
"<|im_start|>",
|
| 29 |
+
"<|im_end|>"
|
| 30 |
+
],
|
| 31 |
+
"chat_template": "{% for message in messages %}{{ '<|im_start|>' + message['role'] + '\\n' + message['content'] + '<|im_end|>' + '\\n' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\\n' }}{% endif %}"
|
| 32 |
+
},
|
| 33 |
+
"model": {
|
| 34 |
+
"hidden_size": 384,
|
| 35 |
+
"num_hidden_layers": 8,
|
| 36 |
+
"num_attention_heads": 6,
|
| 37 |
+
"num_key_value_heads": 2,
|
| 38 |
+
"intermediate_size": 1024,
|
| 39 |
+
"vocab_size": 8192,
|
| 40 |
+
"max_position_embeddings": 512,
|
| 41 |
+
"rope_theta": 10000.0,
|
| 42 |
+
"rms_norm_eps": 1e-05,
|
| 43 |
+
"tie_word_embeddings": true,
|
| 44 |
+
"attention_bias": false,
|
| 45 |
+
"mlp_bias": false,
|
| 46 |
+
"initializer_range": 0.02,
|
| 47 |
+
"head_dim": 64,
|
| 48 |
+
"kv_dim": 128,
|
| 49 |
+
"n_rep": 3,
|
| 50 |
+
"n_params": 15735168
|
| 51 |
+
},
|
| 52 |
+
"data": {
|
| 53 |
+
"dataset_id": "roneneldan/TinyStories",
|
| 54 |
+
"instruct_dataset_id": "roneneldan/TinyStoriesInstruct",
|
| 55 |
+
"train_split": "train",
|
| 56 |
+
"val_split": "validation",
|
| 57 |
+
"seq_len": 512,
|
| 58 |
+
"val_tokens": 1000000,
|
| 59 |
+
"shard_tokens": 25000000,
|
| 60 |
+
"seed": 1337
|
| 61 |
+
},
|
| 62 |
+
"train": {
|
| 63 |
+
"micro_batch_size": 32,
|
| 64 |
+
"grad_accum_steps": 4,
|
| 65 |
+
"max_steps": 2500,
|
| 66 |
+
"learning_rate": 0.0006,
|
| 67 |
+
"min_lr_ratio": 0.1,
|
| 68 |
+
"warmup_steps": 200,
|
| 69 |
+
"weight_decay": 0.1,
|
| 70 |
+
"beta1": 0.9,
|
| 71 |
+
"beta2": 0.95,
|
| 72 |
+
"grad_clip": 1.0,
|
| 73 |
+
"dtype": "fp16",
|
| 74 |
+
"compile_model": false,
|
| 75 |
+
"eval_every": 250,
|
| 76 |
+
"eval_batches": 40,
|
| 77 |
+
"sample_every": 500,
|
| 78 |
+
"log_every": 10,
|
| 79 |
+
"checkpoint_every": 500,
|
| 80 |
+
"keep_last_n_checkpoints": 2,
|
| 81 |
+
"seed": 1337,
|
| 82 |
+
"smoke_max_steps": 50,
|
| 83 |
+
"smoke_stories": 2000,
|
| 84 |
+
"tokens_per_step": 65536,
|
| 85 |
+
"total_tokens": 163840000,
|
| 86 |
+
"min_lr": 5.9999999999999995e-05
|
| 87 |
+
},
|
| 88 |
+
"sft": {
|
| 89 |
+
"micro_batch_size": 16,
|
| 90 |
+
"grad_accum_steps": 4,
|
| 91 |
+
"max_steps": 1500,
|
| 92 |
+
"learning_rate": 0.0001,
|
| 93 |
+
"min_lr_ratio": 0.1,
|
| 94 |
+
"warmup_steps": 50,
|
| 95 |
+
"weight_decay": 0.0,
|
| 96 |
+
"beta1": 0.9,
|
| 97 |
+
"beta2": 0.95,
|
| 98 |
+
"grad_clip": 1.0,
|
| 99 |
+
"seq_len": 512,
|
| 100 |
+
"ignore_index": -100,
|
| 101 |
+
"eval_every": 200,
|
| 102 |
+
"log_every": 10,
|
| 103 |
+
"checkpoint_every": 500,
|
| 104 |
+
"seed": 1337
|
| 105 |
+
},
|
| 106 |
+
"gen": {
|
| 107 |
+
"max_new_tokens": 256,
|
| 108 |
+
"temperature": 0.8,
|
| 109 |
+
"top_p": 0.95,
|
| 110 |
+
"top_k": 40,
|
| 111 |
+
"repetition_penalty": 1.1,
|
| 112 |
+
"eval_prompts": [
|
| 113 |
+
"Once upon a time, there was a little girl named Lily.",
|
| 114 |
+
"Tom and Sara went to the park. They saw a big",
|
| 115 |
+
"The cat was very hungry, so it"
|
| 116 |
+
],
|
| 117 |
+
"eval_instructions": [
|
| 118 |
+
"Write a story about a lost puppy who finds its way home.",
|
| 119 |
+
"Write a short story using the words: ball, tree, happy.",
|
| 120 |
+
"Tell me a story about a brave little boat."
|
| 121 |
+
]
|
| 122 |
+
},
|
| 123 |
+
"quant": {
|
| 124 |
+
"levels": [
|
| 125 |
+
"Q8_0",
|
| 126 |
+
"Q5_K_M",
|
| 127 |
+
"Q4_K_M"
|
| 128 |
+
],
|
| 129 |
+
"perplexity_ctx": 512,
|
| 130 |
+
"perplexity_chunks": 40
|
| 131 |
+
},
|
| 132 |
+
"serve": {
|
| 133 |
+
"host": "127.0.0.1",
|
| 134 |
+
"port": 8080,
|
| 135 |
+
"threads": 4,
|
| 136 |
+
"ctx_size": 512,
|
| 137 |
+
"served_model_name": "tinyllm",
|
| 138 |
+
"default_quant": "Q8_0",
|
| 139 |
+
"llamacpp_build": "b10107",
|
| 140 |
+
"llamacpp_asset": "llama-b10107-bin-win-cpu-x64.zip",
|
| 141 |
+
"base_url": "http://127.0.0.1:8080/v1",
|
| 142 |
+
"llamacpp_url": "https://github.com/ggml-org/llama.cpp/releases/download/b10107/llama-b10107-bin-win-cpu-x64.zip"
|
| 143 |
+
},
|
| 144 |
+
"derived": {
|
| 145 |
+
"head_dim": 64,
|
| 146 |
+
"kv_dim": 128,
|
| 147 |
+
"n_params": 15735168,
|
| 148 |
+
"param_breakdown": {
|
| 149 |
+
"embedding": 3145728,
|
| 150 |
+
"attention": 3145728,
|
| 151 |
+
"mlp": 9437184,
|
| 152 |
+
"layernorms": 6528,
|
| 153 |
+
"lm_head": 0,
|
| 154 |
+
"per_layer": 1573632,
|
| 155 |
+
"blocks_total": 12589056,
|
| 156 |
+
"non_embedding": 12589440,
|
| 157 |
+
"total": 15735168
|
| 158 |
+
},
|
| 159 |
+
"tokens_per_step": 65536,
|
| 160 |
+
"total_tokens": 163840000,
|
| 161 |
+
"flops_per_token": 94411008
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
}
|