FunASR/egs_modelscope/asr/uniasr/speech_UniASR_asr_2pass-minnan-16k-common-vocab3825
2023-05-23 16:25:25 +08:00
..
demo.py update infer recipe 2023-04-25 16:15:45 +08:00
finetune.py add minnan uniasr model recipe 2023-02-09 15:25:11 +08:00
infer.py update infer recipe 2023-04-25 16:15:45 +08:00
infer.sh update infer recipe 2023-04-25 18:58:00 +08:00
README.md update 2023-03-16 11:14:42 +08:00
utils update infer recipe 2023-04-25 18:58:00 +08:00

ModelScope Model

How to finetune and infer using a pretrained UniASR Model

Finetune

  • Modify finetune training related parameters in finetune.py

    • output_dir: # result dir
    • data_dir: # the dataset dir needs to include files: train/wav.scp, train/text; validation/wav.scp, validation/text
    • dataset_type: # for dataset larger than 1000 hours, set as large, otherwise set as small
    • batch_bins: # batch size. For dataset_type is small, batch_bins indicates the feature frames. For dataset_type is large, batch_bins indicates the duration in ms
    • max_epoch: # number of training epoch
    • lr: # learning rate
  • Then you can run the pipeline to finetune with:

    python finetune.py

Inference

Or you can use the finetuned model for inference directly.

  • Setting parameters in infer.py

    • data_dir: # the dataset dir needs to include test/wav.scp. If test/text is also exists, CER will be computed
    • output_dir: # result dir
    • ngpu: # the number of GPUs for decoding
    • njob: # the number of jobs for each GPU
  • Then you can run the pipeline to infer with:

    python infer.py
  • Results

The decoding results can be found in $output_dir/1best_recog/text.cer, which includes recognition results of each sample and the CER metric of the whole test set.

Inference using local finetuned model

  • Modify inference related parameters in infer_after_finetune.py

    • output_dir: # result dir
    • data_dir: # the dataset dir needs to include test/wav.scp. If test/text is also exists, CER will be computed
    • decoding_model_name: # set the checkpoint name for decoding, e.g., valid.cer_ctc.ave.pb
  • Then you can run the pipeline to finetune with:

    python infer_after_finetune.py
  • Results

The decoding results can be found in $output_dir/decoding_results/text.cer, which includes recognition results of each sample and the CER metric of the whole test set.