KwaiVGI / LivePortrait

Bring portraits to life!
https://liveportrait.github.io
Other
8.53k stars 795 forks source link

【Request feature】ONNX export support ? #86

Closed juntaosun closed 2 weeks ago

juntaosun commented 2 weeks ago

pretrained_weights/ Who can support exporting .pth to onnx ?

pretrained_weights ├── insightface │ └── models │ └── buffalo_l │ ├── 2d106det.onnx │ └── det_10g.onnx └── liveportrait ├── base_models │ ├── appearance_feature_extractor.pth 👈✅ │ ├── motion_extractor.pth 👈✅ │ ├── spade_generator.pth 👈 │ └── warping_module.pth 👈 ├── landmark.onnx └── retargeting_models └── stitching_retargeting_module.pth 👈

I encountered some errors are: OnnxExporterError: Unsupported: ONNX export of operator GridSample with 5D volumetric input. Unable to complete export~

zzzweakman commented 2 weeks ago

Thank you for your attention! You can download the nightly version of pytorch to export the .pth model to ONNX format. You can find more details here. However, unfortunately, based on our previous attempts, the GridSample operation is still not supported by the CPUExecutionProvider in the latest version of onnxruntime-gpu, thus inference acceleration might not be possible at this time. @juntaosun

zzzweakman commented 2 weeks ago

We also attempted to export the model to TRT format but encountered similar issues. Resolving these problems likely requires expertise in CUDA or model deployment, which is beyond our current capabilities. We hope this clarifies your question :) @juntaosun

Additionally, we hope someone can address this issue, as it would significantly improve the inference speed of the project.

galigaligo commented 2 weeks ago

同样导出时遇到了torch.onnx.errors.OnnxExporterError: Unsupported: ONNX export of operator GridSample with 5D volumetric input. 的问题,据说opset_version=20解决了此问题,但更新后,仍然无法导出成功。 torch.onnx.OnnxExporterError: Failed to export the model to ONNX. Generating SARIF report at 'report_dynamo_export.sarif'

juntaosun commented 2 weeks ago

We also attempted to export the model to format but encountered similar issues. Resolving these problems likely requires expertise in CUDA or model deployment, which is beyond our current capabilities. We hope this clarifies your question :) @juntaosunTRT

Additionally, we hope someone can address this issue, as it would significantly improve the inference speed of the project.

@zzzweakman https://github.com/KwaiVGI/LivePortrait/issues/76#issuecomment-2222338382

@aihacker111 motion_extractor.onnx appearance_feature_extractor.onnx

juntaosun commented 2 weeks ago

Solved

https://github.com/KwaiVGI/LivePortrait/issues/126#issue-2405426585