Instructions to use shaikhsalman/ZabaanAI-Urdu-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shaikhsalman/ZabaanAI-Urdu-3B with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("shaikhsalman/ZabaanAI-Urdu-3B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Training in progress, step 100
Browse files- README.md +40 -62
- adapter_config.json +5 -5
- adapter_model.safetensors +1 -1
- training_args.bin +2 -2
README.md
CHANGED
|
@@ -1,81 +1,59 @@
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-3B-Instruct
|
| 3 |
-
library_name:
|
| 4 |
-
|
| 5 |
-
- shaikhsalman/ZabaanAI-Urdu-3B-data
|
| 6 |
-
language:
|
| 7 |
-
- ur
|
| 8 |
-
pipeline_tag: text-generation
|
| 9 |
tags:
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
-
-
|
| 13 |
-
-
|
| 14 |
-
|
| 15 |
---
|
| 16 |
|
| 17 |
-
# ZabaanAI-Urdu-3B
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
##
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
- **Training:** 2 epochs (~7,286 steps), LR 1e-4 cosine, **assistant-only loss** (trains only on assistant turns), eff. batch 16.
|
| 32 |
-
- **Hardware:** free Kaggle/Colab T4 (fp16, no FlashAttention). ~3h.
|
| 33 |
|
| 34 |
-
##
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 39 |
-
from peft import PeftModel
|
| 40 |
|
| 41 |
-
tok = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-3B-Instruct")
|
| 42 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 43 |
-
"Qwen/Qwen2.5-3B-Instruct",
|
| 44 |
-
quantization_config=BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.float16),
|
| 45 |
-
device_map="auto")
|
| 46 |
-
model = PeftModel.from_pretrained(model, "shaikhsalman/ZabaanAI-Urdu-3B")
|
| 47 |
-
model.eval()
|
| 48 |
|
| 49 |
-
|
| 50 |
-
{"role": "system", "content": "آپ ایک ذہین اردو AI اسسٹنٹ ہیں۔"},
|
| 51 |
-
{"role": "user", "content": "پاکستان کا دارالحکومت کیا ہے؟"},
|
| 52 |
-
]
|
| 53 |
-
text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
|
| 54 |
-
inputs = tok(text, return_tensors="pt").to(model.device)
|
| 55 |
-
out = model.generate(**inputs, max_new_tokens=200, do_sample=True,
|
| 56 |
-
temperature=0.5, top_p=0.9, repetition_penalty=1.2)
|
| 57 |
-
print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
|
| 58 |
-
```
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
!rm -f train_colab_gpu.py
|
| 68 |
-
!wget -q https://huggingface.co/shaikhsalman/ZabaanAI-Urdu-3B/resolve/main/train_colab_gpu.py
|
| 69 |
-
!python train_colab_gpu.py
|
| 70 |
-
```
|
| 71 |
|
| 72 |
-
|
| 73 |
-
Healthy training loss is **0.8–1.5**; if loss dives below ~0.4 it is memorizing (the v3 failure mode).
|
| 74 |
|
| 75 |
-
<!-- ml-intern-provenance -->
|
| 76 |
-
## Generated by ML Intern
|
| 77 |
|
| 78 |
-
This model repository was generated by [ML Intern](https://github.com/huggingface/ml-intern), an agent for machine learning research and development on the Hugging Face Hub.
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-3B-Instruct
|
| 3 |
+
library_name: transformers
|
| 4 |
+
model_name: ZabaanAI-Urdu-3B
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
tags:
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
- trackio:https://shaikhsalman-ml-intern-zabaanai.hf.space?project=zabaanai-urdu-3b&runs=sft_qwen2.5-3b_urdu_v4-clean-urdu-58k_lr0.0001&sidebar=collapsed
|
| 8 |
+
- trl
|
| 9 |
+
- sft
|
| 10 |
+
licence: license
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Model Card for ZabaanAI-Urdu-3B
|
| 14 |
|
| 15 |
+
This model is a fine-tuned version of [Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct).
|
| 16 |
+
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 17 |
|
| 18 |
+
## Quick start
|
| 19 |
|
| 20 |
+
```python
|
| 21 |
+
from transformers import pipeline
|
| 22 |
|
| 23 |
+
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
|
| 24 |
+
generator = pipeline("text-generation", model="shaikhsalman/ZabaanAI-Urdu-3B", device="cuda")
|
| 25 |
+
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
| 26 |
+
print(output["generated_text"])
|
| 27 |
+
```
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
## Training procedure
|
| 30 |
|
| 31 |
+
|
| 32 |
+
[<img src="https://raw.githubusercontent.com/gradio-app/trackio/refs/heads/main/trackio/assets/badge.png" alt="Visualize in Trackio" title="Visualize in Trackio" width="150" height="24"/>](https://shaikhsalman-ml-intern-zabaanai.hf.space?project=zabaanai-urdu-3b&runs=sft_qwen2.5-3b_urdu_v4-clean-urdu-58k_lr0.0001&sidebar=collapsed)
|
|
|
|
|
|
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
This model was trained with SFT.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
### Framework versions
|
| 38 |
|
| 39 |
+
- TRL: 1.5.1
|
| 40 |
+
- Transformers: 5.0.0
|
| 41 |
+
- Pytorch: 2.10.0+cu128
|
| 42 |
+
- Datasets: 4.8.3
|
| 43 |
+
- Tokenizers: 0.22.2
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
## Citations
|
|
|
|
| 46 |
|
|
|
|
|
|
|
| 47 |
|
|
|
|
| 48 |
|
| 49 |
+
Cite TRL as:
|
| 50 |
+
|
| 51 |
+
```bibtex
|
| 52 |
+
@software{vonwerra2020trl,
|
| 53 |
+
title = {{TRL: Transformers Reinforcement Learning}},
|
| 54 |
+
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
|
| 55 |
+
license = {Apache-2.0},
|
| 56 |
+
url = {https://github.com/huggingface/trl},
|
| 57 |
+
year = {2020}
|
| 58 |
+
}
|
| 59 |
+
```
|
adapter_config.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
"loftq_config": {},
|
| 19 |
"lora_alpha": 32,
|
| 20 |
"lora_bias": false,
|
| 21 |
-
"lora_dropout": 0.
|
| 22 |
"megatron_config": null,
|
| 23 |
"megatron_core": "megatron.core",
|
| 24 |
"modules_to_save": null,
|
|
@@ -29,13 +29,13 @@
|
|
| 29 |
"rank_pattern": {},
|
| 30 |
"revision": null,
|
| 31 |
"target_modules": [
|
| 32 |
-
"
|
| 33 |
-
"q_proj",
|
| 34 |
-
"o_proj",
|
| 35 |
"up_proj",
|
| 36 |
"v_proj",
|
| 37 |
"down_proj",
|
| 38 |
-
"
|
|
|
|
|
|
|
| 39 |
],
|
| 40 |
"target_parameters": null,
|
| 41 |
"task_type": "CAUSAL_LM",
|
|
|
|
| 18 |
"loftq_config": {},
|
| 19 |
"lora_alpha": 32,
|
| 20 |
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.05,
|
| 22 |
"megatron_config": null,
|
| 23 |
"megatron_core": "megatron.core",
|
| 24 |
"modules_to_save": null,
|
|
|
|
| 29 |
"rank_pattern": {},
|
| 30 |
"revision": null,
|
| 31 |
"target_modules": [
|
| 32 |
+
"gate_proj",
|
|
|
|
|
|
|
| 33 |
"up_proj",
|
| 34 |
"v_proj",
|
| 35 |
"down_proj",
|
| 36 |
+
"o_proj",
|
| 37 |
+
"q_proj",
|
| 38 |
+
"k_proj"
|
| 39 |
],
|
| 40 |
"target_parameters": null,
|
| 41 |
"task_type": "CAUSAL_LM",
|
adapter_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 59934640
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8fe5e187efa9dc0dc7f4f8df3d1b494124f27e2e2e5c0a77d78b326998805837
|
| 3 |
size 59934640
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:236ec4e2a9299c9ce34635495e93ae3121fdd255273453f8782522f42956bc08
|
| 3 |
+
size 5777
|