Text Generation
Transformers
Safetensors
Malay
Brunei
qwen3
translation
brunei-malay
malay
medical
lora
fine-tuned
conversational
text-generation-inference
Instructions to use ningpy/brunei-malayu-translator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ningpy/brunei-malayu-translator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ningpy/brunei-malayu-translator") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ningpy/brunei-malayu-translator") model = AutoModelForCausalLM.from_pretrained("ningpy/brunei-malayu-translator", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ningpy/brunei-malayu-translator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ningpy/brunei-malayu-translator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ningpy/brunei-malayu-translator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ningpy/brunei-malayu-translator
- SGLang
How to use ningpy/brunei-malayu-translator with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ningpy/brunei-malayu-translator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ningpy/brunei-malayu-translator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ningpy/brunei-malayu-translator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ningpy/brunei-malayu-translator", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ningpy/brunei-malayu-translator with Docker Model Runner:
docker model run hf.co/ningpy/brunei-malayu-translator
Brunei Malay -> Standard Malay Translator v3 (medical-enhanced)
Fine-tuned from Qwen3-0.6B on 29.8k Brunei-Malay <-> Standard-Malay sentence pairs. v3 adds ~1,660 medical/clinical dialect terms curated from a Brunei health-domain wordlist.
Evaluation (held-out test set, 1,623 examples)
| tag | BLEU | chrF++ | n |
|---|---|---|---|
| overall | 60.57 | 79.53 | 1,623 |
| sent_adversarial | 77.75 | 85.76 | 348 |
| sent_direct | 54.21 | 76.39 | 1,093 |
| sent_medical ✨ | 51.27 | 89.14 | 166 |
| word_direct | 0.00 | 42.47 | 15 |
Improvements over v2: overall BLEU +2.7, adversarial BLEU +6.5, medical chrF++ 89.14 (new).
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = 'ningpy/brunei-malayu-translator'
tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map='auto', trust_remote_code=True).eval()
msgs = [
{'role': 'system', 'content': 'Translate the following Brunei Malay text into Standard Malay.'},
{'role': 'user', 'content': 'Ku ada basal bah, sudah dua hari.'},
]
text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tok(text, return_tensors='pt').to(model.device)
out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
# -> 'Saya ada selesema, sudah dua hari.'
Training
- Base: Qwen/Qwen3-0.6B (Instruct)
- Method: LoRA rank 32, alpha 64, targets q/k/v/o/gate/up/down (20.2M trainable, 3.4%)
- Data: 29,789 train (with sent_medical upsampled 3x), 1,308 val, 1,623 test
- 6 epochs, lr 2e-4 cosine, effective batch 16, fp16, 1x V100 32GB, ~1h 55min
- Final eval_loss: 0.2698
Data sources
- General: brunei_dict (5,352-word bilingual dictionary)
- Medical: bmb-dialect-medical-terms-500-v1.xlsx (500 curated medical/clinical terms with variants)
- Synthesis: OpenAI gpt-4o-mini for sentence-level expansion
- QA: PRPM (prpm.dbp.gov.my) cross-check, LLM-as-judge (gpt-4o)
Limitations
- Test set drawn from same synthesis distribution as training; real-world BLEU may be lower
- Rare Brunei words (appearing < 3 times in training) may be mistranslated
- No SM -> BM reverse direction
- Downloads last month
- 472