Skip to content

Commit 0fe6e43

Browse files
authored
[model cards] ported allenai Deep Encoder, Shallow Decoder models (#7153)
* [model cards] ported allenai Deep Encoder, Shallow Decoder models * typo * fix references * add allenai/wmt19-de-en-6-6 model cards * fill-in the missing info for the build script as provided by the searcher.
1 parent 1eeb206 commit 0fe6e43

File tree

6 files changed

+482
-2
lines changed

6 files changed

+482
-2
lines changed

Diff for: model_cards/allenai/wmt16-en-de-12-1/README.md

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
---
3+
4+
language: en, de
5+
thumbnail:
6+
tags:
7+
- translation
8+
- wmt16
9+
- allenai
10+
license: Apache 2.0
11+
datasets:
12+
- http://www.statmt.org/wmt16/ ([test-set](http://matrix.statmt.org/test_sets/newstest2016.tgz?1504722372))
13+
14+
metrics:
15+
- http://www.statmt.org/wmt16/metrics-task.html
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+
@misc{kasai2020deep,
34+
title={Deep Encoder, Shallow Decoder: Reevaluating the Speed-Quality Tradeoff in Machine Translation},
35+
author={Jungo Kasai and Nikolaos Pappas and Hao Peng and James Cross and Noah A. Smith},
36+
year={2020},
37+
eprint={2006.10369},
38+
archivePrefix={arXiv},
39+
primaryClass={cs.CL}
40+
}
41+
```
42+
43+
## Intended uses & limitations
44+
45+
#### How to use
46+
47+
```python
48+
from transformers.tokenization_fsmt import FSMTTokenizer
49+
from transformers.modeling_fsmt import FSMTForConditionalGeneration
50+
mname = "allenai/wmt16-en-de-12-1"
51+
tokenizer = FSMTTokenizer.from_pretrained(mname)
52+
model = FSMTForConditionalGeneration.from_pretrained(mname)
53+
54+
input = "Machine learning is great, isn't it?"
55+
input_ids = tokenizer.encode(input, return_tensors="pt")
56+
outputs = model.generate(input_ids)
57+
decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
58+
print(decoded) # Maschinelles Lernen ist großartig, nicht wahr?
59+
60+
```
61+
62+
#### Limitations and bias
63+
64+
65+
## Training data
66+
67+
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).
68+
69+
## Eval results
70+
71+
Here are the BLEU scores:
72+
73+
model | fairseq | transformers
74+
-------|---------|----------
75+
wmt16-en-de-12-1 | 26.9 | 25.75
76+
77+
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.
78+
79+
The score was calculated using this code:
80+
81+
```bash
82+
git clone https://github.com/huggingface/transformers
83+
cd transformers
84+
export PAIR=en-de
85+
export DATA_DIR=data/$PAIR
86+
export SAVE_DIR=data/$PAIR
87+
export BS=8
88+
export NUM_BEAMS=5
89+
mkdir -p $DATA_DIR
90+
sacrebleu -t wmt16 -l $PAIR --echo src > $DATA_DIR/val.source
91+
sacrebleu -t wmt16 -l $PAIR --echo ref > $DATA_DIR/val.target
92+
echo $PAIR
93+
PYTHONPATH="src:examples/seq2seq" python examples/seq2seq/run_eval.py allenai/wmt16-en-de-12-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
94+
```
95+

Diff for: model_cards/allenai/wmt16-en-de-dist-12-1/README.md

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
---
3+
4+
language: en, de
5+
thumbnail:
6+
tags:
7+
- translation
8+
- wmt16
9+
- allenai
10+
license: Apache 2.0
11+
datasets:
12+
- http://www.statmt.org/wmt16/ ([test-set](http://matrix.statmt.org/test_sets/newstest2016.tgz?1504722372))
13+
14+
metrics:
15+
- http://www.statmt.org/wmt16/metrics-task.html
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+
@misc{kasai2020deep,
34+
title={Deep Encoder, Shallow Decoder: Reevaluating the Speed-Quality Tradeoff in Machine Translation},
35+
author={Jungo Kasai and Nikolaos Pappas and Hao Peng and James Cross and Noah A. Smith},
36+
year={2020},
37+
eprint={2006.10369},
38+
archivePrefix={arXiv},
39+
primaryClass={cs.CL}
40+
}
41+
```
42+
43+
## Intended uses & limitations
44+
45+
#### How to use
46+
47+
```python
48+
from transformers.tokenization_fsmt import FSMTTokenizer
49+
from transformers.modeling_fsmt import FSMTForConditionalGeneration
50+
mname = "allenai/wmt16-en-de-dist-12-1"
51+
tokenizer = FSMTTokenizer.from_pretrained(mname)
52+
model = FSMTForConditionalGeneration.from_pretrained(mname)
53+
54+
input = "Machine learning is great, isn't it?"
55+
input_ids = tokenizer.encode(input, return_tensors="pt")
56+
outputs = model.generate(input_ids)
57+
decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
58+
print(decoded) # Maschinelles Lernen ist großartig, nicht wahr?
59+
60+
```
61+
62+
#### Limitations and bias
63+
64+
65+
## Training data
66+
67+
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).
68+
69+
## Eval results
70+
71+
Here are the BLEU scores:
72+
73+
model | fairseq | transformers
74+
-------|---------|----------
75+
wmt16-en-de-dist-12-1 | 28.3 | 27.52
76+
77+
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.
78+
79+
The score was calculated using this code:
80+
81+
```bash
82+
git clone https://github.com/huggingface/transformers
83+
cd transformers
84+
export PAIR=en-de
85+
export DATA_DIR=data/$PAIR
86+
export SAVE_DIR=data/$PAIR
87+
export BS=8
88+
export NUM_BEAMS=5
89+
mkdir -p $DATA_DIR
90+
sacrebleu -t wmt16 -l $PAIR --echo src > $DATA_DIR/val.source
91+
sacrebleu -t wmt16 -l $PAIR --echo ref > $DATA_DIR/val.target
92+
echo $PAIR
93+
PYTHONPATH="src:examples/seq2seq" python examples/seq2seq/run_eval.py allenai/wmt16-en-de-dist-12-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
94+
```
95+

