Panini-00 18M
Hindi ↔ Sanskrit sentence translation in Devanagari. Custom PyTorch checkpoint, not a Transformers model.
Files
| File | Role |
|---|---|
checkpoint.pt |
Model weights |
tokenizer.model |
SentencePiece tokenizer, 16,000 pieces |
Keep this tokenizer with this checkpoint. It does not match Panini-00 10M or Panini-00 50M.
Tasks
| Task | Direction |
|---|---|
translate_hi_sa |
Hindi → Sanskrit |
translate_sa_hi |
Sanskrit → Hindi |
sanskritize_hindi |
Hindi with Sanskrit words |
correct_hi |
Hindi grammar and word choice |
correct_sa |
Sanskrit grammar |
Pass one Devanagari sentence. The loader adds the task tags.
Examples
| Task | Prompt | Example |
|---|---|---|
sanskritize_hindi |
मैं स्कूल जाता हूँ और पानी पीता हूँ। | मैं विद्यालय जाता हूँ और जल पीता हूँ। |
sanskritize_hindi |
यह किताब बहुत अच्छी है। | यह पुस्तक अति उत्तम है। |
correct_hi |
यह पुस्तक अच्छा है। | यह पुस्तक अच्छी है। |
correct_hi |
वह किताब पढ़ता हैं। | वह किताब पढ़ता है। |
correct_sa |
अहं गृहं गच्छति। | अहं गृहं गच्छामि। |
correct_sa |
बालकः पुस्तकं पठन्ति। | बालकः पुस्तकं पठति। |
translate_hi_sa |
मैं किताब पढ़ता हूँ। | अहं पुस्तकं पठामि। |
Size
| Parameters | 18,143,616 |
| Layers | 8 |
| Width | 384 |
| Query / key-value heads | 6 / 2 |
| Head dimension | 64 |
| Feed-forward width | 960 |
| Context | 512 tokens |
| Vocabulary | 16,000 |
| Pretrain tokens | 29,924,160 |
| Supervised tokens | 28,849,820 |
| Supervised examples | 312,176 |
Install
Reference code: midroid/ai-models, branch experiment/010-hindi-sanskrit. Python 3.10+, PyTorch, SentencePiece, and PyYAML.
git clone --branch experiment/010-hindi-sanskrit --depth 1 https://github.com/midroid/ai-models.git
cd ai-models/experiments/language/010-hindi-sanskrit-slm
uv sync
huggingface-cli download akashchauhan/panini-00-18m --local-dir weights/panini-00-18m
Inference
Greedy decoding (temperature 0). Generation stops at end-of-sequence and cannot pass the 512-token context, including the prompt.
uv run python -m src.sample \
--checkpoint weights/panini-00-18m \
--task translate_hi_sa \
--prompt "मैं किताब पढ़ता हूँ।" \
--max-new-tokens 32
The translation is the text after <tgt>.
from src.sample import continue_prompt
text, _ = continue_prompt(
"weights/panini-00-18m",
"translate_sa_hi",
"अहं पुस्तकं पठामि।",
max_new_tokens=32,
temperature=0.0,
)
print(text.split("<tgt>", 1)[-1].strip())
CPU is sufficient.