update README
Browse files- README.md +80 -0
- config.yaml +2 -2
- hyp.test → test.hyp.de-en.en +0 -0
- test.hyp.en-de.de +0 -0
- test.hyp.en-fr.fr +0 -0
- test.hyp.fr-en.en +0 -0
- test.de-en.tsv → test.ref.de-en.tsv +0 -0
- test.ref.fr-en.tsv +0 -0
README.md
CHANGED
@@ -1,3 +1,83 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
library_name: JoeyNMT
|
4 |
+
task: Machine-translation
|
5 |
+
tags:
|
6 |
+
- JoeyNMT
|
7 |
+
- Machine-translation
|
8 |
+
language:
|
9 |
+
- en
|
10 |
+
- de
|
11 |
+
- fr
|
12 |
+
- multilingual
|
13 |
+
datasets:
|
14 |
+
- may-ohta/iwslt14
|
15 |
+
metrics:
|
16 |
+
- bleu
|
17 |
---
|
18 |
+
# JoeyNMT: iwslt14 de-en-fr multilingual
|
19 |
+
|
20 |
+
This is a JoeyNMT model for multilingual MT with language tags, built for a demo purpose.
|
21 |
+
The model is trained on iwslt14 de-en / en-fr parallel data using DDP.
|
22 |
+
|
23 |
+
|
24 |
+
Install [JoeyNMT](https://github.com/joeynmt/joeynmt) v2.3:
|
25 |
+
```
|
26 |
+
$ pip install git+https://github.com/joeynmt/joeynmt.git
|
27 |
+
```
|
28 |
+
|
29 |
+
|
30 |
+
## Translation
|
31 |
+
|
32 |
+
Torch hub interface:
|
33 |
+
```python
|
34 |
+
import torch
|
35 |
+
|
36 |
+
iwslt14 = torch.hub.load("joeynmt/joeynmt", "iwslt14_prompt")
|
37 |
+
translation = iwslt14.translate(
|
38 |
+
src=["Hello world!"], # src sentence
|
39 |
+
src_prompt=["<en>"], # src language code
|
40 |
+
trg_prompt=["<de>"], # trg language code
|
41 |
+
beam_size=1,
|
42 |
+
)
|
43 |
+
print(translation) # ["Hallo Welt!"]
|
44 |
+
```
|
45 |
+
(See [jupyter notebook](https://github.com/joeynmt/joeynmt/blob/main/notebooks/torchhub.ipynb) for details)
|
46 |
+
|
47 |
+
|
48 |
+
## Training
|
49 |
+
```
|
50 |
+
$ python -m joeynmt train iwslt14_prompt/config.yaml --use-ddp --skip-test
|
51 |
+
```
|
52 |
+
(See `train.log` for details)
|
53 |
+
|
54 |
+
|
55 |
+
## Evaluation
|
56 |
+
```
|
57 |
+
$ git clone https://huggingface.co/may-ohta/iwslt14_prompt
|
58 |
+
$ python -m joeynmt test iwslt14_prompt/config.yaml --output-path iwslt14_prompt/hyp
|
59 |
+
```
|
60 |
+
|
61 |
+
direction | bleu
|
62 |
+
--------- | :----
|
63 |
+
en->de | 28.88
|
64 |
+
de->en | 35.28
|
65 |
+
en->fr | 38.86
|
66 |
+
fr->en | 40.35
|
67 |
+
|
68 |
+
- beam_size: 5
|
69 |
+
- beam_alpha: 1.0
|
70 |
+
- sacrebleu signature `nrefs:1|case:lc|eff:no|tok:13a|smooth:exp|version:2.4.0`
|
71 |
+
|
72 |
+
(See `test.log` for details)
|
73 |
+
|
74 |
+
|
75 |
+
## Data Format
|
76 |
+
We downloaded IWSLT14 de-en and en-fr from [https://wit3.fbk.eu/2014-01](https://wit3.fbk.eu/2014-01) and created `{train|dev|test}.tsv` files in the following format:
|
77 |
+
|
78 |
+
|src_prompt|src|trg_prompt|trg|
|
79 |
+
|:---------|:--|:---------|:--|
|
80 |
+
|`<en>`|Hello.|`<de>`|Hallo.|
|
81 |
+
|`<de>`|Vielen Dank!|`<en>`|Thank you!|
|
82 |
+
|
83 |
+
(See `test.ref.de-en.tsv`)
|
config.yaml
CHANGED
@@ -6,9 +6,9 @@ fp16: True
|
|
6 |
random_seed: 42
|
7 |
|
8 |
data:
|
9 |
-
#train: "iwslt14_prompt/train"
|
10 |
#dev: "iwslt14_prompt/dev"
|
11 |
-
test: "iwslt14_prompt/test.de-en" # ['TED.dev2010', 'TEDX.dev2012', 'TED.tst2010', 'TED.tst2011', 'TED.tst2012']
|
12 |
dataset_type: "tsv"
|
13 |
sample_dev_subset: 500
|
14 |
src:
|
|
|
6 |
random_seed: 42
|
7 |
|
8 |
data:
|
9 |
+
#train: "iwslt14_prompt/train" # cf. https://wit3.fbk.eu/2014-01
|
10 |
#dev: "iwslt14_prompt/dev"
|
11 |
+
test: "iwslt14_prompt/test.ref.de-en" # ['TED.dev2010', 'TEDX.dev2012', 'TED.tst2010', 'TED.tst2011', 'TED.tst2012']
|
12 |
dataset_type: "tsv"
|
13 |
sample_dev_subset: 500
|
14 |
src:
|
hyp.test → test.hyp.de-en.en
RENAMED
File without changes
|
test.hyp.en-de.de
ADDED
The diff for this file is too large to render.
See raw diff
|
|
test.hyp.en-fr.fr
ADDED
The diff for this file is too large to render.
See raw diff
|
|
test.hyp.fr-en.en
ADDED
The diff for this file is too large to render.
See raw diff
|
|
test.de-en.tsv → test.ref.de-en.tsv
RENAMED
File without changes
|
test.ref.fr-en.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|