Instructions to use ninadp/marathi-mitra-phi3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ninadp/marathi-mitra-phi3 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-3-mini-4k-instruct") model = PeftModel.from_pretrained(base_model, "ninadp/marathi-mitra-phi3") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,91 +10,18 @@ tags:
|
|
| 10 |
- peft
|
| 11 |
- fine-tuned
|
| 12 |
- education
|
| 13 |
-
- kids
|
| 14 |
license: mit
|
| 15 |
---
|
| 16 |
|
| 17 |
-
# 🌸 Marathi Mitra —
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
## Model Details
|
| 23 |
|
| 24 |
| Property | Value |
|
| 25 |
|----------|-------|
|
| 26 |
-
|
|
| 27 |
-
|
|
| 28 |
-
|
|
| 29 |
-
| Training Examples | 30 Marathi vocabulary items |
|
| 30 |
-
| Best Experiment | exp4_lr2e4_epochs25_r32 |
|
| 31 |
-
| Format Score | 36.4% |
|
| 32 |
-
| Training Hardware | Google Colab T4 GPU |
|
| 33 |
-
|
| 34 |
-
## What It Does
|
| 35 |
-
|
| 36 |
-
Given an English word, generates a Marathi lesson with:
|
| 37 |
-
- Marathi word in Devanagari script
|
| 38 |
-
- Pronunciation guide
|
| 39 |
-
- Example sentence
|
| 40 |
-
- Fun fact for kids
|
| 41 |
-
|
| 42 |
-
## How to Use
|
| 43 |
-
|
| 44 |
-
```python
|
| 45 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 46 |
-
from peft import PeftModel
|
| 47 |
-
import torch
|
| 48 |
-
|
| 49 |
-
base = AutoModelForCausalLM.from_pretrained(
|
| 50 |
-
"microsoft/Phi-3-mini-4k-instruct",
|
| 51 |
-
torch_dtype=torch.float16,
|
| 52 |
-
trust_remote_code=True,
|
| 53 |
-
)
|
| 54 |
-
model = PeftModel.from_pretrained(base, "ninadp/marathi-mitra-phi3")
|
| 55 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 56 |
-
"microsoft/Phi-3-mini-4k-instruct",
|
| 57 |
-
trust_remote_code=True,
|
| 58 |
-
)
|
| 59 |
-
|
| 60 |
-
prompt = """### Instruction:
|
| 61 |
-
You are Marathi Mitra, a friendly Marathi teacher for kids.
|
| 62 |
-
|
| 63 |
-
### Input:
|
| 64 |
-
Teach me the Marathi word for: butterfly
|
| 65 |
-
|
| 66 |
-
### Response:
|
| 67 |
-
"""
|
| 68 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
| 69 |
-
output = model.generate(**inputs, max_new_tokens=150)
|
| 70 |
-
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
## Training Details
|
| 74 |
-
|
| 75 |
-
Fine-tuned using Supervised Fine-Tuning (SFT) with QLoRA
|
| 76 |
-
on 30 Marathi vocabulary examples across 4 hyperparameter
|
| 77 |
-
experiments.
|
| 78 |
-
|
| 79 |
-
| Experiment | LR | Epochs | Loss | Score |
|
| 80 |
-
|------------|-----|--------|------|-------|
|
| 81 |
-
| Baseline | N/A | N/A | N/A | 11.2% |
|
| 82 |
-
| Exp1 | 2e-4 | 5 | 1.29 | 12.8% |
|
| 83 |
-
| Exp2 | 2e-4 | 25 | 0.20 | 28.8% |
|
| 84 |
-
| Exp3 | 1e-4 | 25 | 0.37 | 16.0% |
|
| 85 |
-
| Exp4 | 2e-4 | 25 | 0.22 | 36.4% ✅ |
|
| 86 |
-
|
| 87 |
-
## Limitations
|
| 88 |
-
|
| 89 |
-
- Trained on only 30 examples — vocabulary coverage is limited
|
| 90 |
-
- May generate incorrect Marathi words for unseen vocabulary
|
| 91 |
-
- Format learned well; accuracy improves with more data
|
| 92 |
-
- Retraining with 200+ examples planned
|
| 93 |
-
|
| 94 |
-
## Live Demo
|
| 95 |
-
|
| 96 |
-
[🚀 Try it on HF Spaces](https://huggingface.co/spaces/ninadp/marathi-mitra)
|
| 97 |
-
|
| 98 |
-
## GitHub
|
| 99 |
|
| 100 |
-
[
|
|
|
|
| 10 |
- peft
|
| 11 |
- fine-tuned
|
| 12 |
- education
|
|
|
|
| 13 |
license: mit
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# 🌸 Marathi Mitra — v1
|
| 17 |
|
| 18 |
+
First fine-tuned version trained on 30 examples.
|
| 19 |
+
Superseded by v2 (250 examples, 89.4% overall).
|
|
|
|
|
|
|
| 20 |
|
| 21 |
| Property | Value |
|
| 22 |
|----------|-------|
|
| 23 |
+
| Training Examples | 30 |
|
| 24 |
+
| Overall Score | 31.0% |
|
| 25 |
+
| Recommended Version | [v2](https://huggingface.co/ninadp/marathi-mitra-phi3-v2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
[View full project →](https://github.com/ninadparab/marathi-mitra)
|