Views
No views yet
>>id<< (id = valid target language ID), e.g. >>fra<<1from transformers import MarianMTModel, MarianTokenizer
2
3src_text = [
4 ">>spa<< Jag är inte religiös.",
5 ">>por<< Livet er for kort til å lære seg tysk."
6]
7
8model_name = "pytorch-models/opus-mt-tc-big-gmq-itc"
9tokenizer = MarianTokenizer.from_pretrained(model_name)
10model = MarianMTModel.from_pretrained(model_name)
11translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True))
12
13for t in translated:
14 print( tokenizer.decode(t, skip_special_tokens=True) )
15
16# expected output:
17# No soy religioso.
18# A vida é muito curta para aprender alemão.1from transformers import pipeline
2pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-gmq-itc")
3print(pipe(">>spa<< Jag är inte religiös."))
4
5# expected output: No soy religioso.| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| dan-fra | tatoeba-test-v2021-08-07 | 0.76671 | 63.8 | 1731 | 11882 |
| dan-ita | tatoeba-test-v2021-08-07 | 0.74658 | 56.2 | 284 | 2226 |
| dan-por | tatoeba-test-v2021-08-07 | 0.74944 | 57.8 | 873 | 5360 |
| dan-spa | tatoeba-test-v2021-08-07 | 0.72328 | 54.8 | 5000 | 35528 |
| isl-ita | tatoeba-test-v2021-08-07 | 0.69354 | 51.0 | 236 | 1450 |
| isl-spa | tatoeba-test-v2021-08-07 | 0.66008 | 49.2 | 238 | 1229 |
| nob-fra | tatoeba-test-v2021-08-07 | 0.70854 | 54.4 | 323 | 2269 |
| nob-spa | tatoeba-test-v2021-08-07 | 0.73672 | 55.9 | 885 | 6866 |
| swe-fra | tatoeba-test-v2021-08-07 | 0.73014 | 59.2 | 1407 | 9580 |
| swe-ita | tatoeba-test-v2021-08-07 | 0.73211 | 56.6 | 715 | 4711 |
| swe-por | tatoeba-test-v2021-08-07 | 0.68146 | 48.7 | 320 | 2032 |
| swe-spa | tatoeba-test-v2021-08-07 | 0.71373 | 55.3 | 1351 | 8235 |
| dan-cat | flores101-devtest | 0.59224 | 33.4 | 1012 | 27304 |
| dan-fra | flores101-devtest | 0.63387 | 38.3 | 1012 | 28343 |
| dan-glg | flores101-devtest | 0.54446 | 26.4 | 1012 | 26582 |
| dan-ita | flores101-devtest | 0.55237 | 25.7 | 1012 | 27306 |
| dan-por | flores101-devtest | 0.62233 | 36.9 | 1012 | 26519 |
| dan-ron | flores101-devtest | 0.58235 | 31.8 | 1012 | 26799 |
| dan-spa | flores101-devtest | 0.52453 | 24.3 | 1012 | 29199 |
| isl-cat | flores101-devtest | 0.48930 | 22.7 | 1012 | 27304 |
| isl-fra | flores101-devtest | 0.52704 | 26.2 | 1012 | 28343 |
| isl-glg | flores101-devtest | 0.45387 | 18.0 | 1012 | 26582 |
| isl-ita | flores101-devtest | 0.47303 | 18.6 | 1012 | 27306 |
| isl-por | flores101-devtest | 0.51381 | 24.9 | 1012 | 26519 |
| isl-ron | flores101-devtest | 0.48224 | 21.6 | 1012 | 26799 |
| isl-spa | flores101-devtest | 0.45786 | 18.1 | 1012 | 29199 |
| nob-cat | flores101-devtest | 0.55984 | 28.9 | 1012 | 27304 |
| nob-fra | flores101-devtest | 0.60102 | 33.8 | 1012 | 28343 |
| nob-glg | flores101-devtest | 0.52145 | 23.4 | 1012 | 26582 |
| nob-ita | flores101-devtest | 0.52619 | 22.2 | 1012 | 27306 |
| nob-por | flores101-devtest | 0.58836 | 32.2 | 1012 | 26519 |
| nob-ron | flores101-devtest | 0.54845 | 27.6 | 1012 | 26799 |
| nob-spa | flores101-devtest | 0.50661 | 21.8 | 1012 | 29199 |
| swe-cat | flores101-devtest | 0.58542 | 32.4 | 1012 | 27304 |
| swe-fra | flores101-devtest | 0.63688 | 39.3 | 1012 | 28343 |
| swe-glg | flores101-devtest | 0.53989 | 26.0 | 1012 | 26582 |
| swe-ita | flores101-devtest | 0.55232 | 25.9 | 1012 | 27306 |
| swe-por | flores101-devtest | 0.61882 | 36.5 | 1012 | 26519 |
| swe-ron | flores101-devtest | 0.57419 | 31.0 | 1012 | 26799 |
| swe-spa | flores101-devtest | 0.52175 | 23.8 | 1012 | 29199 |
@inproceedings{tiedemann-thottingal-2020-opus,
title = "{OPUS}-{MT} {--} Building open translation services for the World",
author = {Tiedemann, J{\"o}rg and Thottingal, Santhosh},
booktitle = "Proceedings of the 22nd Annual Conference of the European Association for Machine Translation",
month = nov,
year = "2020",
address = "Lisboa, Portugal",
publisher = "European Association for Machine Translation",
url = "https://aclanthology.org/2020.eamt-1.61",
pages = "479--480",
}
@inproceedings{tiedemann-2020-tatoeba,
title = "The Tatoeba Translation Challenge {--} Realistic Data Sets for Low Resource and Multilingual {MT}",
author = {Tiedemann, J{\"o}rg},
booktitle = "Proceedings of the Fifth Conference on Machine Translation",
month = nov,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2020.wmt-1.139",
pages = "1174--1182",
}