编辑 | blame | 历史 | 原始文档

ModelScope Model

How to finetune and infer using a pretrained Paraformer-large 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.
    • batch_bins: # batch size
    • max_epoch: # number of training epoch
    • lr: # learning rate
  • Then you can run the pipeline to finetune with:
    python python finetune.py

Inference

Or you can use the finetuned model for inference directly.

  • Setting parameters in infer.py

    • audio_in: # support wav, url, bytes, and parsed audio format.
    • output_dir: # If the input format is wav.scp, it needs to be set.
  • Then you can run the pipeline to infer with:
    python python infer.py

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 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.