Skip to content

Conversation

@Kukanani
Copy link

This is a follow-up fix based on an mjlab issue: mujocolab/mjlab#230

According to the pytorch docs (https://docs.pytorch.org/docs/stable/onnx_export.html), onnx export depends on onnxscript being installed. In PyTorch 2.9, the export behavior now defaults to torch.export instead of torch.onnx, which is a codepath that imports onnxscript eagerly, now requiring an explicit dependency. An alternative is to set dynamo=False on onnx export, but this is not recommended by PyTorch release notes (https://github.com/pytorch/pytorch/releases/tag/v2.9.0)

According to the pytorch docs (https://docs.pytorch.org/docs/stable/onnx_export.html),
onnx export depends on onnxscript being installed. In PyTorch 2.9, the export behavior
now defaults to torch.export instead of torch.onnx, which is a codepath that imports
onnxscript eagerly. An alternative is to set dynamo=False on onnx export, but
this is not recommended by PyTorch release notes.

https://github.com/pytorch/pytorch/releases/tag/v2.9.0
@Kukanani
Copy link
Author

(note that onnxscript 0.4.0 is the version used in pytorch, see https://github.com/pytorch/pytorch/blob/8aa465f18e962fbb35eead029122cc564ed9d400/.ci/docker/common/install_onnx.sh#L23)

@ClemensSchwarke
Copy link
Collaborator

Hey @Kukanani, the file you linked shows torchscript 0.5.4. Do you think it makes sense to set 0.4.0 as a minimum requirement instead of a hard constraint?

@ClemensSchwarke
Copy link
Collaborator

Also, do we need a different license for this?

@Kukanani
Copy link
Author

Between making the change and permalinking the code, it was updated via pytorch/pytorch#165883 to 0.5.4! So yes, that should be the correct version now.

@Kukanani
Copy link
Author

onnxscript is MIT licensed, which is BSD 3-clause compatible, so I think no licensing changes are needed.

@ClemensSchwarke
Copy link
Collaborator

Hi @Kukanani, I added the license and opened a PR in your fork.

>=0.5.4 to pick up future changes, but <1.0 to prevent future breaking changes
@Kukanani
Copy link
Author

Kukanani commented Nov 4, 2025

I merged your MR that targeted mine

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants