Skip to content

Fix Windows PermissionError in test_patch_merger - #160

Merged
justinchuby merged 1 commit into
mainfrom
fix-pixtral-test-windows-tempfile
Apr 10, 2026
Merged

Fix Windows PermissionError in test_patch_merger#160
justinchuby merged 1 commit into
mainfrom
fix-pixtral-test-windows-tempfile

Conversation

@titaiwangms

Copy link
Copy Markdown
Contributor

Replace tempfile-based ONNX save/load with in-memory protobuf serialization to avoid Windows concurrent file access errors.

test_patch_merger_matches_hf_unfold_ordering in _pixtral_vision_test.py fails on Windows CI because tempfile.NamedTemporaryFile() keeps the file handle open while ir.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

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>
@github-actions

Copy link
Copy Markdown

Performance Comparison

Comparing ec3455b3de4283

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0%
bert (feature-extraction) num_nodes 61 61 +0.0%
falcon model_size_bytes 364 KB 364 KB +0.0%
falcon num_nodes 66 66 +0.0%
gemma2 model_size_bytes 428 KB 428 KB +0.0%
gemma2 num_nodes 107 107 +0.0%
gpt2 model_size_bytes 388 KB 388 KB +0.0%
gpt2 num_nodes 53 53 +0.0%
llama model_size_bytes 425 KB 425 KB +0.0%
llama num_nodes 61 61 +0.0%
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0%
llama (static-cache) num_nodes 58 58 +0.0%
mamba (ssm-text-generation) model_size_bytes 360 KB 360 KB +0.0%
mamba (ssm-text-generation) num_nodes 103 103 +0.0%
phi3 model_size_bytes 421 KB 421 KB +0.0%
phi3 num_nodes 59 59 +0.0%
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0%
phi3 (static-cache) num_nodes 56 56 +0.0%
qwen2 model_size_bytes 425 KB 425 KB +0.0%
qwen2 num_nodes 61 61 +0.0%
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0%
qwen2 (static-cache) num_nodes 58 58 +0.0%
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0%
qwen3_5_moe (hybrid-text-generation) num_nodes 275 275 +0.0%
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0%
qwen3_5_text (hybrid-text-generation) num_nodes 129 129 +0.0%
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0%
qwen3_5_vl (hybrid-qwen-vl) num_nodes 409 409 +0.0%
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0%
t5 (seq2seq) num_nodes 174 174 +0.0%
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0%
whisper (speech-to-text) num_nodes 128 128 +0.0%

No performance regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread src/mobius/components/_pixtral_vision_test.py
@codecov

codecov Bot commented Apr 10, 2026

Copy link
Copy Markdown

The author of this PR, titaiwangms, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don't hesitate to email us at support@codecov.io with any questions.

@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing ec3455b3de4283

Model Sub-model Changes Status
bert (feature-extraction) model 0
falcon model 0
gemma2 model 0
gpt2 model 0
llama model 0
llama (static-cache) model 0
mamba (ssm-text-generation) model 0
phi3 model 0
phi3 (static-cache) model 0
qwen model 0
qwen (static-cache) model 0
qwen2 model 0
qwen2 (static-cache) model 0
qwen2_moe model 0
qwen2_moe (static-cache) model 0
qwen3 model 0
qwen3 (static-cache) model 0
qwen3_5_moe (hybrid-text-generation) model 0
qwen3_5_text (hybrid-text-generation) model 0
qwen3_5_vl (hybrid-qwen-vl) decoder 0
qwen3_5_vl (hybrid-qwen-vl) embedding 0
qwen3_5_vl (hybrid-qwen-vl) vision 0
qwen3_moe model 0
qwen3_moe (static-cache) model 0
qwen3_next (hybrid-text-generation) model 0
t5 (seq2seq) decoder 0
t5 (seq2seq) encoder 0
whisper (speech-to-text) decoder 0
whisper (speech-to-text) encoder 0

No architecture changes detected.


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@justinchuby
justinchuby merged commit b6cf924 into main Apr 10, 2026
24 of 26 checks passed
@justinchuby
justinchuby deleted the fix-pixtral-test-windows-tempfile branch April 10, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix test_patch_merger_matches_hf_unfold_ordering: Windows temp file PermissionError

3 participants