--- language: - hi license: mit library_name: transformers tags: - hindi - story-generation - causal-lm - llama-style - transformer - from-scratch - text-generation datasets: - SmallScale/Simple-Stories-Hindi pipeline_tag: text-generation model-index: - name: Simple-Stories-Hindi-20M results: [] --- # ЁЯУЦ Simple-Stories-Hindi-20M (22.3M Parameters) A **22.3M parameter** decoder-only Transformer language model trained **from scratch** on **2.11 million Hindi simple stories**. The model generates coherent, creative, and grammatically sound Hindi stories given a short text prompt. --- ## ЁЯУК Evaluation & Training Metrics | Metric / Property | Value | |---|---| | **Best Validation Loss** | **`1.6914`** (Cross-Entropy Loss) | | **Total Training Steps** | **386,000 steps** | | **Total Parameters** | **22,310,784 (22.3M)** | | **Non-Embedding Parameters** | **20,006,784 (20M)** | | **Training Dataset** | [SmallScale/Simple-Stories-Hindi](https://huggingface.co/datasets/SmallScale/Simple-Stories-Hindi) (~2.11M stories) | | **Model Size on Disk** | ~86 MB (`model.safetensors`) | --- ## ЁЯПЧя╕П Model Architecture Details | Parameter | Value | Notes | |---|---|---| | **Architecture** | LLaMA-style Decoder | RoPE + SwiGLU + RMSNorm | | **Hidden Size (`d_model`)** | 384 | Vector dimension | | **FFN Intermediate Size** | 1024 | 8/3 ├Ч `d_model` rounded to multiple of 64 | | **Layers (`n_layers`)** | 10 | Transformer blocks | | **Attention Heads (`n_heads`)** | 8 | Multi-Head Self Attention | | **Context Length (`max_seq_len`)** | 512 tokens | Sequence window | | **Vocabulary Size** | 6,000 | SentencePiece Unigram (Devanagari optimized) | | **Weight Tying** | Enabled | Token embeddings & output projection share weights | | **Precision** | float32 | Weights stored in native FP32 safetensors | --- ## ЁЯЪА Quick Start & Usage ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer # Load tokenizer and model directly from Hugging Face 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) if torch.cuda.is_available(): model = model.to("cuda") # Prompt input prompt = "рдПрдХ рд╕рдордп рдХреА рдмрд╛рдд рд╣реИ" inputs = tokenizer(prompt, return_tensors="pt").to(model.device) # Generate story 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 Generated Stories **Prompt:** `рдПрдХ рд╕рдордп рдХреА рдмрд╛рдд рд╣реИ` > *рдПрдХ рд╕рдордп рдХреА рдмрд╛рдд рд╣реИ, рдФрд░ рд╡рд╣ рдПрдХ рд░рд╛рдд рдПрдХ рд▓рдбрд╝рдХреА рдХреЗ рд▓рд┐рдП рд╕рдм рдХреБрдЫ рдмрджрд▓ рд╕рдХрддреА рд╣реИред рд╡рд╣ рдПрдХ рдЖрднрд╛рд╕реА рдХреНрд╖реЗрддреНрд░ рдореЗрдВ рдкреНрд░рд╡реЗрд╢ рдХрд░ рдЧрдИ, рдЬрд╣рд╛рдБ рд╡рд╣ рдПрдХ рд▓рдбрд╝рдХреЗ рд╕реЗ рдорд┐рд▓реА, рдЬреЛ рдЙрд╕рдХреЗ рд╕рдкрдиреЛрдВ рд╕реЗ рдмрдирд╛ рдерд╛ред рд╡реЗ рдЕрдкрдиреЗ рдбрд░ рдФрд░ рдЗрдЪреНрдЫрд╛рдУрдВ рдХреЛ рд╕рд╛рдЭрд╛ рдХрд░рддреЗ рдереЗ...* **Prompt:** `рдПрдХ рдЬрдВрдЧрд▓ рдореЗрдВ` > *рдПрдХ рдЬрдВрдЧрд▓ рдореЗрдВ рдЬрд╣рд╛рдБ рдкреЗрдбрд╝реЛрдВ рдиреЗ рд░рд╣рд╕реНрдпреЛрдВ рдХреЛ рдлреБрд╕рдлреБрд╕рд╛рдпрд╛, рдПрдХ рд▓рдбрд╝рдХрд╛ рдПрдХ рдЫреЛрдЯреА рд╕реА рдЭреЛрдкрдбрд╝реА рдореЗрдВ рд░рд╣рддрд╛ рдерд╛ред рд╡рд╣ рдЕрдХреНрд╕рд░ рд╕реЛрдЪрддрд╛ рдерд╛ рдХрд┐ рдЕрдЧрд░ рд╡рд╣ рдЕрдкрдиреЗ рд╕рдкрдиреЛрдВ рдореЗрдВ рдПрдХ рдкрд░реА рд╕реЗ рдорд┐рд▓ рд╕рдХрддрд╛ рд╣реИ рддреЛ рдХреНрдпрд╛ рд╣реЛрдЧрд╛...* --- ## ЁЯФЧ Related Resources - **GGUF (FP16) Model Repo:** [SmallScale/Simple-Stories-Hindi-20M-GGUF](https://huggingface.co/SmallScale/Simple-Stories-Hindi-20M-GGUF) - **Live In-Browser Demo (WebGPU / WASM):** [SmallScale/simple-stories-20m-webgpu](https://huggingface.co/spaces/SmallScale/simple-stories-20m-webgpu) - **Dataset:** [SmallScale/Simple-Stories-Hindi](https://huggingface.co/datasets/SmallScale/Simple-Stories-Hindi) --- ## ЁЯУД License MIT License