Fix Windows PermissionError in test_patch_merger - #160
Conversation
Replace tempfile-based ONNX save/load with in-memory protobuf serialization to avoid Windows concurrent file access errors. Use ir.serde.serialize_model() + SerializeToString() to load the model directly into ORT InferenceSession without disk I/O. Closes #159 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Ti-Tai Wang <titaiwang@microsoft.com>
Performance Comparison
|
There was a problem hiding this comment.
Pull request overview
Fixes a Windows CI failure in test_patch_merger_matches_hf_unfold_ordering by avoiding NamedTemporaryFile() + ir.save() (which can trigger PermissionError due to file-handle locking on Windows) when creating an ORT InferenceSession.
Changes:
- Remove
tempfile.NamedTemporaryFile()roundtrip used to save/load a temporary ONNX file. - Build the ORT session from an in-memory serialized model instead of writing to disk.
|
The author of this PR, titaiwangms, is not an activated member of this organization on Codecov. |
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Replace tempfile-based ONNX save/load with in-memory protobuf serialization to avoid Windows concurrent file access errors.
test_patch_merger_matches_hf_unfold_orderingin_pixtral_vision_test.pyfails on Windows CI becausetempfile.NamedTemporaryFile()keeps the file handle open whileir.save()tries to write to the same path.Fix: Use
ir.serde.serialize_model() + SerializeToString()to load the model directly into ORT InferenceSession without any disk I/O.Closes #159