File size: 2,643 Bytes
a1d714c e19a201 19e19cd a1d714c f68d184 32526b0 836ebcc e19a201 a1d714c e19a201 a1d714c e19a201 a1d714c e19a201 a1d714c e19a201 a1d714c e19a201 a1d714c e19a201 19e19cd 9468f48 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
---
library_name: transformers
tags:
- seq2seq
license: apache-2.0
datasets:
- Helsinki-NLP/europarl
- Helsinki-NLP/opus-100
language:
- en
- it
base_model:
- bigscience/mt0-small
pipeline_tag: translation
metrics:
- bleu
---
```html
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
/\ \ /\__\ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /\__\ /\ \ /\ \
/::\ \ /:/ _/_ /::\ \ /::\ \ /::\ \ _\:\ \ /::\ \ /::\ \ /::\ \ /:/ / _\:\ \ /::\ \
\:\:\__\ /:/_/\__\ /::\:\__\ /:/\:\__\ /::\:\__\ /\/::\__\ /::\:\__\ /:/\:\__\ /:/\:\__\ /:/__/ /\/::\__\ /:/\:\__\
\::/ / \:\/:/ / \/\::/ / \:\/:/ / \;:::/ / \::/\/__/ \/\:\/__/ \:\/:/ / \:\:\/__/ \:\ \ \::/\/__/ \:\/:/ /
/:/ / \::/ / /:/ / \::/ / |:\/__/ \:\__\ \/__/ \::/ / \::/ / \:\__\ \:\__\ \::/ /
\/__/ \/__/ \/__/ \/__/ \|__| \/__/ \/__/ \/__/ \/__/ \/__/ \/__/
```
## 🍀 Quadrifoglio - A small model for English -> Italian translation
Quadrifoglio is an encoder-decoder transformer model for English-Italian text translation based on `bigscience/mt0-small`. It was trained on the `en-it` section of `Helsinki-NLP/opus-100` and `Helsinki-NLP/europarl`.
## Usage
```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# Load model and tokenizer from checkpoint directory
tokenizer = AutoTokenizer.from_pretrained("LeonardPuettmann/mt0-Quadrifoglio-mt-en-it")
model = AutoModelForSeq2SeqLM.from_pretrained("LeonardPuettmann/mt0-Quadrifoglio-mt-en-it")
def generate_response(input_text):
input_ids = tokenizer("translate English to Italian:" + input_text, return_tensors="pt").input_ids
output = model.generate(input_ids, max_new_tokens=256)
return tokenizer.decode(output[0], skip_special_tokens=True)
text_to_translate = "I would like a cup of green tea, please."
response = generate_response(text_to_translate)
print(response)
```
## Evaluation
Done on the Opus 100 test set.
### BLEU
| | Quadrifoglio (this model) | mt0-small| DeepL |
|--------------|-------------------------------|----------|--------|
| BLEU Score | 0.4816 | 0.0159 | 0.5210 |
| Precision 1 | 0.7305 | 0.2350 | 0.7613 |
| Precision 2 | 0.5413 | 0.0290 | 0.5853 |
| Precision 3 | 0.4289 | 0.0076 | 0.4800 |
| Precision 4 | 0.3417 | 0.0013 | 0.3971 |
|