Views
No views yet
| Benchmark | chrF | chrF++ | BLEU |
|---|---|---|---|
| gold (human references, article-level, N=500) | 53.37 | 49.49 | 12.93 |
| held-out chunk (in-distribution) | 62.96 | 60.58 | 34.21 |
| held-out sentence (in-distribution) | 62.61 | 60.28 | 35.55 |
Input (dv): އެއީ، މިދިޔަ އަހަރުގެ މި މުއްދަތާ ބަލާއިރު، 7.6 އިންސައްތައިގެ ކުރިއެރުމެއް ކަމަށްވާއިރު، ދުވާލަކަށް 7،778 ފަތުރުވެރިން ރާއްޖެ ޒިޔާރަތްކުރެއެވެ.Output (en): That is a 7.6 percent increase compared to the same period last year; on average, 7,778 tourists visit the Maldives per day.
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5base, adapter = "Qwen/Qwen3-4B", "Neobe/dhivehi-en-qwen3-4b-lora-sentence"
6tok = AutoTokenizer.from_pretrained(adapter)
7model = PeftModel.from_pretrained(
8 AutoModelForCausalLM.from_pretrained(base, torch_dtype=torch.bfloat16, device_map="cuda"),
9 adapter).eval()
10
11src = "ދިވެހިރާއްޖޭގެ ރައީސް މިއަދު ކެބިނެޓާ ބައްދަލުކުރެއްވި އެވެ."
12msgs = [{"role":"user","content":
13 "Translate the following Dhivehi text to English. Output only the translation, "
14 f"no explanations.\n\nDhivehi: {src}\nEnglish:"}]
15prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
16inp = tok(prompt, return_tensors="pt", truncation=True, max_length=3072).to("cuda")
17out = model.generate(**inp, max_new_tokens=512, num_beams=1, repetition_penalty=1.15, no_repeat_ngram_size=3, do_sample=False)
18print(tok.decode(out[0][inp["input_ids"].shape[1]:], skip_special_tokens=True))~9–10 GB VRAM (bf16). Qwen tokenizes Thaana at ~1.8 tokens/char — don't over-truncate the input.
Qwen/Qwen3-4B; LoRA r=16, α=32, targets q/k/v/o+gate/up/down; bf16; adamw_torch LR 2e-4 cosine; max_length 1536; 1 epoch; effective batch ~32; gradient checkpointing.1@misc{neobe_dhivehi_en_qwen3_4b_lora_sentence_2026,
2 title = {Qwen3-4B Dhivehi→English (sentence-level)},
3 author = {Neobe},
4 year = {2026},
5 howpublished = {\url{https://huggingface.co/Neobe/dhivehi-en-qwen3-4b-lora-sentence}}
6}