Views
No views yet
unsloth/Llama-3.2-3B-bnb-4bit, trained jointly on 25k en→ar and 25k en→fa sentence pairs (r=32, alpha=64, all seven projection matrices, one epoch).--chrf-word-order 2, 0–100) on the 971-sentence TICO-19 development split.| Direction | dev |
|---|---|
| en→ar | 28.87 |
| en→fa | 31.44 |
{language} takes the English name of the target language, such as Arabic, Persian, or Dari.Translate the below text from English to {language}. Only output the final translation in {language}; do not include any additional text.
### English text:
{source}
### {language} translation:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5BASE = "unsloth/Llama-3.2-3B-bnb-4bit"
6ADAPTER = "ArashEslam/Llama-3.2-3B-ar-fa-stage3-r32"
7LANGUAGE = "Persian"
8
9PROMPT = (
10 "Translate the below text from English to {language}. Only output the final "
11 "translation in {language}; do not include any additional text.\n\n"
12 "### English text:\n{source}\n\n"
13 "### {language} translation:\n"
14)
15
16tokenizer = AutoTokenizer.from_pretrained(BASE)
17model = AutoModelForCausalLM.from_pretrained(BASE, device_map="auto", torch_dtype=torch.bfloat16)
18model = PeftModel.from_pretrained(model, ADAPTER)
19model.eval()
20
21source = "Wash your hands with soap and water for at least 20 seconds."
22inputs = tokenizer(
23 PROMPT.format(language=LANGUAGE, source=source),
24 return_tensors="pt", truncation=True, max_length=256,
25).to(model.device)
26
27with torch.no_grad():
28 output = model.generate(**inputs, max_new_tokens=128, do_sample=False)
29
30decoded = tokenizer.decode(output[0], skip_special_tokens=True)
31print(decoded.split(f"### {LANGUAGE} translation:")[-1].strip())### {language} translation: marker and keeping the final segment is not optional. For few-shot transfer to an unseen target language, prepend FLORES-200 demonstrations in the same format.1@article{alabdullah2026biomedical,
2 title = {Biomedical Machine Translation for Low-Resource Arabic-Script Languages
3 via Cross-Lingual Transfer and {LoRA} Adapter Merging},
4 author = {Alabdullah, Abdullah and Eslamighayour, Arash and
5 Harbalioglu, Sarp and Han, Lifeng},
6 journal = {arXiv preprint arXiv:2607.22300},
7 year = {2026},
8 url = {https://arxiv.org/abs/2607.22300}
9}