Repository
- Model repo:
adivaanihf/sarvam-bhili-to-marathi-lora
- Direction: Bhili → Marathi
- Published checkpoint:
checkpoint-17907 / epoch 3.0
- Adapter format: PEFT LoRA
- Base model:
sarvamai/sarvam-translate
- Base revision used for training:
37da6e80728634b661c3cc3ee2a3d9fa33ae9150
- Starting adapter:
ai4bharat/bhili-translate-bhb-mar
- Starting adapter revision:
435274ce4f40efc61dd1b355331f8edfeb007252
Architecture
- Foundation model:
sarvamai/sarvam-translate
- Fine-tuning method: LoRA / PEFT
- Task type in adapter config:
CAUSAL_LM
- LoRA rank
r: 32
- LoRA alpha: 64
- LoRA dropout: 0.05
- Target modules:
q_proj, k_proj, v_proj, o_proj
gate_proj, up_proj, down_proj
fc1, fc2, out_proj
- Precision: bf16 training
- Attention implementation: SDPA
Training setup
Training used the source code included in this repository under source/.
- Source column:
Bhili
- Target column:
Marathi
- Validation ratio: 0.10
- Test ratio: 0.10
- Max sequence length: 512
- Epochs: 3
- Learning rate: 2e-4
- Weight decay: 0.01
- Warmup ratio: 0.05
- Train batch size per device: 8
- Eval batch size per device: 8
- Gradient accumulation steps: 4
- Optimizer:
adamw_torch_fused
Training metrics
These are training-run metrics from trainer_state.json; they are not a final human evaluation.
- Final checkpoint:
checkpoint-17907
- Final epoch: 3.0
- Final global step: 17907
- Final train loss: 1.717849
- Final eval loss at epoch 3: 2.048365
- Best eval loss during training: 1.936430
- Best checkpoint by eval loss:
checkpoint-11938 / epoch 2.0
Important caveat: the training job entered a long/silent post-training evaluation/export stage after the above metrics. The adapter files here come from the completed latest checkpoint, and manual downstream evaluation is recommended before production use.
Files and artifacts
Main loadable adapter files at repo root:
adapter_model.safetensors — LoRA adapter weights
adapter_config.json — PEFT adapter configuration
tokenizer.json, tokenizer_config.json, special_tokens_map.json, chat_template.jinja — tokenizer/chat assets copied from the checkpoint
trainer_state.json — Hugging Face Trainer state and training logs
training_args.bin, scheduler.pt, rng_state.pth — training-state artifacts retained for provenance/resume diagnostics
Additional files:
optimizer.pt is intentionally not included to keep the model repo smaller; this repo is intended primarily for inference/evaluation from the adapter, not optimizer-level continuation.
How to install
pip install -U transformers peft accelerate torch sentencepiece safetensors
Depending on your environment, you may also need any custom dependencies required by sarvamai/sarvam-translate.
How to load the adapter
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
repo_id = "adivaanihf/sarvam-bhili-to-marathi-lora"
base_model = "sarvamai/sarvam-translate"
base_revision = "37da6e80728634b661c3cc3ee2a3d9fa33ae9150"
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=False)
base = AutoModelForCausalLM.from_pretrained(
base_model,
revision=base_revision,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=False,
)
model = PeftModel.from_pretrained(base, repo_id)
model.eval()
Simple inference example
The training code formats translation prompts internally; for best reproducibility, inspect source/src and use the same prompt builder. A minimal direct example is:
text = "YOUR_BHILI_TEXT_HERE"
prompt = f"Translate from Bhili to Marathi: {text}"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=256,
num_beams=4,
do_sample=False,
)
print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
For exact project-style usage, install the source package from source/ and use the included CLI/modules.
Using the included source code
git clone https://huggingface.co/adivaanihf/sarvam-bhili-to-marathi-lora
cd adivaanihf/sarvam-bhili-to-marathi-lora/source
pip install -e .
The source tree contains:
configs/ — training configs
src/ — data loading, prompting, modeling, training, evaluation, inference, and pipeline code
tests/ — unit tests used during development
run_training.sh / validate_data.sh — helper scripts
Limitations
- This model has not yet been manually evaluated by a human reviewer.
- Loss values are automatic training/eval losses, not BLEU/chrF/COMET or native-speaker quality scores.
- The final export/merge step was skipped because the job hung during post-training evaluation/export.
- Use the adapter with the pinned base revision for maximum reproducibility.
- Low-resource translation quality can vary strongly by domain, spelling, script normalization, and sentence style.
Citation / provenance
If you use this adapter, cite:
- Base model:
sarvamai/sarvam-translate
- Starting adapter:
ai4bharat/bhili-translate-bhb-mar
- This continued fine-tuned adapter:
adivaanihf/sarvam-bhili-to-marathi-lora
Intended use
Research, evaluation, and downstream low-resource MT experimentation for Bhili↔Marathi translation. Manual evaluation is recommended before using outputs in user-facing or high-stakes settings.