| | |
| | | #!/usr/bin/env bash |
| | | |
| | | workspace=`pwd` |
| | | |
| | | # machines configuration |
| | | |
| | | CUDA_VISIBLE_DEVICES="0,1" |
| | | gpu_num=2 |
| | | gpu_inference=true # Whether to perform gpu decoding, set false for cpu decoding |
| | | # for gpu decoding, inference_nj=ngpu*njob; for cpu decoding, inference_nj=njob |
| | | njob=1 |
| | | |
| | | # general configuration |
| | | feats_dir="../DATA" #feature output dictionary |
| | |
| | | stop_stage=5 |
| | | |
| | | # feature configuration |
| | | nj=64 |
| | | nj=32 |
| | | |
| | | inference_device="cuda" #"cpu" |
| | | inference_checkpoint="model.pt" |
| | | inference_scp="wav.scp" |
| | | |
| | | # data |
| | | raw_data=../raw_data |
| | |
| | | |
| | | # exp tag |
| | | tag="exp1" |
| | | workspace=`pwd` |
| | | |
| | | . utils/parse_options.sh || exit 1; |
| | | |
| | |
| | | config=train_asr_paraformer_conformer_12e_6d_2048_256.yaml |
| | | model_dir="baseline_$(basename "${config}" .yaml)_${lang}_${token_type}_${tag}" |
| | | |
| | | inference_device="cuda" #"cpu" |
| | | inference_checkpoint="model.pt" |
| | | inference_scp="wav.scp" |
| | | |
| | | |
| | | |
| | | if [ ${stage} -le -1 ] && [ ${stop_stage} -ge -1 ]; then |
| | | echo "stage -1: Data Download" |
| | | mkdir -p ${raw_data} |
| | | local/download_and_untar.sh ${raw_data} ${data_url} data_aishell |
| | | local/download_and_untar.sh ${raw_data} ${data_url} resource_aishell |
| | | fi |
| | |
| | | |
| | | if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then |
| | | echo "stage 1: Feature and CMVN Generation" |
| | | # utils/compute_cmvn.sh --fbankdir ${feats_dir}/data/${train_set} --cmd "$train_cmd" --nj $nj --feats_dim ${feats_dim} --config_file "$config" --scale 1.0 |
| | | python ../../../funasr/bin/compute_audio_cmvn.py \ |
| | | --config-path "${workspace}" \ |
| | | --config-path "${workspace}/conf" \ |
| | | --config-name "${config}" \ |
| | | ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ |
| | | ++cmvn_file="${feats_dir}/data/${train_set}/cmvn.json" \ |
| | |
| | | if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then |
| | | echo "stage 4: ASR Training" |
| | | |
| | | mkdir -p ${exp_dir}/exp/${model_dir} |
| | | log_file="${exp_dir}/exp/${model_dir}/train.log.txt" |
| | | echo "log_file: ${log_file}" |
| | | |
| | | gpu_num=$(echo CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}') |
| | | torchrun \ |
| | | --nnodes 1 \ |
| | | --nproc_per_node ${gpu_num} \ |
| | | ../../../funasr/bin/train.py \ |
| | | --config-path "${workspace}" \ |
| | | --config-path "${workspace}/conf" \ |
| | | --config-name "${config}" \ |
| | | ++train_data_set_list="${feats_dir}/data/${train_set}/audio_datasets.jsonl" \ |
| | | ++valid_data_set_list="${feats_dir}/data/${valid_set}/audio_datasets.jsonl" \ |
| | | ++tokenizer_conf.token_list="${token_list}" \ |
| | | ++frontend_conf.cmvn_file="${feats_dir}/data/${train_set}/am.mvn" \ |
| | | ++output_dir="${exp_dir}/exp/${model_dir}" &> ${log_file} |