Skip to content

how to export onnx from pt model? #12

Open

Description

@aa851182472

I already have the pt file and need to perform inference using TensorRT. How can I convert it to ONNX?

Activity

  1. cherubicXN commented on Feb 8, 2026

    @cherubicXN
    Collaborator

    Hi @aa851182472,

    This should be straightforward, as it mainly involves converting the Vision Transformer to ONNX. We plan to look into this in the near future, and we’d also welcome a pull request if you have a better implementation.

    Thank you for your question.

  2. dycoene03 commented on Feb 25, 2026

    @dycoene03

    I +1 this! I tried converting to ONNX myself but kept running into problems. The main problems were relating to xformers / flash attention. When I got a working ONNX after some monkey-patching, inference went from sub 2 seconds to 15 seconds, so I'm sure I did something wrong. I would like to run this model on a Triton server.

  3. JeonHyeongJunKW commented on Mar 18, 2026

    @JeonHyeongJunKW

    Hi @cherubicXN

    I wanted to share my experience with this model. First of all, the depth completion performance is absolutely amazing! I tested it in a PyTorch environment across various challenging outdoor conditions (e.g., marble floors, water puddles, daytime, and nighttime), and the refinement results were highly accurate.

    However, I ran into significant roadblocks when trying to export the model to ONNX for deployment. Initially, the ONNX export failed completely because of the dynamically changing number of input depth tokens.

    To work around this, I modified the code to use a fixed maximum number of tokens with padding and managed to compile a TensorRT engine. Unfortunately, this approach resulted in increased latency. Furthermore, the inference quality noticeably degraded, particularly in regions where the input depth map had missing values (empty pixels).

    For future releases, it would be incredibly helpful if the model size could be scaled down (e.g., lighter backbone) and if the architecture could be made more ONNX-friendly (such as supporting static graphs without dynamic token masking).

    Thanks for the great work!

  4. Beauhowe commented on Aug 25, 2026

    @Beauhowe

    你好@cherubicXN

    我想分享一下我使用这个模型的经验。首先,它的深度补全性能简直太棒了!我在 PyTorch 环境下,在各种复杂的户外条件下(例如大理石地面、水坑、白天和夜晚)进行了测试,深度补全的结果非常准确。

    然而,在尝试将模型导出为 ONNX 格式进行部署时,我遇到了很大的困难。最初,由于输入深度标记的数量动态变化,ONNX 导出完全失败。

    为了解决这个问题,我修改了代码,使用固定的最大标记数并进行填充,成功编译了 TensorRT 引擎。然而,这种方法导致延迟增加。此外,推理质量明显下降,尤其是在输入深度图存在缺失值(空像素)的区域。

    对于未来的版本,如果能够缩小模型尺寸(例如,更轻量级的主干网),并且使架构更符合 ONNX 标准(例如,支持没有动态令牌掩码的静态图),将会非常有帮助。

    感谢你们的辛勤工作!

    How is it performing now? I'm planning to convert it to ONNX format as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions