Views
No views yet
>>id<< (id = valid target language ID), e.g. >>fra<<1from transformers import MarianMTModel, MarianTokenizer
2
3src_text = [
4 ">>fra<< Dobar dan, kako si?",
5 ">>spa<< Znam da je ovo čudno."
6]
7
8model_name = "pytorch-models/opus-mt-tc-big-zls-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# Bonjour, comment allez-vous ?
18# Sé que esto es raro.1from transformers import pipeline
2pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-zls-itc")
3print(pipe(">>fra<< Dobar dan, kako si?"))
4
5# expected output: Bonjour, comment allez-vous ?| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| bul-fra | tatoeba-test-v2021-08-07 | 0.68971 | 52.9 | 446 | 3669 |
| bul-ita | tatoeba-test-v2021-08-07 | 0.66412 | 45.1 | 2500 | 16951 |
| bul-spa | tatoeba-test-v2021-08-07 | 0.66672 | 49.7 | 286 | 1783 |
| hbs-fra | tatoeba-test-v2021-08-07 | 0.66434 | 48.1 | 474 | 3370 |
| hbs-ita | tatoeba-test-v2021-08-07 | 0.72381 | 53.5 | 534 | 3208 |
| hbs-spa | tatoeba-test-v2021-08-07 | 0.73105 | 58.0 | 607 | 3766 |
| hrv-fra | tatoeba-test-v2021-08-07 | 0.62800 | 44.3 | 258 | 1943 |
| hrv-spa | tatoeba-test-v2021-08-07 | 0.71370 | 57.5 | 254 | 1702 |
| mkd-spa | tatoeba-test-v2021-08-07 | 0.75366 | 62.1 | 217 | 1121 |
| srp_Latn-ita | tatoeba-test-v2021-08-07 | 0.76045 | 59.6 | 212 | 1292 |
| bul-fra | flores101-devtest | 0.60640 | 34.4 | 1012 | 28343 |
| bul-ita | flores101-devtest | 0.54135 | 24.0 | 1012 | 27306 |
| bul-por | flores101-devtest | 0.59322 | 32.4 | 1012 | 26519 |
| bul-ron | flores101-devtest | 0.55558 | 27.1 | 1012 | 26799 |
| bul-spa | flores101-devtest | 0.50962 | 22.4 | 1012 | 29199 |
| hrv-fra | flores101-devtest | 0.59349 | 33.1 | 1012 | 28343 |
| hrv-ita | flores101-devtest | 0.52980 | 23.5 | 1012 | 27306 |
| hrv-por | flores101-devtest | 0.57402 | 30.2 | 1012 | 26519 |
| hrv-ron | flores101-devtest | 0.53650 | 25.9 | 1012 | 26799 |
| hrv-spa | flores101-devtest | 0.50161 | 21.5 | 1012 | 29199 |
| mkd-fra | flores101-devtest | 0.60801 | 35.2 | 1012 | 28343 |
| mkd-ita | flores101-devtest | 0.53543 | 23.9 | 1012 | 27306 |
| mkd-por | flores101-devtest | 0.59648 | 33.9 | 1012 | 26519 |
| mkd-ron | flores101-devtest | 0.54998 | 28.0 | 1012 | 26799 |
| mkd-spa | flores101-devtest | 0.51079 | 22.8 | 1012 | 29199 |
| slv-fra | flores101-devtest | 0.58233 | 31.5 | 1012 | 28343 |
| slv-ita | flores101-devtest | 0.52390 | 22.4 | 1012 | 27306 |
| slv-por | flores101-devtest | 0.56436 | 29.0 | 1012 | 26519 |
| slv-ron | flores101-devtest | 0.53116 | 25.0 | 1012 | 26799 |
| slv-spa | flores101-devtest | 0.49621 | 21.1 | 1012 | 29199 |
| srp_Cyrl-fra | flores101-devtest | 0.62110 | 36.0 | 1012 | 28343 |
| srp_Cyrl-ita | flores101-devtest | 0.54083 | 23.9 | 1012 | 27306 |
| srp_Cyrl-por | flores101-devtest | 0.61248 | 34.9 | 1012 | 26519 |
| srp_Cyrl-ron | flores101-devtest | 0.56235 | 28.8 | 1012 | 26799 |
| srp_Cyrl-spa | flores101-devtest | 0.51698 | 22.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",
}