Gemma-2 Mitra (2024)
Collection
The first-generation Dharmamitra model family (trained August 2024) on gemma-2: base, instruct, embedder — plus the 2026 chat SFT. • 7 items • Updated
How to use buddhist-nlp/gemma-2-mitra-it with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="buddhist-nlp/gemma-2-mitra-it") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("buddhist-nlp/gemma-2-mitra-it")
model = AutoModelForCausalLM.from_pretrained("buddhist-nlp/gemma-2-mitra-it", device_map="auto")How to use buddhist-nlp/gemma-2-mitra-it with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "buddhist-nlp/gemma-2-mitra-it"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "buddhist-nlp/gemma-2-mitra-it",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/buddhist-nlp/gemma-2-mitra-it
How to use buddhist-nlp/gemma-2-mitra-it with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "buddhist-nlp/gemma-2-mitra-it" \
--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": "buddhist-nlp/gemma-2-mitra-it",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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-it" \
--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": "buddhist-nlp/gemma-2-mitra-it",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use buddhist-nlp/gemma-2-mitra-it with Docker Model Runner:
docker model run hf.co/buddhist-nlp/gemma-2-mitra-it
This is based on gemma2-mitra-base and finetuned on Translation instructions. The template for prompting the model is this:
Please translate into <target_language>: <input_sentence> 🔽 Translation::
Line breaks in this model should be replaced with the '🔽' character before running the generation. '#' is used as a stop token.
For details on how to run this please see the gemma2-9b repository: https://huggingface.co/google/gemma-2-9b