This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
dobi.yaml
135 lines (114 loc) · 3.18 KB
/
dobi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
meta:
project: opennmt
alias=qionpu: # 全部
tasks: [hazoi-ngiliau, don-ngiliau, zunpi-ngiliau, hiunlien, ]
job=hazoi-ngiliau: # 下載語料
use: hazoi_docker
command: |
bash -eux -c '
python nginziin.py
'
mounts: [ngienbun_ngiliau, ]
job=don-ngiliau: # 斷詞斷字語料
use: hazoi_docker
command: |
bash -eux -c '
cat /ngienbun-ngiliau/meu.txt | sed "s/\(.\)/\1 /g" \
| head -n 500 > /doncii-ngiliau/meu.valid
cat /ngienbun-ngiliau/meu.txt | sed "s/\(.\)/\1 /g" \
| tail -n +501 > /doncii-ngiliau/meu.train
cat /ngienbun-ngiliau/fa.txt | sed "s/\(.\)/\1 /g" \
| head -n 500 > /doncii-ngiliau/fa.valid
cat /ngienbun-ngiliau/fa.txt | sed "s/\(.\)/\1 /g" \
| tail -n +501 > /doncii-ngiliau/fa.train
'
mounts: [ngienbun_ngiliau, doncii_ngiliau, ]
mount=ngienbun_ngiliau: # 原本語料
bind: ./1-ngienbun-ngiliau/
path: /ngienbun-ngiliau/
mount=doncii_ngiliau: # 斷詞語料
bind: ./2-doncii-ngiliau/
path: /doncii-ngiliau/
mount=opennmt_data:
bind: ./3-opennmt-data/
path: /data/
mount=opennmt_model:
bind: ./4-opennmt-model/
path: /model/
mount=bleu_data:
bind: ./5-bleu-data/
path: /bleu/
image=hazoi_docker:
image: hazoi-docker
context: hazoi-docker
image=opennmt_docker:
image: opennmt-docker
context: opennmt-docker
job=zunpi-ngiliau: # 準備語料
use: opennmt_docker
command: |
bash -eux -c '
onmt_build_vocab -config tin.yaml -n_sample -1
'
mounts: [doncii_ngiliau, opennmt_data]
job=hiunlien: # 訓練
use: opennmt_docker
command: |
bash -eux -c '
onmt_train -config tin.yaml
'
mounts: [doncii_ngiliau, opennmt_data, opennmt_model]
job=fan:
use: opennmt_docker
command: |
bash -eux -c '
echo "我 打 籃 球 時 手 扭 傷 , 醫 生 說 要 打 石 膏 。" >> fa.txt
echo "黃 槿 樹 的 葉 子 , 一 片 差 不 多 手 掌 一 般 大 。" >> fa.txt
onmt_translate -model /model/fameu_step_3000.pt -src fa.txt -output pred-meu.txt -replace_unk -verbose
cat pred-meu.txt
'
mounts: [opennmt_data, opennmt_model]
image=bleu_docker:
image: bleu-docker
context: bleu-docker
alias=bleu:
tasks: [bleu-fan, bleu-son, ]
job=bleu-fan:
use: opennmt_docker
env:
- STEP={env.STEP:3000}
command: |
bash -eux -c '
onmt_translate -model /model/fameu_step_$STEP.pt \
-src /doncii-ngiliau/fa.valid \
-output /bleu/meu.$STEP.pred \
-replace_unk
head /bleu/meu.$STEP.pred
'
mounts: [doncii_ngiliau, bleu_data, opennmt_model]
alias=bleu-dict:
tasks: [dict-sadtin, bleu-fan-dict, bleu-son, ]
env=dict-sadtin:
variables:
- STEP=dict
job=bleu-son:
use: bleu_docker
env:
- STEP={env.STEP:3000}
command: |
bash -eux -c '
perl multi-bleu-detok.perl \
/doncii-ngiliau/meu.valid \
< /bleu/meu.$STEP.pred
'
mounts: [doncii_ngiliau, bleu_data]
job=bleu-fan-dict:
use: bleu_docker
command: |
bash -eux -c '
python fanid_dict.py /doncii-ngiliau/fa.valid meu.dict.pred
cat meu.dict.pred | sed "s/\(.\)/\1 /g" \
> /bleu/meu.dict.pred
head /bleu/meu.dict.pred
'
mounts: [doncii_ngiliau, bleu_data, ]