Instructions to use somdevsheel/prajna-ai-124m-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use somdevsheel/prajna-ai-124m-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="somdevsheel/prajna-ai-124m-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("somdevsheel/prajna-ai-124m-chat") model = AutoModelForCausalLM.from_pretrained("somdevsheel/prajna-ai-124m-chat", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use somdevsheel/prajna-ai-124m-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "somdevsheel/prajna-ai-124m-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "somdevsheel/prajna-ai-124m-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/somdevsheel/prajna-ai-124m-chat
- SGLang
How to use somdevsheel/prajna-ai-124m-chat 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 "somdevsheel/prajna-ai-124m-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "somdevsheel/prajna-ai-124m-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "somdevsheel/prajna-ai-124m-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "somdevsheel/prajna-ai-124m-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use somdevsheel/prajna-ai-124m-chat with Docker Model Runner:
docker model run hf.co/somdevsheel/prajna-ai-124m-chat
prajna-ai-124m-chat
Formerly
kaggle-llm-124m-chat(old links redirect here).
A 124M-parameter chat model trained from scratch on free Kaggle GPUs (2x NVIDIA T4): pretrained on 1.92B tokens of FineWeb-Edu, extended to a 4,096-token context on 580M tokens of India-focused English text, then supervised fine-tuned on 457K English conversations (smol-smoltalk), 27K romanised Hindi/Hinglish conversations (samvaad) and 1,500 synthetic identity conversations, so it calls itself Prajna AI.
It is a learning project, not a production assistant: it follows the chat format, writes simple code and replies in Hinglish, but it often states wrong facts confidently.
Usage
The weights are a standard LlamaForCausalLM with the GPT-2 tokenizer, so plain transformers works:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "somdevsheel/prajna-ai-124m-chat"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.float16).to("cuda")
messages = [{"role": "user", "content": "Write a Python function that reverses a string."}]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to("cuda")
out = model.generate(ids, attention_mask=torch.ones_like(ids), max_new_tokens=200,
do_sample=True, temperature=0.7, top_k=50, repetition_penalty=1.15)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
Recommended sampling: temperature 0.7, top-k 50, repetition penalty 1.15. Context length is 4,096 tokens.
Chat format (role tags are plain text; each assistant turn ends with <|endoftext|>):
<|system|>
...
<|user|>
...
<|assistant|>
...<|endoftext|>
Model
| Architecture | Decoder-only Transformer, LLaMA-style: RoPE, RMSNorm (pre-norm), SwiGLU, no biases, tied embeddings |
| Size | 123.6M parameters (85.0M non-embedding) |
| Shape | 12 layers, hidden 768, 12 heads, FFN 2048, context 4096 (RoPE theta 100,000) |
| Tokenizer | GPT-2 BPE (vocab padded to 50,304) |
Training
| Stage | Data | Compute | Result |
|---|---|---|---|
| Pretraining | 1.92B tokens of FineWeb-Edu (sample-10BT) | 3,661 steps x 524K tokens (two runs), about 21 h on 2x T4 | val loss 3.30 (perplexity 27) |
| Context extension | 580M tokens of India-focused English (Sangraha, Wikipedia, FineWeb-Edu), context 1024 -> 4096 | 2,211 steps x 262K tokens, about 8.5 h on 2x T4 | val loss at 4096 tokens 5.02 -> 3.25 |
| Chat SFT | 457K conversations from smol-smoltalk + 27K Latin-script conversations from samvaad-hi-v1 + 1.5K identity conversations (English and Hinglish), packed into 4096-token blocks (402M tokens) | 3,064 steps x 131K tokens, about 5.7 h on 2x T4 | val loss on assistant tokens 2.49 -> 1.46 |
- PyTorch DDP across 2 GPUs, fp16 mixed precision with loss scaling, AdamW (0.9, 0.95), weight decay 0.1, cosine LR schedule.
- Pretraining LR 1.2e-3, then continued pretraining at 6e-4 on unseen data; the trainer measured its own speed and fitted the cosine schedule into the 12-hour Kaggle session limit.
- SFT LR 2e-4; loss computed on assistant tokens only; whole conversations first-fit packed (99% fill). Identity conversations are train-only.
Comparison with earlier releases on the same held-out sets (assistant-token loss, 1024-token blocks; lower is better):
| Version | smol-smoltalk val | samvaad (Hinglish) val |
|---|---|---|
| v3 (1024 context, English SFT) | 1.450 | 3.543 |
| v4 (1024 context, + Hinglish) | 1.458 | 2.475 |
| v5 (this release, 4096 context) | 1.415 | 2.318 |
Limitations
- Hallucination. About 20 pretraining tokens per parameter (Chinchilla-optimal is ~20), so its knowledge is thin. Example: asked "What is DSA in computer science?", it invents a definition.
- Asked about itself it gives the right name and creator, but may add invented details around them.
- Hinglish replies are fluent-sounding but often incoherent. Devanagari script was not trained.
- No safety tuning or preference training (no RLHF/DPO).
- Short code is often correct (string reversal, prime check); longer or vaguely specified code usually is not.
- Do not rely on it for factual, medical, legal or financial answers.
Base model
Pretrained-only weights (4096 context): somdevsheel/prajna-ai-124m-base.
- Downloads last month
- 601
Model tree for somdevsheel/prajna-ai-124m-chat
Base model
somdevsheel/prajna-ai-124m-base