Skip to content

[Pass] Remove metadata_props and doc_string from the model #2182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

titaiwangms
Copy link
Contributor

Fix #2163

Copy link

codecov bot commented Apr 10, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
2002 2 2000 261
View the top 1 failed test(s) by shortest run time
onnxscript.backend.onnx_export_test.TestOnnxBackEnd::test_export2python_produces_correct_onnx_script_model_0397_test_ai_onnx_ml_tree_ensemble_set_membership
Stack Traces | 0.013s run time
onnxscript/converter.py:460: in _eval_constant_expr
    return eval(cpl, self.globals, locals)  # pylint: disable=eval-used
E   NameError: name 'nan' is not defined

The above exception was the direct cause of the following exception:
..../test_ort_nightly/lib/python3.11.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
onnxscript/backend/onnx_export_test.py:271: in test_export2python_produces_correct_onnx_script_model
    functions = extract_functions(backend_test.name, code, self.test_folder)
onnxscript/backend/onnx_export_test.py:137: in extract_functions
    mod = importlib.import_module(import_name)
.../hostedtoolcache/Python/3.11.11.../x64/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
..../test_ort_nightly/lib/python3.11.../_pytest/assertion/rewrite.py:185: in exec_module
    exec(co, module.__dict__)
tests/onnx_backend_test_code/test_ai_onnx_ml_tree_ensemble_set_membership.py:9: in <module>
    @script()
onnxscript/main.py:95: in transform
    result = script_check(f_ast, opset, env, src, default_opset=default_opset)
onnxscript/main.py:39: in script_check
    return convert.translate_function_def(f)
onnxscript/converter.py:1452: in translate_function_def
    fn_ir = self._translate_function_def_common(stmt)
onnxscript/converter.py:1439: in _translate_function_def_common
    self._translate_stmt(s, index_of_stmt=i)
onnxscript/converter.py:961: in _translate_stmt
    return self._translate_assign_stmt(node)
onnxscript/converter.py:1048: in _translate_assign_stmt
    assign(lhs, rhs)
onnxscript/converter.py:992: in assign
    t = self._translate_expr(rhs, lhs).name
onnxscript/converter.py:546: in _translate_expr
    r = self._translate_call_expr(node)
