π§ MarianMT-Text-Translation-AI-Model-"en-fr"
A sequence-to-sequence translation model fine-tuned on EnglishβFrench sentence pairs. This model translates English text into French and is built using the Hugging Face MarianMTModel
. Itβs ideal for general-purpose translation, educational use, and light regulatory or formal communication tasks between English and French.
β¨ Model Highlights
- π Based on
Helsinki-NLP/opus-mt-en-fr
- π Fine-tuned on a cleaned parallel corpus of English-French sentence pairs
- β‘ Translates from English β French
- π§ Built using Hugging Face Transformers and PyTorch
π§ Intended Uses
- β Translating English feedback, emails, or documents into French
- β Cross-lingual support for customer service or regulatory communication
- β Educational platforms and language learning
π« Limitations
- β Not suitable for informal slang or code-mixed inputs
- π Inputs longer than 128 tokens will be truncated
- π€ May produce less accurate translations for highly specialized or domain-specific language
- β οΈ Not intended for legal, medical, or safety-critical translations without expert review
ποΈββοΈ Training Details
Attribute | Value |
---|---|
Base Model | Helsinki-NLP/opus-mt-en-fr |
Dataset | Parallel English-French corpus |
Task Type | Translation |
Max Token Length | 128 |
Epochs | 3 |
Batch Size | 16 |
Optimizer | AdamW |
Loss Function | CrossEntropyLoss |
Framework | PyTorch + Transformers |
Hardware | CUDA-enabled GPU |
π Evaluation Metrics
Metric | Score |
---|---|
BLEU Score | 27.82 |
π Output Details
- Input: English text string
- Output: Translated French text string
π Usage
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
model_name = "AventIQ-AI/MarianMT-Text-Translation-AI-Model-en-fr"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
model.eval()
def translate(text):
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
finetuned_model.to(device)
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True).to(device)
outputs = finetuned_model.generate(**inputs)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Example
print(translate("Hello, how are you?"))
π Repository Structure
finetuned-model/
βββ config.json β
Model architecture & config
βββ pytorch_model.bin β
Model weights
βββ tokenizer_config.json β
Tokenizer settings
βββ tokenizer.json β
Tokenizer vocabulary (JSON format)
βββ source.spm β
SentencePiece model for source language
βββ target.spm β
SentencePiece model for target language
βββ special_tokens_map.json β
Special tokens mapping
βββ generation_config.json β
(Optional) Generation defaults
βββ README.md β
Model card
π€ Contributing
Contributions are welcome! Feel free to open an issue or pull request to improve the model, training scripts, or documentation.