Downloads · 30 days
9
50% of all-time downloads
spnandpure/lora-marathi
lora-marathi is a text generation model from spnandpure. Use it when you need the model to write or continue text. It is set up for peft.
Microsoft Phi-2 model fine-tuned on 10k English-Marathi text pairs using LoRA.
Downloads · 30 days
9
50% of all-time downloads
All-time downloads
18
Public
Repo size
82 MB
Likes
0
Public
Click a slice to open those files.
.safetensors42 MB · 90%
From the Hugging Face model README
Microsoft Phi-2 model fine-tuned on 10k English-Marathi text pairs using LoRA.
https://huggingface.co/datasets/anujsahani01/English-Marathi
This repo contains LoRA adapter weights trained on a Marathi → English translation dataset. To use this model, load the base model and then apply this LoRA adapter.
!pip install transformers peft accelerate
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "your-base-model-here"
lora_model_id = "spnandpure/lora-marathi"
# Load base model
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
device_map="auto",
)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, lora_model_id)
# Example usage
prompt = "Translate from Marathi to English:\nMarathi: मला भूक लागली आहे.\nEnglish:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))