Downloads · 30 days
10
16% of all-time downloads
Ripefog/lmt-60-1.7b-en-vi
lmt-60-1.7b-en-vi is a translation model from Ripefog. Use it when you need text moved from one language to another. The card lists the license as apache-2.0.
This is a merged model combining the NiuTrans LMT-60-1.7B base model with fine-tuned LoRA adapters for English-Vietnamese translation.
Downloads · 30 days
10
16% of all-time downloads
All-time downloads
63
Public
Parameters
1.7B
3.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors3.4 GB · 100%
From the Hugging Face model README
This is a merged model combining the NiuTrans LMT-60-1.7B base model with fine-tuned LoRA adapters for English-Vietnamese translation.
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)
messages = [
{"role": "user", "content": 'Dịch câu sau sang tiếng Việt: "Your English text here"'},
]
messages = [
{"role": "user", "content": 'Translate the following sentence into English: "Văn bản tiếng Việt của bạn ở đây"'},
]
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.
Apache 2.0