YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

English to French Translation AI Model

This demonstrates training, quantization, and inference of a text translation model from English to French using Hugging Face Transformers on CUDA-enabled devices.

🧠 Model Overview

  • Base Model: Helsinki-NLP/opus-mt-tc-big-en-fr
  • Task: English to French text translation
  • Dataset: FrancophonIA/english_french
  • Framework: Hugging Face Transformers & Datasets
  • Accelerator: CUDA (GPU)

πŸ“¦ Dependencies

Install all required Python packages:

 pip install torch transformers datasets evaluate sentencepiece

Load Dataset

 from datasets import load_dataset
 dataset = load_dataset("FrancophonIA/english_french")
 dataset["train"] = dataset["train"].shuffle(seed=42).select(range(60000))

βš™οΈ Training Configuration

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)

🧊 Model Quantization

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
)

πŸ“ Evaluation

from evaluate import load

metric = load("sacrebleu")
score = metric.compute(predictions=predictions, references=references)
print(f"BLEU Score: {score['score']}")
Downloads last month
3
Safetensors
Model size
74.7M params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support