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

have a ready-made onnx file? #159

Open
zmoth opened this issue May 1, 2024 · 3 comments
Open

have a ready-made onnx file? #159

zmoth opened this issue May 1, 2024 · 3 comments

Comments

@zmoth
Copy link

zmoth commented May 1, 2024

有现成的onnx文件吗?类似于wespeaker在huggingface上的。我使用魔搭社区上面的pt模型一直转换失败.

Traceback (most recent call last):
  File "wekws/bin/export_onnx.py", line 103, in <module>
    main()
  File "wekws/bin/export_onnx.py", line 51, in main
    load_checkpoint(model, args.checkpoint)
  File "/Users/moth/proj/voice/wekws/wekws/utils/checkpoint.py", line 30, in load_checkpoint
    checkpoint = torch.load(path, map_location='cpu')
  File "/Users/moth/proj/voice/wekws/.conda/lib/python3.8/site-packages/torch/serialization.py", line 1040, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/Users/moth/proj/voice/wekws/.conda/lib/python3.8/site-packages/torch/serialization.py", line 1262, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.
@mlxu995
Copy link
Collaborator

mlxu995 commented May 1, 2024

@zmoth 方便的话发一下你转 onnx 失败的 pt 的地址

@zmoth
Copy link
Author

zmoth commented May 1, 2024

在WIndows WSL和macOS上都是这个结果,使用miniconda,python=3.8.19 ,macOS上pytorch=2.3.0,torchaudio=2.3.0,WSL是按照README环境安装的。

https://www.modelscope.cn/studios/thuduj12/KWS_Nihao_Xiaojing

使用的是run_fsmn_ctc.sh

./run_fsmn_ctc.sh 4 4
checkpoint=
dir=exp/KWS_Nihao_Xiaojing/model/hixiaowen
average_model=true
num_average=30
if $average_model ;then
  score_checkpoint=$dir/avg_${num_average}.pt
else
  score_checkpoint=$dir/final.pt
fi

download_dir=./data/local # your data dir

其实上面的模型我都尝试过,有些是bin文件不知道怎么转换,还有的(https://www.modelscope.cn/iic/speech_charctc_kws_phone-xiaoyun)报错是

Traceback (most recent call last):
  File "wekws/bin/export_onnx.py", line 103, in <module>
    main()
  File "wekws/bin/export_onnx.py", line 42, in main
    feature_dim = configs['model']['input_dim']
KeyError: 'model'

@mlxu995
Copy link
Collaborator

mlxu995 commented May 6, 2024

ctc loss 的模型暂时还没有支持导出 onnx 和 c++ 推理,你可以先试试 maxpooling loss 的模型

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