-
Notifications
You must be signed in to change notification settings - Fork 64
[IR][fix] Save value info for initializers #1552
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
Conversation
❌ 9 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Test Results 24 files ± 0 24 suites ±0 42m 4s ⏱️ - 2h 46m 54s For more details on these failures, see this check. Results for commit 64e740a. ± Comparison against base commit 9bae2b5. This pull request removes 9868 and adds 6038 tests. Note that renamed tests count towards both.
This pull request removes 14 skipped tests and adds 2018 skipped tests. Note that renamed tests count towards both.
This pull request skips 16 and un-skips 8 tests.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ci fails
Can this be closed, or is this still relevant? |
This is still relavent. We need to update our test data first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the issue where initializers were not included in the graph’s value_info by ensuring that all initializer tensors are processed and their associated values are updated or created accordingly. Key changes include:
- Using an enumerate loop in deserialization to warn and skip initializers with an empty name.
- Consistently using a local variable (initializer_name) to reference initializer names when looking up or inserting values.
- Updating the serialization loop to add value_info for initializers that are not also graph inputs.
Files not reviewed (4)
- testdata/e2e_models/Speech2Text2ForCausalLM/dynamo/Speech2Text2ForCausalLM_dynamo.onnx: Language not supported
- testdata/e2e_models/mobilenetv2_100/dynamo/mobilenetv2_100_dynamo.onnx: Language not supported
- testdata/e2e_models/resnet18/dynamo/resnet18_dynamo.onnx: Language not supported
- testdata/e2e_models/torchscript_model/torchscript_model.onnx: Language not supported
Comments suppressed due to low confidence (1)
onnxscript/ir/serde.py:635
- [nitpick] Consider renaming the loop variable 'i' to 'index' for improved clarity and consistency in the code.
for i, tensor in enumerate(initializer_tensors):
if initializer.const_value is None: | ||
for value in from_.initializers.values(): | ||
_maybe_add_quantization_annotation(graph_proto, value) | ||
if _should_create_value_info_for_value(value) and value.name not in input_names: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the cases that initializers are model inputs? Does that mean the inputs are constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's like a parameter having a default value. Any input can be initialized if an initializer of the same name is in the graph. Users can choose to overwrite the initializer by providing their own input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even the model is updated, should we assert valueinfo in the tests?
Good point. I will create a follow up to update some of the test behaviors, thanks. |
Previously initializers are not included in the graph value_info because they are not easily accessible from the Graph object. Now what we store all the Values for initializers, we can serialize the value information into the graph.
Updated test models to include the value info protos for initializers so the round tripping tests can pass.
Fix #1501