Views
No views yet
| 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 |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = 'ningpy/brunei-malayu-translator'
5tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
6model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map='auto', trust_remote_code=True).eval()
7
8msgs = [
9 {'role': 'system', 'content': 'Translate the following Brunei Malay text into Standard Malay.'},
10 {'role': 'user', 'content': 'Ku ada basal bah, sudah dua hari.'},
11]
12text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True, enable_thinking=False)
13inputs = tok(text, return_tensors='pt').to(model.device)
14out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
15print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
16# -> 'Saya ada selesema, sudah dua hari.'