LMT Translation Model (EN ↔ VI)
This is a merged model combining the NiuTrans LMT-60-1.7B base model with fine-tuned LoRA adapters for English-Vietnamese translation.
Model Details
- Base Model: NiuTrans/LMT-60-1.7B
- Adapter Path: ./model_lmt/checkpoint-20000
- Task: Bidirectional Translation (English ↔ Vietnamese)
- Model Type: Causal Language Model (Qwen3) with merged LoRA weights
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"Ripefog/lmt-60-1.7b-en-vi",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained("Ripefog/lmt-60-1.7b-en-vi", trust_remote_code=True)
# Translate English to Vietnamese
messages = [
{"role": "user", "content": 'Dịch câu sau sang tiếng Việt: "Hello, how are you?"'},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
with torch.no_grad():
outputs = model.generate(
inputs,
max_new_tokens=256,
num_beams=5,
do_sample=False,
)
response = tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)
print(response)
Translation Directions
English to Vietnamese (EN → VI)
messages = [
{"role": "user", "content": 'Dịch câu sau sang tiếng Việt: "Your English text here"'},
]
Vietnamese to English (VI → EN)
messages = [
{"role": "user", "content": 'Translate the following sentence into English: "Văn bản tiếng Việt của bạn ở đây"'},
]
Training Details
This model was fine-tuned using LoRA (Low-Rank Adaptation) on translation datasets. The LoRA adapters have been merged with the base model for easier deployment and faster inference.
License
Apache 2.0
- Downloads last month
- 8