Skip to content

[BUG] - No module named 'onnxscript._framework_apis.torch_2_7' against PyTorch 2.7 #3297

Closed
@svekars

Description

@svekars

Add Link

https://pytorch.org/tutorials/beginner/onnx/onnx_registry_tutorial.html
https://pytorch.org/tutorials/beginner/onnx/export_control_flow_model_to_onnx_tutorial.html

Describe the bug

The tutorials are failing with the following error:

Unexpected failing examples:
/var/lib/workspace/beginner_source/onnx/onnx_registry_tutorial.py failed leaving traceback:
Traceback (most recent call last):
  File "/var/lib/workspace/beginner_source/onnx/onnx_registry_tutorial.py", line 99, in <module>
    onnx_program = torch.onnx.export(
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/__init__.py", line 364, in export
    return _compat.export_compat(
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/_internal/exporter/_compat.py", line 109, in export_compat
    registry = _registration.ONNXRegistry.from_torchlib()
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/_internal/exporter/_registration.py", line 164, in from_torchlib
    torchlib_ops = onnxscript_apis.get_torchlib_ops()
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/_internal/_lazy_import.py", line 21, in __getattr__
    self._module = importlib.import_module(".", self._name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'onnxscript._framework_apis.torch_2_7'

and this:

Unexpected failing examples:
/var/lib/workspace/beginner_source/onnx/export_control_flow_model_to_onnx_tutorial.py failed leaving traceback:
Traceback (most recent call last):
  File "/var/lib/workspace/beginner_source/onnx/export_control_flow_model_to_onnx_tutorial.py", line 109, in <module>
    onnx_program = torch.onnx.export(model, (x,), dynamo=True)
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/__init__.py", line 364, in export
    return _compat.export_compat(
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/_internal/exporter/_compat.py", line 109, in export_compat
    registry = _registration.ONNXRegistry.from_torchlib()
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/_internal/exporter/_registration.py", line 164, in from_torchlib
    torchlib_ops = onnxscript_apis.get_torchlib_ops()
  File "/var/lib/ci-user/.local/lib/python3.10/site-packages/torch/onnx/_internal/_lazy_import.py", line 21, in __getattr__
    self._module = importlib.import_module(".", self._name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'onnxscript._framework_apis.torch_2_7'

build log

Please submit fixes against the 2.7-RC-TEST branch and enable in .jenkins/validate_tutorials_built.py.

Describe your environment

  • CUDA: 12.6
  • PyTorch: 2.7

cc @xadupre

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.7bugonnxIssues relating to ONNX

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions