first commit
Browse files- README.md +51 -0
- config.json +60 -0
- pytorch_model.bin +3 -0
- source.spm +0 -0
- special_tokens_map.json +1 -0
- target.spm +0 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
README.md
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- translation
|
4 |
+
- torch==1.8.0
|
5 |
+
widget:
|
6 |
+
- text: "Inference Unavailable"
|
7 |
+
---
|
8 |
+
### marianmt-th-zh_cn
|
9 |
+
* source languages: th
|
10 |
+
* target languages: zh_cn
|
11 |
+
* dataset:
|
12 |
+
* model: transformer-align
|
13 |
+
* pre-processing: normalization + SentencePiece
|
14 |
+
* test set translations:
|
15 |
+
* test set scores:
|
16 |
+
|
17 |
+
## Training
|
18 |
+
|
19 |
+
Training scripts from [LalitaDeelert/NLP-ZH_TH-Project](https://github.com/LalitaDeelert/NLP-ZH_TH-Project). Experiments tracked at [cstorm125/marianmt-th-zh_cn](https://wandb.ai/cstorm125/marianmt-th-zh_cn).
|
20 |
+
|
21 |
+
```
|
22 |
+
export WANDB_PROJECT=marianmt-th-zh_cn
|
23 |
+
python train_model.py --input_fname ../data/v1/Train.csv \
|
24 |
+
--output_dir ../models/marianmt-th-zh_cn \
|
25 |
+
--source_lang th --target_lang zh \
|
26 |
+
--metric_tokenize zh --fp16
|
27 |
+
```
|
28 |
+
|
29 |
+
## Usage
|
30 |
+
|
31 |
+
```
|
32 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
33 |
+
|
34 |
+
tokenizer = AutoTokenizer.from_pretrained("cstorm125/marianmt-zh_cn-th")
|
35 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("cstorm125/marianmt-zh_cn-th").cpu()
|
36 |
+
|
37 |
+
src_text = [
|
38 |
+
'ฉันรักคุณ',
|
39 |
+
'ฉันอยากกินข้าว',
|
40 |
+
]
|
41 |
+
translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True))
|
42 |
+
print([tokenizer.decode(t, skip_special_tokens=True) for t in translated])
|
43 |
+
|
44 |
+
> ['我爱你', '我想吃饭。']
|
45 |
+
```
|
46 |
+
|
47 |
+
## Requirements
|
48 |
+
```
|
49 |
+
transformers==4.6.0
|
50 |
+
torch==1.8.0
|
51 |
+
```
|
config.json
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "checkpoint-191340",
|
3 |
+
"_num_labels": 3,
|
4 |
+
"activation_dropout": 0.0,
|
5 |
+
"activation_function": "swish",
|
6 |
+
"add_bias_logits": false,
|
7 |
+
"add_final_layer_norm": false,
|
8 |
+
"architectures": [
|
9 |
+
"MarianMTModel"
|
10 |
+
],
|
11 |
+
"attention_dropout": 0.0,
|
12 |
+
"bad_words_ids": [
|
13 |
+
[
|
14 |
+
3
|
15 |
+
]
|
16 |
+
],
|
17 |
+
"bos_token_id": 1,
|
18 |
+
"classif_dropout": 0.0,
|
19 |
+
"classifier_dropout": 0.0,
|
20 |
+
"d_model": 512,
|
21 |
+
"decoder_attention_heads": 8,
|
22 |
+
"decoder_ffn_dim": 2048,
|
23 |
+
"decoder_layerdrop": 0.0,
|
24 |
+
"decoder_layers": 6,
|
25 |
+
"decoder_start_token_id": 3,
|
26 |
+
"dropout": 0.1,
|
27 |
+
"encoder_attention_heads": 8,
|
28 |
+
"encoder_ffn_dim": 2048,
|
29 |
+
"encoder_layerdrop": 0.0,
|
30 |
+
"encoder_layers": 6,
|
31 |
+
"eos_token_id": 2,
|
32 |
+
"forced_eos_token_id": 0,
|
33 |
+
"gradient_checkpointing": false,
|
34 |
+
"id2label": {
|
35 |
+
"0": "LABEL_0",
|
36 |
+
"1": "LABEL_1",
|
37 |
+
"2": "LABEL_2"
|
38 |
+
},
|
39 |
+
"init_std": 0.02,
|
40 |
+
"is_encoder_decoder": true,
|
41 |
+
"label2id": {
|
42 |
+
"LABEL_0": 0,
|
43 |
+
"LABEL_1": 1,
|
44 |
+
"LABEL_2": 2
|
45 |
+
},
|
46 |
+
"max_length": 512,
|
47 |
+
"max_position_embeddings": 512,
|
48 |
+
"model_type": "marian",
|
49 |
+
"normalize_before": false,
|
50 |
+
"normalize_embedding": false,
|
51 |
+
"num_beams": 4,
|
52 |
+
"num_hidden_layers": 6,
|
53 |
+
"pad_token_id": 3,
|
54 |
+
"scale_embedding": true,
|
55 |
+
"static_position_embeddings": true,
|
56 |
+
"transformers_version": "4.6.0",
|
57 |
+
"unk_token_id": 0,
|
58 |
+
"use_cache": true,
|
59 |
+
"vocab_size": 32001
|
60 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8823d26bf4238cc9cc1ffb54ae2bcac8cdeb863fcf5daa7bc4edb61e3dc82aeb
|
3 |
+
size 242307293
|
source.spm
ADDED
Binary file (993 kB). View file
|
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>"}
|
target.spm
ADDED
Binary file (993 kB). View file
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"source_lang": null, "target_lang": null, "unk_token": "<unk>", "eos_token": "</s>", "pad_token": "<pad>", "model_max_length": 512, "special_tokens_map_file": null, "tokenizer_file": null, "name_or_path": "checkpoint-191340"}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|