Downloads · 30 days
6
16% of all-time downloads
AventIQ-AI/English-To-French
English-To-French is a machine learning model from AventIQ-AI. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This demonstrates training, quantization, and inference of a text translation model from English to French using Hugging Face Transformers on CUDA-enabled devices.
Downloads · 30 days
6
16% of all-time downloads
All-time downloads
38
Public
Parameters
74.7M
1.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors149 MB · 98%
From the Hugging Face model README
This demonstrates training, quantization, and inference of a text translation model from English to French using Hugging Face Transformers on CUDA-enabled devices.
Helsinki-NLP/opus-mt-tc-big-en-frFrancophonIA/english_frenchInstall all required Python packages:
pip install torch transformers datasets evaluate sentencepiece
from datasets import load_dataset
dataset = load_dataset("FrancophonIA/english_french")
dataset["train"] = dataset["train"].shuffle(seed=42).select(range(60000))
Training is done using Seq2SeqTrainer with the following configuration:
batch_size: 8
epochs: 3
fp16: Mixed precision enabled
save_strategy: Disabled to reduce I/O
report_to: Disabled (no Weights & Biases)
We apply dynamic quantization on the trained model to reduce size and enable CPU inference:
quantized_model = torch.quantization.quantize_dynamic(
model.cpu(), {torch.nn.Linear}, dtype=torch.qint8
)
from evaluate import load
metric = load("sacrebleu")
score = metric.compute(predictions=predictions, references=references)
print(f"BLEU Score: {score['score']}")