Views
No views yet
Sayansantra/pytho25M) is an ultra-compact ~25 Million parameter language model designed specifically for Python code generation and instruction following. Pytho 25M delivers fast, syntactically valid Python code snippets while using under 30 MB of RAM.| Property | Value |
|---|---|
| Model Name | Pytho 25M (Sayansantra/pytho25M) |
| Parameters | 25.10 Million (25,103,232) |
| Architecture | Llama-2 Causal LM |
| Layers | 14 Hidden Layers |
Hidden Size (d_model) | 384 |
Intermediate Size (mlp) | 1024 |
| Attention Heads | 6 (Grouped-Query Attention w/ 2 KV Heads) |
| Vocabulary Size | 8,000 (Custom Byte-Level BPE) |
| Max Context Length | 512 Tokens |
| Special Tokens | <s>, <pad>, </s>, <unk>, `< |
| PyTorch Size | 95.77 MB (FP32 Safetensors) |
| GGUF Q4_K_M Size | 17.71 MB |
| Metric / Evaluation Criterion | 🚀 Pytho 25M | 📖 TinyStories-28M/33M | 🔬 Pythia-14M/70M | 🛠️ DistilGPT2 (88M) | ⚡ SmolLM-135M |
|---|---|---|---|---|---|
Python Syntax Accuracy (ast.parse) | 100.0% 🏆 | 0.0% (Fails) | 12.5% (Rambles) | 25.0% (Web noise) | 75.0% |
| **Instruction Following (`< | user | >->< | assistant | >`)** | 100.0% 🏆 |
| Quantized GGUF Model Size | 17.71 MB 🏆 | ~112.0 MB | ~280.0 MB | ~352.0 MB | ~540.0 MB |
| RAM Footprint (GGUF) | < 30 MB 🏆 | ~140 MB | ~310 MB | ~400 MB | ~600 MB |
| CPU Generation Speed | > 200 t/s 🏆 | ~85 t/s | ~65 t/s | ~45 t/s | ~30 t/s |
| Parameter Efficiency Ratio (Code Score / RAM) | 3.33 🏆 | 0.00 | 0.04 | 0.06 | 0.12 |
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4model_id = "Sayansantra/pytho25M"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)
8
9prompt = "<|system|>\nYou are an expert Python coding assistant.</s>\n<|user|>\nWrite a python function to check if a number is prime.</s>\n<|assistant|>\n"
10
11inputs = tokenizer(prompt, return_tensors="pt")
12outputs = model.generate(
13 **inputs,
14 max_new_tokens=60,
15 do_sample=True,
16 temperature=0.7,
17 pad_token_id=tokenizer.eos_token_id
18)
19
20print(tokenizer.decode(outputs[0], skip_special_tokens=True))llama-cpp-python1from llama_cpp import Llama
2
3llm = Llama.from_pretrained(
4 repo_id="Sayansantra/pytho25M",
5 filename="pytho25m_Q4_K_M.gguf",
6 verbose=False
7)
8
9prompt = "<|system|>\nYou are an expert Python coding assistant.</s>\n<|user|>\nWrite a python function to reverse a string.</s>\n<|assistant|>\n"
10response = llm(prompt, max_tokens=50)
11print(response["choices"][0]["text"])