Centralize ONNX export warning suppression in export_pytorch()#460
Merged
Conversation
Agent-Logs-Url: https://github.com/microsoft/WinML-ModelKit/sessions/208a704a-029f-4bb4-a2d2-c8d4a76a413a Co-authored-by: chinazhangchao <3822520+chinazhangchao@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/WinML-ModelKit/sessions/208a704a-029f-4bb4-a2d2-c8d4a76a413a Co-authored-by: chinazhangchao <3822520+chinazhangchao@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/WinML-ModelKit/sessions/208a704a-029f-4bb4-a2d2-c8d4a76a413a Co-authored-by: chinazhangchao <3822520+chinazhangchao@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TracerWarning leaks to stderr on winml export
Centralize ONNX export warning suppression in May 7, 2026
export_pytorch()
xieofxie
approved these changes
May 8, 2026
vortex-captain
pushed a commit
that referenced
this pull request
May 20, 2026
Move the `_normalize_exported_model` call inside the `warnings.catch_warnings()` block so the optimizer's shape-inference and ORT warnings stay suppressed for callers. PR #460 centralized warning suppression here; the new normalization call had escaped it and was leaking warnings to stderr. Addresses DingmaomaoBJTU's first review finding on #681.
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.
After removing eager
TracerWarningfiltering at startup, several ONNX export paths began leakingTracerWarning/export-time noise to stderr because suppression existed only in one caller. This change moves suppression to the shared export implementation so all call sites behave consistently.Export path hardening
src/winml/modelkit/export/pytorch.py::export_pytorch().warnings.catch_warnings()+warnings.filterwarnings("ignore")so all transitive callers (CLI export, HF build path, perf path, etc.) inherit suppression.Caller cleanup
src/winml/modelkit/commands/build.py.Documentation alignment
src/winml/modelkit/_warnings.pynote to reflect that suppression is now handled inexport_pytorch()rather thanbuild.py.Focused regression coverage
tests/unit/test_pytorch_warning_suppression.pyto verify:export_pytorch()Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
releases.astral.sh/home/REDACTED/.local/bin/uv /home/REDACTED/.local/bin/uv run ruff check(dns block)If you need me to access, download, or install something from one of these locations, you can either: