-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
147 lines (125 loc) · 3.2 KB
/
run.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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# stage settings
stage=r123
# speakers to train
all_spks=(jvs001 jvs002)
# directories
wav_dir=wav
figure_dir=figure
data_dir=data
model_dir=model
exp_dir=exp
# wav and extract info
fs=24000
shiftms=5
mcep_dim=49
fftl=1024
# training related
model_name=test_model
# number of cpus
n_jobs=16
. parse_options.sh
#####################################
############# stage -1 ##############
# stage -1
# remove dataset that exists.
if echo ${stage} | grep -q r; then
rm -r ./log/*
rm -r ./data/train/*
rm -r ./data/val/*
rm -r data/stats/*
fi
#####################################
############# stage 0 ###############
# stage 0
# build histgram of the f0 and npow.
if echo ${stage} | grep -q 0; then
echo ${all_spks[@]}
for spk in ${all_spks[@]}; do
echo Processing ${spk}
# directory
mkdir -p ${figure_dir}/${spk}
# process
python src/prepro/create_hist.py \
--n_jobs ${n_jobs} \
--wav_dir ${wav_dir}/train/${spk} \
--figure_dir ${figure_dir}/${spk}
done
fi
#####################################
############ stage 1 ################
# data preprocessing
if echo ${stage} | grep -q 1; then
# exp directory
mkdir -p ${exp_dir}/extract
for spk in ${all_spks[@]}; do
# train directory
mkdir -p ${data_dir}/train/${spk}
# val directory
mkdir -p ${data_dir}/val/${spk}
# training data
python src/prepro/extract_feature.py \
--log_dir ${exp_dir}/extract \
--wav_dir ${wav_dir}/train/${spk} \
--hdf5dir ${data_dir}/train/${spk} \
--conf_path ./config/speaker/${spk}.conf \
--fs ${fs} \
--shiftms ${shiftms} \
--mcep_dim ${mcep_dim} \
--fftl ${fftl} \
--n_jobs ${n_jobs}
# val data
python src/prepro/extract_feature.py \
--log_dir ${exp_dir}/extract \
--wav_dir ${wav_dir}/val/${spk} \
--hdf5dir ${data_dir}/val/${spk} \
--conf_path ./config/speaker/${spk}.conf \
--fs ${fs} \
--shiftms ${shiftms} \
--fs ${fs} \
--shiftms ${shiftms} \
--mcep_dim ${mcep_dim} \
--fftl ${fftl} \
--n_jobs ${n_jobs}
done
# calc total stats
mkdir -p ${data_dir}/stats
python src/prepro/calc_stats.py \
--hdf5_dir ${data_dir}/train \
--stats_dir ${data_dir}/stats
fi
######################################
############ stage 2 ################@
# training
if echo ${stage} | grep -q 2; then
mkdir -p ${model_dir}
python src/train.py \
--train_dir ${data_dir}/train \
--val_dir ${data_dir}/val \
--stats_dir ${data_dir}/stats \
--total_stats ${data_dir}/total_stats.h5 \
--conf_path ./config/vc.conf \
--model_dir ${model_dir} \
--model_name ${model_name} \
--decode_dir ${exp_dir}/${model_name} \
--log_name ${model_name}
#--resume ${model_dir}/${model_name}.5507.pt
fi
######################################
############ stage 3 ################3
# decode
if echo ${stage} | grep -q 3; then
decode_dir=${exp_dir}/${model_name}
mkdir -p ${decode_dir}
python src/decode.py \
--test_dir ${data_dir}/val \
--exp_dir ${decode_dir} \
--stats_dir ${data_dir}/stats \
--conf_path ./config/vc.conf \
--checkpoint ${model_dir}/${model_name}.1448.pt \
--log_name ${model_name} \
--fs ${fs} \
--shiftms ${shiftms} \
--mcep_dim ${mcep_dim} \
--fftl ${fftl}
fi