julien-c HF staff commited on
Commit
e0bbcbd
1 Parent(s): a49447a

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/allenai/wmt16-en-de-dist-6-1/README.md

Files changed (1) hide show
  1. README.md +103 -0
README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ language:
4
+ - en
5
+ - de
6
+ thumbnail:
7
+ tags:
8
+ - translation
9
+ - wmt16
10
+ - allenai
11
+ license: apache-2.0
12
+ datasets:
13
+ - wmt16
14
+ metrics:
15
+ - bleu
16
+ ---
17
+
18
+ # FSMT
19
+
20
+ ## Model description
21
+
22
+ This is a ported version of fairseq-based [wmt16 transformer](https://github.com/jungokasai/deep-shallow/) for en-de.
23
+
24
+ For more details, please, see [Deep Encoder, Shallow Decoder: Reevaluating the Speed-Quality Tradeoff in Machine Translation](https://arxiv.org/abs/2006.10369).
25
+
26
+ All 3 models are available:
27
+
28
+ * [wmt16-en-de-dist-12-1](https://huggingface.co/allenai/wmt16-en-de-dist-12-1)
29
+ * [wmt16-en-de-dist-6-1](https://huggingface.co/allenai/wmt16-en-de-dist-6-1)
30
+ * [wmt16-en-de-12-1](https://huggingface.co/allenai/wmt16-en-de-12-1)
31
+
32
+
33
+ ## Intended uses & limitations
34
+
35
+ #### How to use
36
+
37
+ ```python
38
+ from transformers import FSMTForConditionalGeneration, FSMTTokenizer
39
+ mname = "allenai/wmt16-en-de-dist-6-1"
40
+ tokenizer = FSMTTokenizer.from_pretrained(mname)
41
+ model = FSMTForConditionalGeneration.from_pretrained(mname)
42
+
43
+ input = "Machine learning is great, isn't it?"
44
+ input_ids = tokenizer.encode(input, return_tensors="pt")
45
+ outputs = model.generate(input_ids)
46
+ decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
47
+ print(decoded) # Maschinelles Lernen ist großartig, nicht wahr?
48
+
49
+ ```
50
+
51
+ #### Limitations and bias
52
+
53
+
54
+ ## Training data
55
+
56
+ Pretrained weights were left identical to the original model released by allenai. For more details, please, see the [paper](https://arxiv.org/abs/2006.10369).
57
+
58
+ ## Eval results
59
+
60
+ Here are the BLEU scores:
61
+
62
+ model | fairseq | transformers
63
+ -------|---------|----------
64
+ wmt16-en-de-dist-6-1 | 27.4 | 27.11
65
+
66
+ The score is slightly below the score reported in the paper, as the researchers don't use `sacrebleu` and measure the score on tokenized outputs. `transformers` score was measured using `sacrebleu` on detokenized outputs.
67
+
68
+ The score was calculated using this code:
69
+
70
+ ```bash
71
+ git clone https://github.com/huggingface/transformers
72
+ cd transformers
73
+ export PAIR=en-de
74
+ export DATA_DIR=data/$PAIR
75
+ export SAVE_DIR=data/$PAIR
76
+ export BS=8
77
+ export NUM_BEAMS=5
78
+ mkdir -p $DATA_DIR
79
+ sacrebleu -t wmt16 -l $PAIR --echo src > $DATA_DIR/val.source
80
+ sacrebleu -t wmt16 -l $PAIR --echo ref > $DATA_DIR/val.target
81
+ echo $PAIR
82
+ PYTHONPATH="src:examples/seq2seq" python examples/seq2seq/run_eval.py allenai/wmt16-en-de-dist-6-1 $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
83
+ ```
84
+
85
+ ## Data Sources
86
+
87
+ - [training, etc.](http://www.statmt.org/wmt16/)
88
+ - [test set](http://matrix.statmt.org/test_sets/newstest2016.tgz?1504722372)
89
+
90
+
91
+ ### BibTeX entry and citation info
92
+
93
+ ```
94
+ @misc{kasai2020deep,
95
+ title={Deep Encoder, Shallow Decoder: Reevaluating the Speed-Quality Tradeoff in Machine Translation},
96
+ author={Jungo Kasai and Nikolaos Pappas and Hao Peng and James Cross and Noah A. Smith},
97
+ year={2020},
98
+ eprint={2006.10369},
99
+ archivePrefix={arXiv},
100
+ primaryClass={cs.CL}
101
+ }
102
+ ```
103
+