得到的模型config.yaml与进行转换的config.yaml格式不一致,修改后进行转换则报错,报错如下
Traceback (most recent call last):
File "/root/autodl-tmp/keyword-spot/model_convert/export_onnx.py", line 110, in
main()
File "/root/autodl-tmp/keyword-spot/model_convert/export_onnx.py", line 58, in main
load_checkpoint(model, args.checkpoint)
File "/root/autodl-tmp/keyword-spot/model_convert/utils/checkpoint.py", line 31, in load_checkpoint
model.load_state_dict(checkpoint)
File "/root/miniconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2189, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for KWSModel:
Missing key(s) in state_dict: "classifier.linear.weight", "classifier.linear.bias".
Unexpected key(s) in state_dict: "global_cmvn.mean", "global_cmvn.istd".
使用文档中以下内容进行训练 git clone https://www.modelscope.cn/iic/speech_charctc_kws_phone-xiaoyun.git cd unittest/ CUDA_VISIBLE_DEVICES=0 python example_kws.py
使用以下命令进行转换 python model_convert/export_onnx.py \ --config models/test_kws_training/config.yaml \ --checkpoint models/test_kws_training/avg_10.pt \ --onnx_model models/test_kws_training/onnx/keyword_spot_fsmn_ctc_danadana.onnx
得到的模型config.yaml与进行转换的config.yaml格式不一致,修改后进行转换则报错,报错如下 Traceback (most recent call last): File "/root/autodl-tmp/keyword-spot/model_convert/export_onnx.py", line 110, in
main()
File "/root/autodl-tmp/keyword-spot/model_convert/export_onnx.py", line 58, in main
load_checkpoint(model, args.checkpoint)
File "/root/autodl-tmp/keyword-spot/model_convert/utils/checkpoint.py", line 31, in load_checkpoint
model.load_state_dict(checkpoint)
File "/root/miniconda3/envs/kws/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2189, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for KWSModel:
Missing key(s) in state_dict: "classifier.linear.weight", "classifier.linear.bias".
Unexpected key(s) in state_dict: "global_cmvn.mean", "global_cmvn.istd".