Views
No views yet
1from transformers import MarianMTModel, MarianTokenizer
2
3src_text = [
4 "Jesi li ti student?",
5 "Dve stvari deca treba da dobiju od svojih roditelja: korene i krila."
6]
7
8model_name = "pytorch-models/opus-mt-tc-big-zls-de"
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# Sind Sie Student?
18# Zwei Dinge sollten Kinder von ihren Eltern bekommen: Wurzeln und Flügel.1from transformers import pipeline
2pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-zls-de")
3print(pipe("Jesi li ti student?"))
4
5# expected output: Sind Sie Student?| langpair | testset | chr-F | BLEU | #sent | #words |
|---|---|---|---|---|---|
| bul-deu | tatoeba-test-v2021-08-07 | 0.71220 | 54.5 | 314 | 2224 |
| hbs-deu | tatoeba-test-v2021-08-07 | 0.71283 | 54.8 | 1959 | 15559 |
| hrv-deu | tatoeba-test-v2021-08-07 | 0.69448 | 53.1 | 782 | 5734 |
| slv-deu | tatoeba-test-v2021-08-07 | 0.36339 | 21.1 | 492 | 3003 |
| srp_Latn-deu | tatoeba-test-v2021-08-07 | 0.72489 | 56.0 | 986 | 8500 |
| bul-deu | flores101-devtest | 0.57688 | 28.4 | 1012 | 25094 |
| hrv-deu | flores101-devtest | 0.56674 | 27.4 | 1012 | 25094 |
| mkd-deu | flores101-devtest | 0.57688 | 29.3 | 1012 | 25094 |
| slv-deu | flores101-devtest | 0.56258 | 26.7 | 1012 | 25094 |
| srp_Cyrl-deu | flores101-devtest | 0.59271 | 30.7 | 1012 | 25094 |
@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",
}