julien-c commited on
Commit
b339767
1 Parent(s): 893b26d

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/facebook/wmt19-en-de/README.md

Files changed (1) hide show
  1. README.md +109 -0
README.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - de
5
+ tags:
6
+ - translation
7
+ - wmt19
8
+ - facebook
9
+ license: apache-2.0
10
+ datasets:
11
+ - wmt19
12
+ metrics:
13
+ - bleu
14
+ thumbnail: https://huggingface.co/front/thumbnails/facebook.png
15
+ ---
16
+
17
+ # FSMT
18
+
19
+ ## Model description
20
+
21
+ This is a ported version of [fairseq wmt19 transformer](https://github.com/pytorch/fairseq/blob/master/examples/wmt19/README.md) for en-de.
22
+
23
+ For more details, please see, [Facebook FAIR's WMT19 News Translation Task Submission](https://arxiv.org/abs/1907.06616).
24
+
25
+ The abbreviation FSMT stands for FairSeqMachineTranslation
26
+
27
+ All four models are available:
28
+
29
+ * [wmt19-en-ru](https://huggingface.co/facebook/wmt19-en-ru)
30
+ * [wmt19-ru-en](https://huggingface.co/facebook/wmt19-ru-en)
31
+ * [wmt19-en-de](https://huggingface.co/facebook/wmt19-en-de)
32
+ * [wmt19-de-en](https://huggingface.co/facebook/wmt19-de-en)
33
+
34
+ ## Intended uses & limitations
35
+
36
+ #### How to use
37
+
38
+ ```python
39
+ from transformers import FSMTForConditionalGeneration, FSMTTokenizer
40
+ mname = "facebook/wmt19-en-de"
41
+ tokenizer = FSMTTokenizer.from_pretrained(mname)
42
+ model = FSMTForConditionalGeneration.from_pretrained(mname)
43
+
44
+ input = "Machine learning is great, isn't it?"
45
+ input_ids = tokenizer.encode(input, return_tensors="pt")
46
+ outputs = model.generate(input_ids)
47
+ decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
48
+ print(decoded) # Maschinelles Lernen ist großartig, oder?
49
+
50
+ ```
51
+
52
+ #### Limitations and bias
53
+
54
+ - The original (and this ported model) doesn't seem to handle well inputs with repeated sub-phrases, [content gets truncated](https://discuss.huggingface.co/t/issues-with-translating-inputs-containing-repeated-phrases/981)
55
+
56
+ ## Training data
57
+
58
+ Pretrained weights were left identical to the original model released by fairseq. For more details, please, see the [paper](https://arxiv.org/abs/1907.06616).
59
+
60
+ ## Eval results
61
+
62
+ pair | fairseq | transformers
63
+ -------|---------|----------
64
+ en-de | [43.1](http://matrix.statmt.org/matrix/output/1909?run_id=6862) | 42.83
65
+
66
+ The score is slightly below the score reported by `fairseq`, since `transformers`` currently doesn't support:
67
+ - model ensemble, therefore the best performing checkpoint was ported (``model4.pt``).
68
+ - re-ranking
69
+
70
+ The score was calculated using this code:
71
+
72
+ ```bash
73
+ git clone https://github.com/huggingface/transformers
74
+ cd transformers
75
+ export PAIR=en-de
76
+ export DATA_DIR=data/$PAIR
77
+ export SAVE_DIR=data/$PAIR
78
+ export BS=8
79
+ export NUM_BEAMS=15
80
+ mkdir -p $DATA_DIR
81
+ sacrebleu -t wmt19 -l $PAIR --echo src > $DATA_DIR/val.source
82
+ sacrebleu -t wmt19 -l $PAIR --echo ref > $DATA_DIR/val.target
83
+ echo $PAIR
84
+ PYTHONPATH="src:examples/seq2seq" python examples/seq2seq/run_eval.py facebook/wmt19-$PAIR $DATA_DIR/val.source $SAVE_DIR/test_translations.txt --reference_path $DATA_DIR/val.target --score_path $SAVE_DIR/test_bleu.json --bs $BS --task translation --num_beams $NUM_BEAMS
85
+ ```
86
+ note: fairseq reports using a beam of 50, so you should get a slightly higher score if re-run with `--num_beams 50`.
87
+
88
+ ## Data Sources
89
+
90
+ - [training, etc.](http://www.statmt.org/wmt19/)
91
+ - [test set](http://matrix.statmt.org/test_sets/newstest2019.tgz?1556572561)
92
+
93
+
94
+ ### BibTeX entry and citation info
95
+
96
+ ```bibtex
97
+ @inproceedings{...,
98
+ year={2020},
99
+ title={Facebook FAIR's WMT19 News Translation Task Submission},
100
+ author={Ng, Nathan and Yee, Kyra and Baevski, Alexei and Ott, Myle and Auli, Michael and Edunov, Sergey},
101
+ booktitle={Proc. of WMT},
102
+ }
103
+ ```
104
+
105
+
106
+ ## TODO
107
+
108
+ - port model ensemble (fairseq uses 4 model checkpoints)
109
+