chenyangMl / keyword-spot

端到端语音唤醒工具箱,从模型训练到模型推理。
MIT License
73 stars 10 forks source link

按CTC方案训练出来的自定义关键词模型是否无法进行转换 #5

Open lin-xiaosheng opened 4 months ago

lin-xiaosheng commented 4 months ago

使用文档中以下内容进行训练 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".

renshujiajia commented 1 month ago

同问,这个转失败了