zhifu gao
2024-09-25 2196844d1d6e5b8732c95896bb46f0eacdd9cf9d
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
 
workspace=`pwd`
 
# download model
local_path_root=${workspace}/modelscope_models
mkdir -p ${local_path_root}
 
local_path=${local_path_root}/speech_charctc_kws_phone-xiaoyun
if [ ! -d "$local_path" ]; then
    git clone https://www.modelscope.cn/iic/speech_charctc_kws_phone-xiaoyun.git ${local_path}
fi
 
export PATH=${local_path}/runtime:$PATH
export LD_LIBRARY_PATH=${local_path}/runtime:$LD_LIBRARY_PATH
 
# finetune config file
config=./conf/fsmn_4e_l10r2_280_200_fdim40_t2602_t4.yaml
 
# finetune output checkpoint
torch_nnet=exp/finetune_outputs/model.pt.avg10
 
out_dir=exp/finetune_outputs
 
if [ ! -d "$out_dir" ]; then
    mkdir -p $out_dir
fi
 
python convert.py --config $config \
    --network_file $torch_nnet \
    --model_dir $out_dir \
    --model_name "convert.kaldi.txt" \
    --model_name2 "convert.kaldi2.txt" \
    --convert_to kaldi
 
nnet-copy --binary=true ${out_dir}/convert.kaldi.txt ${out_dir}/convert.kaldi.net
nnet-copy --binary=true ${out_dir}/convert.kaldi2.txt ${out_dir}/convert.kaldi2.net