Upload folder using huggingface_hub
Browse files- .gitattributes +3 -0
- README.md +57 -0
- config.json +10 -0
- generation_config.json +15 -0
- model.bin +3 -0
- shared_vocabulary.json +0 -0
- source.spm +3 -0
- target.spm +3 -0
- tokenizer_config.json +48 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
source.spm filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
target.spm filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
vocab.spm filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- Helsinki-NLP/tatoeba
|
| 5 |
+
- openlanguagedata/flores_plus
|
| 6 |
+
language:
|
| 7 |
+
- es
|
| 8 |
+
- ca
|
| 9 |
+
metrics:
|
| 10 |
+
- bleu
|
| 11 |
+
- comet
|
| 12 |
+
- chrf
|
| 13 |
+
pipeline_tag: translation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# OPUS-MT-tiny-cat-spa
|
| 17 |
+
|
| 18 |
+
Distilled model from a Tatoeba-MT Teacher: [Tatoeba-MT-models/itc-deu+eng+fra+por+spa/opusTCv20230926max50+bt+jhubc_transformer-big_2024-05-30](https://object.pouta.csc.fi/Tatoeba-MT-models/itc-deu+eng+fra+por+spa/opusTCv20230926max50+bt+jhubc_transformer-big_2024-05-30.zip), which has been trained on the [Tatoeba](https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/data) dataset.
|
| 19 |
+
|
| 20 |
+
We used the [OpusDistillery](https://github.com/Helsinki-NLP/OpusDistillery) to train new a new student with the tiny architecture, with a regular transformer decoder.
|
| 21 |
+
For training data, we used [Tatoeba](https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/data).
|
| 22 |
+
The configuration file fed into OpusDistillery can be found [here](https://github.com/Helsinki-NLP/OpusDistillery/blob/main/configs/opustranslate_hf/config.op.ca-es.yml).
|
| 23 |
+
|
| 24 |
+
## How to run
|
| 25 |
+
```python
|
| 26 |
+
from transformers import MarianMTModel, MarianTokenizer
|
| 27 |
+
model_name = "Helsinki-NLP/opus-mt_tiny_cat-spa"
|
| 28 |
+
tokenizer = MarianTokenizer.from_pretrained(model_name)
|
| 29 |
+
model = MarianMTModel.from_pretrained(model_name)
|
| 30 |
+
tok = tokenizer("El concepte prové de la Xina, on la flor del cirerer era la més apreciada.", return_tensors="pt").input_ids
|
| 31 |
+
output = model.generate(tok)[0]
|
| 32 |
+
tokenizer.decode(output, skip_special_tokens=True)
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Benchmarks
|
| 36 |
+
### Teacher
|
| 37 |
+
| testset | BLEU | chr-F | COMET|
|
| 38 |
+
|-----------------------|-------|-------|-------|
|
| 39 |
+
| Flores+ | 24.7 | 53.4 | 0.8264 |
|
| 40 |
+
|
| 41 |
+
### Student
|
| 42 |
+
|
| 43 |
+
| testset | BLEU | chr-F | COMET |
|
| 44 |
+
|-----------------------|-------|-------|-------|
|
| 45 |
+
| Flores+ | 24.2 | 53.2 | 0.8484 |
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
## Marian models
|
| 49 |
+
|
| 50 |
+
We also provide Marian-compatible versions of this model. To use them, compile [Marian](https://marian-nmt.github.io/quickstart/) and run decoding with `marian-decoder`, for example:
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
marian-decoder \
|
| 54 |
+
-i input.txt \
|
| 55 |
+
-c final.model.npz.best-perplexity.npz.decoder.yml \
|
| 56 |
+
-m final.model.npz.best-perplexity.npz \
|
| 57 |
+
-v vocab.spm vocab.spm
|
config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_source_bos": false,
|
| 3 |
+
"add_source_eos": false,
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"decoder_start_token": "</s>",
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"layer_norm_epsilon": null,
|
| 8 |
+
"multi_query_attention": false,
|
| 9 |
+
"unk_token": "<unk>"
|
| 10 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bad_words_ids": [
|
| 4 |
+
[
|
| 5 |
+
32000
|
| 6 |
+
]
|
| 7 |
+
],
|
| 8 |
+
"bos_token_id": 0,
|
| 9 |
+
"decoder_start_token_id": 32000,
|
| 10 |
+
"eos_token_id": 0,
|
| 11 |
+
"forced_eos_token_id": 0,
|
| 12 |
+
"max_length": 512,
|
| 13 |
+
"pad_token_id": 32000,
|
| 14 |
+
"transformers_version": "4.57.6"
|
| 15 |
+
}
|
model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e7b01fc49820b37996e4b1353539be92e2218ee4abf5e89ca56c3ff4ad303bd
|
| 3 |
+
size 34479419
|
shared_vocabulary.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
source.spm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:31568642c69528bcc70c8e2a30c4f43a28ff39ab82e69cd70431a251f8692fcb
|
| 3 |
+
size 831666
|
target.spm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:31568642c69528bcc70c8e2a30c4f43a28ff39ab82e69cd70431a251f8692fcb
|
| 3 |
+
size 831666
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "</s>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<unk>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"32000": {
|
| 20 |
+
"content": "<pad>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"32001": {
|
| 28 |
+
"content": "<s>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
"bos_token": "<s>",
|
| 37 |
+
"clean_up_tokenization_spaces": false,
|
| 38 |
+
"eos_token": "</s>",
|
| 39 |
+
"extra_special_tokens": {},
|
| 40 |
+
"model_max_length": 512,
|
| 41 |
+
"pad_token": "<pad>",
|
| 42 |
+
"separate_vocabs": false,
|
| 43 |
+
"source_lang": null,
|
| 44 |
+
"sp_model_kwargs": {},
|
| 45 |
+
"target_lang": null,
|
| 46 |
+
"tokenizer_class": "MarianTokenizer",
|
| 47 |
+
"unk_token": "<unk>"
|
| 48 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|