Text-to-Text Transfer Transformer (T5) Quantized Model for Text Translation
This repository hosts a quantized version of the T5 model, fine-tuned for text translation tasks. The model has been optimized for efficient deployment while maintaining high accuracy, making it suitable for resource-constrained environments.
Model Details
Model Architecture:
T5
Task:
Text Translation
Dataset:
Hugging Face's
opus100
Quantization:
Float16
Supporting Languages:
English to French
Fine-tuning Framework:
Hugging Face Transformers
Usage
Installation
pip install transformers torch
Loading the Model
from transformers import T5Tokenizer, T5ForConditionalGeneration
import torch
device = "cuda"if torch.cuda.is_available() else"cpu"
model_name = "AventIQ-AI/t5-text-translator"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name).to(device)
deftranslate_text(model, text, src_lang, tgt_lang):
input_text = f"translate {src_lang} to {tgt_lang}: {text}"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
# Generate translation
output_ids = model.generate(input_ids, max_length=50)
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
# Test Example
test_sentences = {"en-fr": "Hello, what is your name?"}
for lang_pair, sentence in test_sentences.items():
src, tgt = lang_pair.split("-")
print(f"{src} → {tgt}: {translate_text(model, sentence, src, tgt)}")
📊 ROUGE Evaluation Results
After fine-tuning the T5-Small model for text translation, we obtained the following ROUGE scores:
Metric
Score
Meaning
ROUGE-1
0.4673 (~46%)
Measures overlap of unigrams (single words) between the reference and generated text.
ROUGE-2
0.2486 (~24%)
Measures overlap of bigrams (two-word phrases), indicating coherence and fluency.
ROUGE-L
0.4595 (~45%)
Measures longest matching word sequences, testing sentence structure preservation.
ROUGE-Lsum
0.4620 (~46%)
Similar to ROUGE-L but optimized for summarization tasks.
Fine-Tuning Details
Dataset
The Hugging Face's
opus100
dataset was used, containing different types of translations of languages.
Training
Number of epochs:
3
Batch size:
8
Evaluation strategy:
epoch
Quantization
Post-training quantization was applied using PyTorch's built-in quantization framework to reduce the model size and improve inference efficiency.
Repository Structure
.
├── model/ # Contains the quantized model files
├── tokenizer_config/ # Tokenizer configuration and vocabulary files
├── model.safetensors/ # Quantized Model
├── README.md # Model documentation
Limitations
The model may not generalize well to domains outside the fine-tuning dataset.
Currently, it only supports English to French translations.
Quantization may result in minor accuracy degradation compared to full-precision models.
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.
Runs of AventIQ-AI t5-text-translator on huggingface.co
6
Total runs
-1
24-hour runs
-1
3-day runs
-3
7-day runs
-7
30-day runs
More Information About t5-text-translator huggingface.co Model
t5-text-translator huggingface.co
t5-text-translator huggingface.co is an AI model on huggingface.co that provides t5-text-translator's model effect (), which can be used instantly with this AventIQ-AI t5-text-translator model. huggingface.co supports a free trial of the t5-text-translator model, and also provides paid use of the t5-text-translator. Support call t5-text-translator model through api, including Node.js, Python, http.
t5-text-translator huggingface.co is an online trial and call api platform, which integrates t5-text-translator's modeling effects, including api services, and provides a free online trial of t5-text-translator, you can try t5-text-translator online for free by clicking the link below.
AventIQ-AI t5-text-translator online free url in huggingface.co:
t5-text-translator is an open source model from GitHub that offers a free installation service, and any user can find t5-text-translator on GitHub to install. At the same time, huggingface.co provides the effect of t5-text-translator install, users can directly use t5-text-translator installed effect in huggingface.co for debugging and trial. It also supports api for free installation.