Instructions to use kshitijthakkar/shlokartha with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kshitijthakkar/shlokartha with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kshitijthakkar/shlokartha") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kshitijthakkar/shlokartha") model = AutoModelForCausalLM.from_pretrained("kshitijthakkar/shlokartha", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kshitijthakkar/shlokartha with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kshitijthakkar/shlokartha" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kshitijthakkar/shlokartha", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kshitijthakkar/shlokartha
- SGLang
How to use kshitijthakkar/shlokartha 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 "kshitijthakkar/shlokartha" \ --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": "kshitijthakkar/shlokartha", "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 "kshitijthakkar/shlokartha" \ --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": "kshitijthakkar/shlokartha", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kshitijthakkar/shlokartha with Docker Model Runner:
docker model run hf.co/kshitijthakkar/shlokartha
Shlokartha Vāgartha SFT
Shlokartha is a compact causal language model fine-tuned for layered Sanskrit verse interpretation. It is designed to separate Pada Artha (word-by-word meaning), Anvaya (semantic translation), and Bhavartha (expanded context) while preserving Devanagari and transliteration where useful.
Model details
- Base checkpoint:
kshitijthakkar/loggenix-moe-0.4B-0.2A-sft-s4 - Training type: full-parameter supervised fine-tuning
- Training dataset:
kshitijthakkar/shlokartha-sft - Upstream corpus:
sarvamai/vagartha - Demo:
kshitijthakkar/shlokartha-playground
Training configuration
The final run used three epochs and 3,372 optimizer steps:
| Setting | Value |
|---|---|
| Learning rate | 2e-4 |
| Scheduler | cosine |
| Warmup | 10% of training steps |
| Per-device batch size | 4 |
| Gradient accumulation | 8 |
| Effective batch size | 32 sequences/update |
| Maximum sequence length | 8,192 tokens |
| Packing | enabled |
| Precision | bfloat16 |
| Optimizer | adamw_torch_fused |
| Gradient checkpointing | enabled |
| Hardware | 1 × 96 GB RTX 6000-class GPU |
The held-out validation split contained 4,404 examples. The final logged
validation loss was 1.469 and mean token accuracy was 0.6935. These are
training diagnostics, not a claim of expert-level Sanskrit correctness or a
substitute for human evaluation.
Intended use
Use this checkpoint for experimentation with Sanskrit verse explanation, Indic-language interfaces, educational prototypes, and research on structured literary interpretation. The companion playground exposes decoding controls and displays the three intended commentary layers separately.
Limitations and responsible use
The model can produce fluent but incorrect translations, grammatical analyses, source attributions, or philosophical context. It should not be treated as an authoritative Sanskrit scholar, a substitute for a critical edition, or a sole source for religious, historical, or educational claims. Review outputs against the original text and qualified references. The training corpus contains source explanations from the upstream Vāgartha dataset; retain its CC-BY-4.0 attribution when redistributing derived material.
Quick start
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "kshitijthakkar/shlokartha"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id, trust_remote_code=True, dtype="auto"
)
messages = [{
"role": "user",
"content": (
"Explain this Sanskrit verse with exactly these headings: "
"**Pada Artha**, **Anvaya**, and **Bhavartha**.\n\n"
"कर्मण्येवाधिकारस्ते मा फलेषु कदाचन।"
),
}]
inputs = tokenizer.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
License and attribution
The dataset used for fine-tuning is derived from sarvamai/vagartha and is
distributed under CC-BY-4.0 with upstream attribution requirements. Consult
the base checkpoint's terms for model redistribution and derivative-use
conditions.
- Downloads last month
- 240
