-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtrain_vb.sh
executable file
·61 lines (47 loc) · 1.85 KB
/
train_vb.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
export CUDA_VISIBLE_DEVICES='1,9'
stage=2
task="vocoder" #"vocoder" or "se"
model_name="voicebank_model_vocoder_traindev"
# pretrain_model="voicebank_model_vocoder/weights-253050.pt"
# fix="--fix_in"
. ./path.sh
voicebank_noisy="${voicebank}/noisy_trainset_28spk_wav_16k"
voicebank_clean="${voicebank}/clean_trainset_28spk_wav_16k"
if [[ ! " se vocoder " =~ " $task " ]]; then
echo "Error: \$task must be either se or vocoder: ${task}"
exit 1;
fi
if [[ "$task" == "se" ]]; then
wav_root=${voicebank_noisy}
spec_root=${diffwave}/spec/voicebank_Noisy
spec_type="noisy spectrum"
elif [[ "$task" == "vocoder" ]]; then
wav_root=${voicebank_clean}
spec_root=${diffwave}/spec/voicebank_Clean
spec_type="clean Mel-spectrum"
fi
if [ ${stage} -le 1 ]; then
echo "stage 1 : preparing training data"
wave_path=${wav_root}
echo "create ${spec_type} from ${wave_path} to ${spec_root}"
rm -r ${spec_root} 2>/dev/null
mkdir -p ${spec_root}
python src/diffwave/preprocess.py ${wave_path} ${spec_root} --${task} --voicebank
mkdir -p ${spec_root}/train
mkdir -p ${spec_root}/valid
mv ${spec_root}/p226_*.wav.spec.npy ${spec_root}/valid
mv ${spec_root}/p287_*.wav.spec.npy ${spec_root}/valid
mv ${spec_root}/*.wav.spec.npy ${spec_root}/train
fi
if [ ${stage} -le 2 ]; then
echo "stage 2 : training model"
target_wav_root=${voicebank_clean}
train_spec_list=""
spec_path=${spec_root}/train
train_spec_list="${train_spec_list} ${spec_path}"
if [ -z "$pretrain_model" ]; then
python src/diffwave/__main__.py ${diffwave}/${model_name} ${target_wav_root} ${train_spec_list} --${task} ${fix} --voicebank
else
python src/diffwave/__main__.py ${diffwave}/${model_name} ${target_wav_root} ${train_spec_list} --${task} --pretrain ${diffwave}/${pretrain_model} ${fix} --voicebank
fi
fi