-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
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
NeMo/nemo/core/classes/exportable.py
Line 226 in b6547c3
| dynamic_axes = self.dynamic_shapes_for_export(use_dynamo) |
Thus, the line
NeMo/nemo/core/classes/exportable.py
Line 272 in b6547c3
| 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.