Skip to content

Fix _to_model_proto after protobuf update#2789

Closed
xadupre wants to merge 1 commit intomainfrom
xadupre/assignment
Closed

Fix _to_model_proto after protobuf update#2789
xadupre wants to merge 1 commit intomainfrom
xadupre/assignment

Conversation

@xadupre
Copy link
Member

@xadupre xadupre commented Feb 2, 2026

No description provided.

@codecov
Copy link

codecov bot commented Feb 2, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
13681 2 13679 1417
View the full list of 2 ❄️ flaky test(s)
onnxscript.tools.transformers_models.phi_test.TestExportPhi::test_phi_export_cpu

Flake rate in main: 97.22% (Passed 19 times, Failed 665 times)

Stack Traces | 15.2s run time
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:250: in call
    pass_result = pass_(model)
                  ^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:127: in __call__
    result = self.call(model)
             ^^^^^^^^^^^^^^^^
onnxscript/version_converter/__init__.py:77: in call
    raise ValueError(
E   ValueError: The model contains functions. The version conversion pass does not support functions. Please use `common_passes.InlinePass` to inline the functions before applying this pass (_ConvertVersionPassRequiresInline).

The above exception was the direct cause of the following exception:
onnxscript/_internal/version_utils.py:94: in call_f
    return fct(self)
           ^^^^^^^^^
.../tools/transformers_models/phi_test.py:30: in test_phi_export_cpu
    proto = onnxscript.tools.transformers_models.export_to_onnx(model, *input_tensors)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../tools/transformers_models/__init__.py:41: in export_to_onnx
    prog = torch.onnx.export(model, args, dynamo=True)  # pylint: disable=no-value-for-parameter
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../torch/onnx/__init__.py:364: in export
    return _compat.export_compat(
..../test_onnx_ir_git/lib/python3.11.../_internal/exporter/_compat.py:180: in export_compat
    onnx_program.model = onnxscript_apis.convert_version(
onnxscript/_framework_apis/torch_2_6.py:43: in convert_version
    version_converter.convert_version(model, target_version, fallback=True)
onnxscript/version_converter/__init__.py:173: in convert_version
    ConvertVersionPass(target_version=target_version, fallback=fallback)(model)
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:127: in __call__
    result = self.call(model)
             ^^^^^^^^^^^^^^^^
onnxscript/version_converter/__init__.py:52: in call
    return self.convert_pass(model)
           ^^^^^^^^^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:127: in __call__
    result = self.call(model)
             ^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:253: in call
    raise PassError(
E   onnx_ir.passes.PassError: An error occurred when running the '<onnxscript.version_converter._ConvertVersionPassRequiresInline object at 0x1453cecd0>' pass after the following passes: ['<onnx_ir.passes.common.inliner.InlinePass object at 0x145339e10>']
onnxscript.tools.transformers_models.phi_test.TestExportPhi::test_phi_export_cpu_export_api

Flake rate in main: 97.22% (Passed 19 times, Failed 665 times)

Stack Traces | 5.2s run time
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:250: in call
    pass_result = pass_(model)
                  ^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:127: in __call__
    result = self.call(model)
             ^^^^^^^^^^^^^^^^
onnxscript/version_converter/__init__.py:77: in call
    raise ValueError(
E   ValueError: The model contains functions. The version conversion pass does not support functions. Please use `common_passes.InlinePass` to inline the functions before applying this pass (_ConvertVersionPassRequiresInline).

The above exception was the direct cause of the following exception:
onnxscript/_internal/version_utils.py:94: in call_f
    return fct(self)
           ^^^^^^^^^
.../tools/transformers_models/phi_test.py:48: in test_phi_export_cpu_export_api
    proto = onnxscript.tools.transformers_models.export_to_onnx(
.../tools/transformers_models/__init__.py:41: in export_to_onnx
    prog = torch.onnx.export(model, args, dynamo=True)  # pylint: disable=no-value-for-parameter
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../torch/onnx/__init__.py:364: in export
    return _compat.export_compat(
..../test_onnx_ir_git/lib/python3.11.../_internal/exporter/_compat.py:180: in export_compat
    onnx_program.model = onnxscript_apis.convert_version(
onnxscript/_framework_apis/torch_2_6.py:43: in convert_version
    version_converter.convert_version(model, target_version, fallback=True)
onnxscript/version_converter/__init__.py:173: in convert_version
    ConvertVersionPass(target_version=target_version, fallback=fallback)(model)
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:127: in __call__
    result = self.call(model)
             ^^^^^^^^^^^^^^^^
onnxscript/version_converter/__init__.py:52: in call
    return self.convert_pass(model)
           ^^^^^^^^^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:127: in __call__
    result = self.call(model)
             ^^^^^^^^^^^^^^^^
..../test_onnx_ir_git/lib/python3.11.../onnx_ir/passes/_pass_infra.py:253: in call
    raise PassError(
E   onnx_ir.passes.PassError: An error occurred when running the '<onnxscript.version_converter._ConvertVersionPassRequiresInline object at 0x1455c0710>' pass after the following passes: ['<onnx_ir.passes.common.inliner.InlinePass object at 0x1455cfe50>']

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.


for k, v in kwargs.items():
setattr(model_proto, k, v)
if k == "functions":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions argument was removed. Was it used anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can look into the unittest. def to_model_proto(self, **kwargs):, the signature is not very explicit about what is allowed and what is not.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn’t a test failing? I thought I removed them all. We can update the signature to reflect the api change. (It was mentioned in the release notes)

@xadupre xadupre closed this Feb 2, 2026
@github-project-automation github-project-automation bot moved this from Todo to Done in ONNX Script Review Board Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants