Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lin-xiaosheng opened this issue Jun 27, 2024 · 1 comment

Comments

@lin-xiaosheng
Copy link

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

同问,这个转失败了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants