Instructions to use SmallScale/Simple-Stories-Hindi-20M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SmallScale/Simple-Stories-Hindi-20M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SmallScale/Simple-Stories-Hindi-20M", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("SmallScale/Simple-Stories-Hindi-20M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SmallScale/Simple-Stories-Hindi-20M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SmallScale/Simple-Stories-Hindi-20M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SmallScale/Simple-Stories-Hindi-20M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SmallScale/Simple-Stories-Hindi-20M
- SGLang
How to use SmallScale/Simple-Stories-Hindi-20M 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 "SmallScale/Simple-Stories-Hindi-20M" \ --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": "SmallScale/Simple-Stories-Hindi-20M", "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 "SmallScale/Simple-Stories-Hindi-20M" \ --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": "SmallScale/Simple-Stories-Hindi-20M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SmallScale/Simple-Stories-Hindi-20M with Docker Model Runner:
docker model run hf.co/SmallScale/Simple-Stories-Hindi-20M
Simple-Stories-Hindi-20M
A 20M parameter decoder-only Transformer language model trained from scratch on Hindi simple stories. The model generates coherent, creative Hindi stories given a short prompt.
Model Details
| Property | Value |
|---|---|
| Parameters | 22.3M total (20M non-embedding) |
| Architecture | LLaMA-style (RoPE + SwiGLU + RMSNorm) |
| Hidden Size | 384 |
| Layers | 10 |
| Attention Heads | 8 |
| Context Length | 512 tokens |
| Vocabulary | 6,000 (SentencePiece Unigram) |
| Training Data | Simple-Stories-Hindi (~2.11M stories) |
| Precision | float32 |
| Model Size | ~86 MB |
| Best Val Loss | 1.6914 |
| Training Steps | 386,000 |
Quick Start
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("SmallScale/Simple-Stories-Hindi-20M", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("SmallScale/Simple-Stories-Hindi-20M", trust_remote_code=True)
prompt = "एक समय की बात है"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=200,
do_sample=True,
top_k=40,
top_p=0.95,
temperature=0.8,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Sample Outputs
Prompt: एक समय की बात है
एक समय की बात है, और वह एक रात एक लड़की के लिए सब कुछ बदल सकती है। वह एक आभासी क्षेत्र में प्रवेश कर गई, जहाँ वह एक लड़के से मिली, जो उसके सपनों से बना था। वे अपने डर और इच्छाओं को साझा करते थे, और उसे लगता था कि कुछ बदल रहा है...
Prompt: एक जंगल में
एक जंगल में जहाँ पेड़ों ने रहस्यों को फुसफुसाया, एक लड़का एक छोटी सी झोपड़ी में रहता था। वह अक्सर सोचता था कि अगर वह अपने सपनों में एक परी से मिल सकता है तो क्या होगा। एक रात, उसने एक नरम आवाज़ सुनी जो उसका नाम लेती है...
Prompt: एक छोटी लड़की
एक छोटी लड़की ने अपनी पुरानी तस्वीर को देखा। उसमें वह अपने भाई के साथ मुस्कुराती थी। लेकिन अब, वह चली गई, और वह अकेला महसूस करती थी...
Architecture
This is a custom LLaMA-style decoder-only Transformer built from scratch with:
- Rotary Position Embeddings (RoPE) for position encoding
- SwiGLU feed-forward blocks
- RMSNorm (pre-norm) for layer normalization
- Scaled Dot-Product Attention (FlashAttention-compatible via
torch.nn.functional.scaled_dot_product_attention) - Weight Tying between token embeddings and output projection
Training
- Dataset: SmallScale/Simple-Stories-Hindi — ~2.11 million simple Hindi stories (translated and edited)
- Tokenizer: SentencePiece Unigram with 6,000 vocabulary, byte-fallback enabled, optimized for Hindi Devanagari script
- Optimizer: AdamW (lr=2e-4, weight_decay=0.1, grad_clip=1.0)
- Training: Mixed precision (bfloat16), cosine learning rate schedule with 10K warmup steps
Files
| File | Description |
|---|---|
model.safetensors |
Model weights in safetensors format |
modeling_simple_stories.py |
Custom model architecture (auto-loaded by trust_remote_code=True) |
config.json |
HuggingFace model configuration |
tokenizer.model |
SentencePiece tokenizer model |
tokenizer.vocab |
Tokenizer vocabulary |
tokenizer_config.json |
HuggingFace tokenizer configuration |
test_model.py |
Smoke test script |
Limitations
- Small model (20M parameters) — best for simple, short stories
- Trained only on Hindi simple stories data
- Context window limited to 512 tokens
- May produce repetitive text for longer generations
License
MIT
- Downloads last month
- -