General-ProjectsByIF's picture
Update README.md
e7f9d37 verified
|
Raw
History Blame Contribute Delete
5.8 kB
---
license: apache-2.0
base_model:
- Helsinki-NLP/opus-mt-en-fr
pipeline_tag: translation
---
# Model Card for Model ID
<!-- Provide a quick summary of what the model is/does. -->
This model translates **English into French** fine tuned to Moncton’s choice of French use words.
It was fine-tuned from **Helsinki-NLP/opus-mt-en-fr** using French sentences provided by the City of Moncton (3261 pairs).
The goal is to adapt a general English→French model to regional vocabulary, syntax, and style used in Moncton.
## Model Details
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Developed by:** Projects by IF for the Municipality of Moncton, within the Artificial Intelligence Specialization of the Bloomberg Philanthropies City Data Alliance program
- **Funded by:** Bloomberg Philanthropies
- **Model type:** MarianMT (sequence-to-sequence, encoder–decoder transformer)
- **Language(s) (NLP):** English to Moncton French
- **License:** Apache licence 2.0
- **Finetuned from model:** Helsinki-NLP/opus-mt-en-fr
### Model Sources
<!-- Provide the basic links for the model. -->
- **Demo:** https://huggingface.co/spaces/Projects-by-IF/translation-model-enfr
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Direct Use
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
- Translate English municipal or social media communications into Moncton French.
- Support research on Moncton/Acadian French variation.
### Downstream Use
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
- Fine-tune further for other Acadian French contexts (e.g., conversational, educational).
- Integrate into municipal translation pipelines.
### Out-of-Scope Use
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
- Do not use for legal, medical, or safety-critical translations.
- Not intended as a general English→French translator (model is biased toward Moncton-specific usage).
## Bias, Risks, and Limitations
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
- Training set is small (3261 paragraph pairs), limited to municipal/government style.
- Informal or conversational Moncton French may not be well represented.
- Because references were sometimes inconsistently aligned, automatic scores may underestimate quality.
- Risk of reinforcing stylistic bias toward institutional language rather than everyday Moncton French.
### Recommendations
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
- Treat outputs as drafts for human review, not final translations.
- Be aware of stylistic bias toward municipal communications.
## How to Get Started with the Model
```python
from transformers import MarianMTModel, MarianTokenizer
model_name = "Projects-by-IF/ENFR_custom_translation_v1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
src_text = ["Reminder that vehicles cannot park on any street from December 1 to April 15 between midnight and 7 a.m."]
inputs = tokenizer(src_text, return_tensors="pt", padding=True, truncation=True, max_length=512)
translated = model.generate(**inputs, max_new_tokens = 128, num_beams=1)
output = tokenizer.decode(translated[0], skip_special_tokens=True)
print(output)
```
## Training Details
### Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
Training was done on 3261 French sentences provided by the City of Moncton.
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
#### Preprocessing
The text was cleaned (including removing emojis and symbols) and individual French sentences were isolated. Duplicate entries and single word sentences were also removed.
The French sentences were then translated to English using the Helsinki-NLP/opus-mt-fr-en model. This was done to bypass the need for fully aligned Fr-En sentence pairs. These pairs of translated English sentences, along with their original French sentences from the city of Moncton, are what was used to fine tune the model.
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
Testing was done on 604 French sentences provided by the City of Moncton, along with their corresponding translated English sentences (see above).
#### Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
BERTScore was used to evaluate the similarity between the original sentence provided by the city and the sentence resulting from the translation process.
### Results
On average the evaluation showed a 92.1% similarity on the testing data (as opposed to a 88.7% similarity if using the baseline model Helsinki-NLP/opus-mt-en-fr)
## Model Card Authors
Projects by IF https://www.projectsbyif.com/ for the Municipality of Moncton, within the framework of the Artificial Intelligence Specialization of the Bloomberg Philanthropies City Data Alliance program.
## Model Card Contact
weare@projectsbyif.com - Projects by IF
opendata@moncton.ca - City of Moncton