Create README.md
Browse files
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 |
+
```
|