onnxscript/converter.py:825: in _translate_call_expr
    attrs = [
onnxscript/converter.py:826: in <listcomp>
    self._translate_attr(x, y, callee.op_schema.attributes[x])
onnxscript/converter.py:510: in _translate_attr
    val = self._eval_constant_expr(expr)
onnxscript/converter.py:462: in _eval_constant_expr
    raise NameError(
E   NameError: ERROR: Missing names, globals contains ['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__file__', '__cached__', '__builtins__', '@py_builtins', '@pytest_ar', 'numpy', 'TensorProto', 'make_tensor', 'script', 'external_tensor', 'Opset', 'FLOAT', 'ai_onnx_ml5'], locals [].
E   at: Function 'bck_test_ai_onnx_ml_tree_ensemble_set_membership', line 3
E       Y = ai_onnx_ml5.TreeEnsemble(X, aggregate_function=1, leaf_targetids=[0, 1, 2, 3], leaf_weights=make_tensor("value", 1, dims=[4], vals=[1.0, 10.0, 1000.0, 100.0]), membership_values=make_tensor("value", 1, dims=[8], vals=[1.2000000476837158, 3.700000047683716, 8.0, 9.0, nan, 12.0, 7.0, nan]), n_targets=4, nodes_falseleafs=[1, 0, 1], nodes_falsenodeids=[2, 2, 3], nodes_featureids=[0, 0, 0], nodes_modes=make_tensor("value", 2, dims=[3], vals=[0, 6, 6]), nodes_splits=make_tensor("value", 1, dims=[3], vals=[11.0, 232344.0, nan]), nodes_trueleafs=[0, 1, 1], nodes_truenodeids=[1, 0, 1], post_transform=0, tree_roots=[0])
E                                                                                                                                                                                             ^
View the full list of 1 ❄️ flaky tests
onnxscript.tools.transformers_models.phi_test.TestExportPhi::test_phi_dort_static

Flake rate in main: 82.70% (Passed 32 times, Failed 153 times)

Stack Traces | 13.8s run time
onnxscript/_internal/version_utils.py:94: in call_f
    return fct(self)
.../tools/transformers_models/phi_test.py:101: in test_phi_dort_static
    results = compiled_model(*input_tensors)
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1736: in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1747: in _call_impl
    return forward_call(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../torch/_dynamo/eval_frame.py:465: in _fn
    return fn(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1736: in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1747: in _call_impl
    return forward_call(*args, **kwargs)
.../tools/transformers_models/phi.py:114: in forward
    def forward(self, input_ids, attention_mask):
..../test_ort_nightly/lib/python3.11.../torch/_dynamo/eval_frame.py:632: in _fn
    return fn(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../torch/_functorch/aot_autograd.py:1100: in forward
    return compiled_fn(full_args)
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/runtime_wrappers.py:308: in runtime_wrapper
    all_outs = call_func_at_runtime_with_args(
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/utils.py:124: in call_func_at_runtime_with_args
    out = normalize_as_list(f(args))
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/utils.py:98: in g
    return f(*args)
..../test_ort_nightly/lib/python3.11.../torch/autograd/function.py:575: in apply
    return super().apply(*args, **kwargs)  # type: ignore[misc]
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/runtime_wrappers.py:1525: in forward
    fw_outs = call_func_at_runtime_with_args(
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/utils.py:124: in call_func_at_runtime_with_args
    out = normalize_as_list(f(args))
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/runtime_wrappers.py:488: in wrapper
    return compiled_fn(runtime_args)
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/runtime_wrappers.py:667: in inner_fn
    outs = compiled_fn(args)
..../test_ort_nightly/lib/python3.11.../_functorch/_aot_autograd/utils.py:98: in g
    return f(*args)
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1736: in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1747: in _call_impl
    return forward_call(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../torch/fx/_lazy_graph_module.py:126: in _lazy_forward
    return self(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../torch/fx/graph_module.py:784: in call_wrapped
    return self._wrapped_call(self, *args, **kwargs)
..../test_ort_nightly/lib/python3.11.../torch/fx/graph_module.py:361: in __call__
    raise e
..../test_ort_nightly/lib/python3.11.../torch/fx/graph_module.py:348: in __call__
    return super(self.cls, obj).__call__(*args, **kwargs)  # type: ignore[misc]
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1736: in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
..../test_ort_nightly/lib/python3.11.../nn/modules/module.py:1747: in _call_impl
    return forward_call(*args, **kwargs)
<eval_with_key>.3:5: in forward
    fused_0 = self.fused_0(primals_2, primals_1, primals_3, primals_6, primals_8, primals_10, primals_12, primals_13, primals_14, primals_16, primals_18, primals_22, primals_24, primals_26, primals_28, primals_29, primals_30, primals_32, primals_34, primals_4, primals_5, primals_7, primals_9, primals_11, primals_17, primals_19, primals_15, primals_20, primals_21, primals_23, primals_25, primals_27, primals_33, primals_35, primals_31, primals_36, primals_37);  primals_2 = primals_3 = primals_6 = primals_8 = primals_10 = primals_12 = primals_13 = primals_14 = primals_16 = primals_18 = primals_22 = primals_24 = primals_26 = primals_28 = primals_29 = primals_30 = primals_32 = primals_34 = primals_5 = primals_7 = primals_9 = primals_11 = primals_17 = primals_19 = primals_15 = primals_21 = primals_23 = primals_25 = primals_27 = primals_33 = primals_35 = primals_31 = primals_37 = None
..../test_ort_nightly/lib/python3.11.../torch/fx/graph_module.py:784: in call_wrapped
    return self._wrapped_call(self, *args, **kwargs)
..../test_ort_nightly/lib/python3.11.../onnx/_internal/onnxruntime.py:1070: in _ort_acclerated_call
    onnx_outputs = self.run(
..../test_ort_nightly/lib/python3.11.../onnx/_internal/onnxruntime.py:514: in _run_onnx_session_with_ortvaluevector
    pth_outputs = onnxruntime.training.ortmodule._utils._ortvalues_to_torch_tensor(
E   AttributeError: module 'onnxruntime' has no attribute 'training'

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

@titaiwangms titaiwangms marked this pull request as ready for review April 11, 2025 23:36
Copy link
Collaborator

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

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

Discussed offline. Changes to the metadata_props in ir.Function lgtm. Thanks!

@titaiwangms titaiwangms enabled auto-merge (squash) April 14, 2025 22:45
@titaiwangms titaiwangms merged commit d1a8215 into microsoft:main Apr 14, 2025
23 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

[Pass] Clear metadata
4 participants