wenet-e2e / wespeaker

Research and Production Oriented Speaker Verification, Recognition and Diarization Toolkit
Apache License 2.0
664 stars 112 forks source link

关于RepVGG模型转onnx #208

Closed axuan731 closed 10 months ago

axuan731 commented 10 months ago

您好: 我发现RepVGG由于结构重参数化与其他pt模型转onnx不太一样, 请问如何实现RepVGG结构重参数化之后转onnx? 谢谢

cdliang11 commented 10 months ago

https://github.com/wenet-e2e/wespeaker/blob/c9ec537b53fe1e04525be74b2550ee95bed3a891/examples/voxceleb/v2/run.sh#L80-L87

可以参考run.sh里这一步,convert_model.pt是已经重参数化之后的直筒型结构,直接用该模型导出onnx即可

axuan731 commented 10 months ago

https://github.com/wenet-e2e/wespeaker/blob/c9ec537b53fe1e04525be74b2550ee95bed3a891/examples/voxceleb/v2/run.sh#L80-L87

可以参考run.sh里这一步,convert_model.pt是已经重参数化之后的直筒型结构,直接用该模型导出onnx即可

感谢您的回复,我没有表达清楚,我已经转换成了直筒型结构的模型,导出onnx需要直筒型模型的网络,但是repvgg.py不是直筒型的网络。

cdliang11 commented 10 months ago

https://github.com/wenet-e2e/wespeaker/blob/c9ec537b53fe1e04525be74b2550ee95bed3a891/examples/voxceleb/v2/run.sh#L80-L87

可以参考run.sh里这一步,convert_model.pt是已经重参数化之后的直筒型结构,直接用该模型导出onnx即可

感谢您的回复,我没有表达清楚,我已经转换成了直筒型结构的模型,导出onnx需要直筒型模型的网络,但是repvgg.py不是直筒型的网络。

只需要在配置文件中加入configs['model_args']['deploy'] = True参数,就能得到直筒型的结构。 run.sh中调用wespeaker/models/convert_repvgg.py导出的直筒型结构模型,并且在配置文件中写入configs['model_args']['deploy'] = True这个参数,详细如下: https://github.com/wenet-e2e/wespeaker/blob/c9ec537b53fe1e04525be74b2550ee95bed3a891/wespeaker/models/convert_repvgg.py#L25-L34

axuan731 commented 10 months ago

非常感谢~