Skip to content

Failed to export to ONNX #176

@BlankHead2004

Description

@BlankHead2004

This is a short error log. Can't give full due to excessive length.

Exception summary

<class 'torch.fx.experimental.symbolic_shapes.GuardOnDataDependentSymNode'>: Could not extract specialized integer from data-dependent expression u0 (unhinted: u0). (Size-like symbols: none)

Caused by: (_export/non_strict_utils.py:1066 in torch_function)
For more information, run with TORCH_LOGS="dynamic"
For extended logs when we create symbols, also add TORCHDYNAMO_EXTENDED_DEBUG_CREATE_SYMBOL="u0"
If you suspect the guard was triggered from C++, add TORCHDYNAMO_EXTENDED_DEBUG_CPP=1
For more debugging help, see https://docs.google.com/document/d/1HSuTTVvYH1pTew89Rtpeu84Ht3nQEFTYhAX3Ypa_xJs/edit?usp=sharing

For C++ stack trace, run with TORCHDYNAMO_EXTENDED_DEBUG_CPP=1

The following call raised this error:
File "/usr/local/lib/python3.12/dist-packages/mobile_sam/utils/onnx.py", line 85, in mask_postprocessing
masks = masks[..., : prepadded_size[0], : prepadded_size[1]] # type: ignore

The error above occurred when calling torch.export.export. If you would like to view some more information about this error, and get a list of all other errors that may occur in your export call, you can replace your export() call with draft_export().

(Refer to the full stack trace above for more information.)

Followed the steps still encountered this error.
I am using Google Colab for the runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions