envit5 translation
VietAIIntroduction
ENVIT5-TRANSLATION is a state-of-the-art translation model developed by VietAI for English-Vietnamese and Vietnamese-English translation tasks. It uses the T5 architecture and has been trained on datasets like MTet and PhoMT, providing a robust solution for text-to-text generation.
Architecture
The model leverages the T5 (Text-to-Text Transfer Transformer) architecture, known for its versatility in handling various NLP tasks by converting them into a text-to-text format. ENVIT5-TRANSLATION is built using the Transformers library and supports multiple frameworks, including PyTorch and TensorFlow.
Training
The training process involved using the MTet and PhoMT datasets, focusing on multi-domain translation to enhance the model's capability to handle diverse text types. The model has achieved state-of-the-art results in machine translation benchmarks.
Guide: Running Locally
-
Install Required Libraries: Ensure you have the
transformers
library installed. You can install it using pip:pip install transformers
-
Download the Model: Use the following Python code to load the model and tokenizer:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM model_name = "VietAI/envit5-translation" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
-
Prepare Input Text: Define the input texts for translation:
inputs = [ "vi: Your Vietnamese text here.", "en: Your English text here." ]
-
Run Inference: Perform translation using the model:
outputs = model.generate(tokenizer(inputs, return_tensors="pt", padding=True).input_ids.to('cuda'), max_length=512) print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
-
Suggested Cloud GPUs: To run the model efficiently, consider using cloud GPU services such as AWS EC2 with GPU instances, Google Cloud Platform, or Azure's GPU Virtual Machines.
License
The model is licensed under OpenRAIL, allowing for open research and commercial use with certain restrictions. Please refer to the license terms for more details.