-
Notifications
You must be signed in to change notification settings - Fork 25
/
train_w_mono.sh
executable file
·56 lines (45 loc) · 1.12 KB
/
train_w_mono.sh
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
#!/usr/bin/env bash
# repo_dir: root directory of the project
repo_dir="$( cd "$( dirname "$0" )" && pwd )"
echo "==== Working directory: ====" >&2
echo "${repo_dir}" >&2
echo "============================" >&2
main_config=$1
source ${repo_dir}/scripts/load_config.sh ${main_config} ${repo_dir}
model_dir=${repo_dir}/model
data_dir=${repo_dir}/data
mkdir -p ${model_dir} ${data_dir}/mono
# parallel data
data_var=data_1
i=1
data=""
while [[ ! -z ${!data_var} ]]; do
if [[ $data == "" ]]; then
data=${!data_var}
else
data=$data:${!data_var}
fi
i=$((i+1))
data_var=data_$i
done
# mono data
mono_data_var=data_mono_1
y=1
mono_data=""
while [[ ! -z ${!mono_data_var} ]]; do
if [[ ${mono_data} == "" ]]; then
mono_data=${!mono_data_var}
else
mono_data=${mono_data}:${!mono_data_var}
fi
y=$((y+1))
mono_data_var=data_mono_$y
done
command="CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES} fairseq-train ${data} \
--user-dir ${repo_dir}/mcolt \
--save-dir ${model_dir} \
--mono-data ${mono_data} \
${options} \
--ddp-backend no_c10d 1>&2"
echo $command
eval $command