Instructions to use buddhist-nlp/gemma-2-mitra-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use buddhist-nlp/gemma-2-mitra-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="buddhist-nlp/gemma-2-mitra-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("buddhist-nlp/gemma-2-mitra-chat") model = AutoModelForCausalLM.from_pretrained("buddhist-nlp/gemma-2-mitra-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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use buddhist-nlp/gemma-2-mitra-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "buddhist-nlp/gemma-2-mitra-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": "buddhist-nlp/gemma-2-mitra-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/buddhist-nlp/gemma-2-mitra-chat
- SGLang
How to use buddhist-nlp/gemma-2-mitra-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 "buddhist-nlp/gemma-2-mitra-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": "buddhist-nlp/gemma-2-mitra-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 "buddhist-nlp/gemma-2-mitra-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": "buddhist-nlp/gemma-2-mitra-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use buddhist-nlp/gemma-2-mitra-chat with Docker Model Runner:
docker model run hf.co/buddhist-nlp/gemma-2-mitra-chat
gemma-2-mitra-chat
A multi-turn chat model for Buddhist studies from the Dharmamitra project: closed-book Buddhism Q&A plus a translation/refinement assistant for classical languages (Sanskrit, Tibetan, Buddhist Chinese, Pāli), speaking the standard gemma-2 chat protocol — it works out of the box with Ollama / llama.cpp multi-turn templates.
Built by full-parameter SFT of
buddhist-nlp/gemma2-mitra-base
(9.5B, Buddhist-domain continued pretraining) on ~10k examples: ~5k
closed-book Buddhism Q&A (mined open-book, references removed so the
knowledge is distilled into the weights) and ~5k translation/refine tasks
(zh/sa/bo/pi, half with retrieved reference passages). Completion-only loss
over full chat histories; EOS is <end_of_turn>, so turns close correctly in
stock chat runtimes.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("buddhist-nlp/gemma-2-mitra-chat")
model = AutoModelForCausalLM.from_pretrained(
"buddhist-nlp/gemma-2-mitra-chat", dtype=torch.bfloat16, device_map="cuda"
)
messages = [{"role": "user", "content":
"Translate into English: 'di skad bdag gis thos pa dus gcig na"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True,
return_dict=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Tibetan may be given in Wylie transliteration (as in the mitra convention); Sanskrit and Pāli in IAST.
Training details
- Base:
buddhist-nlp/gemma2-mitra-base - Full-parameter SFT (TRL, completion-only loss, gemma-2 chat template), LR 1e-5, effective batch 64, cosine schedule, bf16; best checkpoint at step 220
- Data: combined closed-book Q&A + translation/refinement corpus (~10k multi-turn examples)
Related models
Part of the buddhist-nlp gemma-2 Mitra family; see also the newer
Qwen3.5-based generation:
buddhist-nlp/mitra-qwen35-base,
buddhist-nlp/mitra-qwen35-embedder.
Citation
If you use this model, please cite the Dharmamitra project (https://dharmamitra.org).
- Downloads last month
- 15
Model tree for buddhist-nlp/gemma-2-mitra-chat
Base model
buddhist-nlp/gemma2-mitra-base