Initial commit
Browse files- .gitattributes +1 -0
- README.md +144 -0
- benchmark_results.txt +5 -0
- benchmark_translations.zip +3 -0
- config.json +45 -0
- pytorch_model.bin +3 -0
- source.spm +3 -0
- special_tokens_map.json +1 -0
- target.spm +3 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
.gitattributes
CHANGED
@@ -26,3 +26,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
26 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
27 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
28 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
26 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
27 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
28 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.spm filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- pt
|
5 |
+
- pt_br
|
6 |
+
|
7 |
+
tags:
|
8 |
+
- translation
|
9 |
+
|
10 |
+
license: cc-by-4.0
|
11 |
+
model-index:
|
12 |
+
- name: opus-mt-tc-big-en-pt
|
13 |
+
results:
|
14 |
+
- task:
|
15 |
+
name: Translation eng-por
|
16 |
+
type: translation
|
17 |
+
args: eng-por
|
18 |
+
dataset:
|
19 |
+
name: flores101-devtest
|
20 |
+
type: flores_101
|
21 |
+
args: eng por devtest
|
22 |
+
metrics:
|
23 |
+
- name: BLEU
|
24 |
+
type: bleu
|
25 |
+
value: 50.4
|
26 |
+
- task:
|
27 |
+
name: Translation eng-por
|
28 |
+
type: translation
|
29 |
+
args: eng-por
|
30 |
+
dataset:
|
31 |
+
name: tatoeba-test-v2021-08-07
|
32 |
+
type: tatoeba_mt
|
33 |
+
args: eng-por
|
34 |
+
metrics:
|
35 |
+
- name: BLEU
|
36 |
+
type: bleu
|
37 |
+
value: 49.6
|
38 |
+
---
|
39 |
+
# opus-mt-tc-big-en-pt
|
40 |
+
|
41 |
+
Neural machine translation model for translating from English (en) to Portuguese (pt).
|
42 |
+
|
43 |
+
This model is part of the [OPUS-MT project](https://github.com/Helsinki-NLP/Opus-MT), an effort to make neural machine translation models widely available and accessible for many languages in the world. All models are originally trained using the amazing framework of [Marian NMT](https://marian-nmt.github.io/), an efficient NMT implementation written in pure C++. The models have been converted to pyTorch using the transformers library by huggingface. Training data is taken from [OPUS](https://opus.nlpl.eu/) and training pipelines use the procedures of [OPUS-MT-train](https://github.com/Helsinki-NLP/Opus-MT-train).
|
44 |
+
|
45 |
+
* Publications: [OPUS-MT – Building open translation services for the World](https://aclanthology.org/2020.eamt-1.61/) and [The Tatoeba Translation Challenge – Realistic Data Sets for Low Resource and Multilingual MT](https://aclanthology.org/2020.wmt-1.139/) (Please, cite if you use this model.)
|
46 |
+
|
47 |
+
```
|
48 |
+
@inproceedings{tiedemann-thottingal-2020-opus,
|
49 |
+
title = "{OPUS}-{MT} {--} Building open translation services for the World",
|
50 |
+
author = {Tiedemann, J{\"o}rg and Thottingal, Santhosh},
|
51 |
+
booktitle = "Proceedings of the 22nd Annual Conference of the European Association for Machine Translation",
|
52 |
+
month = nov,
|
53 |
+
year = "2020",
|
54 |
+
address = "Lisboa, Portugal",
|
55 |
+
publisher = "European Association for Machine Translation",
|
56 |
+
url = "https://aclanthology.org/2020.eamt-1.61",
|
57 |
+
pages = "479--480",
|
58 |
+
}
|
59 |
+
|
60 |
+
@inproceedings{tiedemann-2020-tatoeba,
|
61 |
+
title = "The Tatoeba Translation Challenge {--} Realistic Data Sets for Low Resource and Multilingual {MT}",
|
62 |
+
author = {Tiedemann, J{\"o}rg},
|
63 |
+
booktitle = "Proceedings of the Fifth Conference on Machine Translation",
|
64 |
+
month = nov,
|
65 |
+
year = "2020",
|
66 |
+
address = "Online",
|
67 |
+
publisher = "Association for Computational Linguistics",
|
68 |
+
url = "https://aclanthology.org/2020.wmt-1.139",
|
69 |
+
pages = "1174--1182",
|
70 |
+
}
|
71 |
+
```
|
72 |
+
|
73 |
+
## Model info
|
74 |
+
|
75 |
+
* Release: 2022-03-13
|
76 |
+
* source language(s): eng
|
77 |
+
* target language(s): pob por
|
78 |
+
* valid target language labels: >>pob<< >>por<<
|
79 |
+
* model: transformer-big
|
80 |
+
* data: opusTCv20210807+bt ([source](https://github.com/Helsinki-NLP/Tatoeba-Challenge))
|
81 |
+
* tokenization: SentencePiece (spm32k,spm32k)
|
82 |
+
* original model: [opusTCv20210807+bt_transformer-big_2022-03-13.zip](https://object.pouta.csc.fi/Tatoeba-MT-models/eng-por/opusTCv20210807+bt_transformer-big_2022-03-13.zip)
|
83 |
+
* more information released models: [OPUS-MT eng-por README](https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/models/eng-por/README.md)
|
84 |
+
* more information about the model: [MarianMT](https://huggingface.co/docs/transformers/model_doc/marian)
|
85 |
+
|
86 |
+
This is a multilingual translation model with multiple target languages. A sentence initial language token is required in the form of `>>id<<` (id = valid target language ID), e.g. `>>pob<<`
|
87 |
+
|
88 |
+
## Usage
|
89 |
+
|
90 |
+
A short example code:
|
91 |
+
|
92 |
+
```python
|
93 |
+
from transformers import MarianMTModel, MarianTokenizer
|
94 |
+
|
95 |
+
src_text = [
|
96 |
+
">>por<< Tom tried to stab me.",
|
97 |
+
">>por<< He has been to Hawaii several times."
|
98 |
+
]
|
99 |
+
|
100 |
+
model_name = "pytorch-models/opus-mt-tc-big-en-pt"
|
101 |
+
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
102 |
+
model = MarianMTModel.from_pretrained(model_name)
|
103 |
+
translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True))
|
104 |
+
|
105 |
+
for t in translated:
|
106 |
+
print( tokenizer.decode(t, skip_special_tokens=True) )
|
107 |
+
|
108 |
+
# expected output:
|
109 |
+
# O Tom tentou esfaquear-me.
|
110 |
+
# Ele já esteve no Havaí várias vezes.
|
111 |
+
```
|
112 |
+
|
113 |
+
You can also use OPUS-MT models with the transformers pipelines, for example:
|
114 |
+
|
115 |
+
```python
|
116 |
+
from transformers import pipeline
|
117 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-pt")
|
118 |
+
print(pipe(">>por<< Tom tried to stab me."))
|
119 |
+
|
120 |
+
# expected output: O Tom tentou esfaquear-me.
|
121 |
+
```
|
122 |
+
|
123 |
+
## Benchmarks
|
124 |
+
|
125 |
+
* test set translations: [opusTCv20210807+bt_transformer-big_2022-03-13.test.txt](https://object.pouta.csc.fi/Tatoeba-MT-models/eng-por/opusTCv20210807+bt_transformer-big_2022-03-13.test.txt)
|
126 |
+
* test set scores: [opusTCv20210807+bt_transformer-big_2022-03-13.eval.txt](https://object.pouta.csc.fi/Tatoeba-MT-models/eng-por/opusTCv20210807+bt_transformer-big_2022-03-13.eval.txt)
|
127 |
+
* benchmark results: [benchmark_results.txt](benchmark_results.txt)
|
128 |
+
* benchmark output: [benchmark_translations.zip](benchmark_translations.zip)
|
129 |
+
|
130 |
+
| langpair | testset | chr-F | BLEU | #sent | #words |
|
131 |
+
|----------|---------|-------|-------|-------|--------|
|
132 |
+
| eng-por | tatoeba-test-v2021-08-07 | 0.69320 | 49.6 | 13222 | 105265 |
|
133 |
+
| eng-por | flores101-devtest | 0.71673 | 50.4 | 1012 | 26519 |
|
134 |
+
|
135 |
+
## Acknowledgements
|
136 |
+
|
137 |
+
The work is supported by the [European Language Grid](https://www.european-language-grid.eu/) as [pilot project 2866](https://live.european-language-grid.eu/catalogue/#/resource/projects/2866), by the [FoTran project](https://www.helsinki.fi/en/researchgroups/natural-language-understanding-with-cross-lingual-grounding), funded by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 771113), and the [MeMAD project](https://memad.eu/), funded by the European Union’s Horizon 2020 Research and Innovation Programme under grant agreement No 780069. We are also grateful for the generous computational resources and IT infrastructure provided by [CSC -- IT Center for Science](https://www.csc.fi/), Finland.
|
138 |
+
|
139 |
+
## Model conversion info
|
140 |
+
|
141 |
+
* transformers version: 4.16.2
|
142 |
+
* OPUS-MT git hash: 3405783
|
143 |
+
* port time: Wed Apr 13 17:48:54 EEST 2022
|
144 |
+
* port machine: LM0-400-22516.local
|
benchmark_results.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
eng-por flores101-dev 0.71108 50.0 997 25287
|
2 |
+
eng-por flores101-devtest 0.71673 50.4 1012 26519
|
3 |
+
eng-por tatoeba-test-v2020-07-28 0.68656 48.8 10000 75371
|
4 |
+
eng-por tatoeba-test-v2021-03-30 0.68785 48.9 11574 87572
|
5 |
+
eng-por tatoeba-test-v2021-08-07 0.69320 49.6 13222 105265
|
benchmark_translations.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3539b408a2285cd7e35a58128a29f810ad72632d3cb3de8c522cfaa5ac723be6
|
3 |
+
size 1523832
|
config.json
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"activation_dropout": 0.0,
|
3 |
+
"activation_function": "relu",
|
4 |
+
"architectures": [
|
5 |
+
"MarianMTModel"
|
6 |
+
],
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"bad_words_ids": [
|
9 |
+
[
|
10 |
+
54775
|
11 |
+
]
|
12 |
+
],
|
13 |
+
"bos_token_id": 0,
|
14 |
+
"classifier_dropout": 0.0,
|
15 |
+
"d_model": 1024,
|
16 |
+
"decoder_attention_heads": 16,
|
17 |
+
"decoder_ffn_dim": 4096,
|
18 |
+
"decoder_layerdrop": 0.0,
|
19 |
+
"decoder_layers": 6,
|
20 |
+
"decoder_start_token_id": 54775,
|
21 |
+
"decoder_vocab_size": 54776,
|
22 |
+
"dropout": 0.1,
|
23 |
+
"encoder_attention_heads": 16,
|
24 |
+
"encoder_ffn_dim": 4096,
|
25 |
+
"encoder_layerdrop": 0.0,
|
26 |
+
"encoder_layers": 6,
|
27 |
+
"eos_token_id": 44670,
|
28 |
+
"forced_eos_token_id": 44670,
|
29 |
+
"init_std": 0.02,
|
30 |
+
"is_encoder_decoder": true,
|
31 |
+
"max_length": 512,
|
32 |
+
"max_position_embeddings": 1024,
|
33 |
+
"model_type": "marian",
|
34 |
+
"normalize_embedding": false,
|
35 |
+
"num_beams": 4,
|
36 |
+
"num_hidden_layers": 6,
|
37 |
+
"pad_token_id": 54775,
|
38 |
+
"scale_embedding": true,
|
39 |
+
"share_encoder_decoder_embeddings": true,
|
40 |
+
"static_position_embeddings": true,
|
41 |
+
"torch_dtype": "float16",
|
42 |
+
"transformers_version": "4.18.0.dev0",
|
43 |
+
"use_cache": true,
|
44 |
+
"vocab_size": 54776
|
45 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f3f6182f219942bbd90742f0976edda92027f219d7f9c6d3904915e2673e0738
|
3 |
+
size 577278467
|
source.spm
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7a7fcf812cf03a5785daa35d4932bbbe69e7e605c0fe56fce5a3f731d6c355aa
|
3 |
+
size 802741
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>"}
|
target.spm
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b3cf20ccd4e48a89882cfdba157c05fa1cd71a6b69517dfc80e3a34d387ea91f
|
3 |
+
size 824855
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"source_lang": "en", "target_lang": "pt", "unk_token": "<unk>", "eos_token": "</s>", "pad_token": "<pad>", "model_max_length": 512, "sp_model_kwargs": {}, "separate_vocabs": false, "special_tokens_map_file": null, "name_or_path": "marian-models/opusTCv20210807+bt_transformer-big_2022-03-13/en-pt", "tokenizer_class": "MarianTokenizer"}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|