Skip to content

dynamic_shapes error when exporting Parakeet models to ONNX #15040

@jingzhaoou

Description

@jingzhaoou

I tried to export the Parakeet nemo model to ONNX files. My code is like

self.model.export(str(model_onnx_path))

It was working a while back but with the latest NeMo, I ran into the following error

[NeMo W 2025-11-07 05:06:37 nemo_logging:405] /usr/local/lib/python3.12/dist-packages/nemo/core/classes/exportable.py:264: UserWarning: # 'dynamic_axes' is not recommended when dynamo=True, and may lead to 'torch._dynamo.exc.UserError: Constraints violated.' Supply the 'dynamic_shapes' argument instead if export is unsuccessful.

After some debugging, I think there is some bug with the latest code. dynamic_axes is actually dynamic_shapes according to the following code

dynamic_axes = self.dynamic_shapes_for_export(use_dynamo)

Thus, the line

dynamic_axes=dynamic_axes,

should look like

if dynamic_axes is None:
    dynamic_axes = self.dynamic_shapes_for_export(use_dynamo=True)
......
torch.onnx.export(
   dynamic_shapes=dynamic_axes,
)

After changing the code, I was able to export the ONNX files as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions