Fix protobuf serialization failure in ort_fusions ort_run for large models#2955
Merged
Conversation
Copilot
AI
changed the title
[WIP] Investigate and fix CI issues with serialization error
Fix protobuf serialization failure in ort_fusions ort_run for large models
Jul 8, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2955 +/- ##
=======================================
Coverage 72.65% 72.65%
=======================================
Files 259 259
Lines 31766 31770 +4
Branches 3007 3007
=======================================
+ Hits 23078 23082 +4
Misses 7670 7670
Partials 1018 1018 ☔ View full report in Codecov by Harness. |
titaiwangms
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TestFuseXformers.test_fuse_xformersintermittently failed withgoogle.protobuf.message.EncodeError: Failed to serialize proto(observed on theonnx_weeklyWindows CI).The
ort_runtest helper serialized the whole model in memory viaModelProto.SerializeToString(). The SmolLM test model is ~671MB — dominated by the 49152×2048head_weight(~402MB) — close enough to protobuf's 2GB single-message serialization ceiling that in-memory serialization can fail depending on platform/library version.Changes
onnxscript/rewriter/ort_fusions/_test_utils.py:ort_runnow writes the model to a temp file with external data viair.saveand loads it intoInferenceSessionby path, bypassing the in-memory protobuf size limit.ir.saveleaves the in-memory model unchanged, so repeatedort_runcalls on the same model still work.This helper is shared across the ort_fusions test suite, so the fix applies to all fusion tests that round-trip models through ORT.