Diff for: model_cards/allenai/wmt16-en-de-dist-6-1/README.md

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
---
3+
4+
language: en, de
5+
thumbnail:
6+
tags:
7+
- translation
8+
- wmt16
9+
- allenai
10+
license: Apache 2.0
11+
datasets:
12+
- http://www.statmt.org/wmt16/ ([test-set](http://matrix.statmt.org/test_sets/newstest2016.tgz?1504722372))
13+
14+
metrics:
15+
- http://www.statmt.org/wmt16/metrics-task.html
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+
@misc{kasai2020deep,
34+
title={Deep Encoder, Shallow Decoder: Reevaluating the Speed-Quality Tradeoff in Machine Translation},
35+
author={Jungo Kasai and Nikolaos Pappas and Hao Peng and James Cross and Noah A. Smith},
36+
year={2020},
37+
eprint={2006.10369},
38+
archivePrefix={arXiv},
39+
primaryClass={cs.CL}
40+
}
41+
```
42+
43+
## Intended uses & limitations
44+
45+
#### How to use
46+
47+
```python
48+
from transformers.tokenization_fsmt import FSMTTokenizer
49+
from transformers.modeling_fsmt import FSMTForConditionalGeneration
50+
mname = "allenai/wmt16-en-de-dist-6-1"
51+
tokenizer = FSMTTokenizer.from_pretrained(mname)
52+
model = FSMTForConditionalGeneration.from_pretrained(mname)
53+
54+
input = "Machine learning is great, isn't it?"
55+
input_ids = tokenizer.encode(input, return_tensors="pt")
56+
outputs = model.generate(input_ids)
57+
decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
58+
print(decoded) # Maschinelles Lernen ist großartig, nicht wahr?
59+
60+
```
61+
62+
#### Limitations and bias
63+
64+
65+
## Training data
66+
67+
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).
68+
69+
## Eval results
70+
71+
Here are the BLEU scores:
72+
73+
model | fairseq | transformers
74+
-------|---------|----------
75+
wmt16-en-de-dist-6-1 | 27.4 | 27.11
76+
77+
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.
78+
79+
The score was calculated using this code:
80+
81+
```bash
82+
git clone https://github.com/huggingface/transformers
83+
cd transformers
84+
export PAIR=en-de
85+
export DATA_DIR=data/$PAIR
86+
export SAVE_DIR=data/$PAIR
87+
export BS=8
88+
export NUM_BEAMS=5
89+
mkdir -p $DATA_DIR
90+
sacrebleu -t wmt16 -l $PAIR --echo src > $DATA_DIR/val.source
91+
sacrebleu -t wmt16 -l $PAIR --echo ref > $DATA_DIR/val.target
92+
echo $PAIR
93+
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
94+
```
95+

Diff for: model_cards/allenai/wmt19-de-en-6-6-base/README.md

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

0 commit comments

Comments
 (0)