Skip to content

Remove Hugging Face download dependency from test_dynamic_quantization_subgraph - #32443

Merged
Tianlei Wu (tianleiwu) merged 2 commits into
mainfrom
copilot/fix-macos-ci-flaky-test
Sep 4, 2026
Merged

Tianlei Wu (tianleiwu) merged 2 commits into
mainfrom
copilot/fix-macos-ci-flaky-test

Conversation

Copilot AI commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

test_dynamic_quantization_subgraph downloaded decoder_model_merged.onnx from huggingface.co at test time and only caught urllib.error.HTTPError. DNS/connection failures raise the broader urllib.error.URLError, which escaped and failed CI (e.g. macOS job 99624951799, run 33433704903).

No trustworthy Microsoft/ONNX-Runtime-controlled GitHub copy of the exact unquantized model exists, so instead of adding a broader exception handler around a network call, the test now builds a minimal ONNX fixture locally, removing the network dependency entirely.

  • Local fixture instead of download: _make_merged_decoder_like_model() constructs a small model with a top-level float initializer shared.weight_merged_0 consumed by a Gather node inside each branch (then_branch/else_branch) of an If node — reproducing the structural property under test (outer-scope weight sharing across nested subgraphs), matching the real merged T5 decoder's with-past/without-past branches.
  • Same assertions preserved: quantizing with extra_options={"EnableSubgraph": True} still must hoist shared.weight_merged_0_quantized / shared.weight_merged_0_scale to the top-level graph and must not leak shared.weight* initializers into subgraphs.
  • No pre-quantized substitute: the fixture is unquantized float data, so the test still genuinely exercises quantization behavior rather than short-circuiting it.
gather_node = onnx.helper.make_node("Gather", [shared_weight_name, "input_ids"], [gather_output], axis=0)
# ... wrapped in then_branch/else_branch of an If node, with shared_weight_name
# defined only as a top-level initializer.

Motivation and Context

Eliminates a flaky, network-dependent CI failure and makes the test deterministic, while still covering the intended subgraph-quantization initializer-hoisting behavior.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix flaky macOS CI failure in dynamic quantization subgraph test Remove Hugging Face download dependency from test_dynamic_quantization_subgraph Sep 4, 2026
@tianleiwu
Tianlei Wu (tianleiwu) marked this pull request as ready for review September 4, 2026 19:21
Copilot AI balanced review requested due to automatic review settings September 4, 2026 19:21

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.

🟢 Approval recommended

The deterministic fixture preserves the intended coverage, with no unresolved issues.

Pull request overview

Replaces a flaky Hugging Face model download with a deterministic local ONNX fixture while preserving subgraph quantization coverage.

Changes:

  • Builds a merged-decoder-like If model locally.
  • Removes the external network dependency.
  • Retains initializer-hoisting assertions.
File summaries
File Description
onnxruntime/test/python/quantization/test_subgraph.py Adds the local fixture and uses it in the quantization test.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tianleiwu
Tianlei Wu (tianleiwu) enabled auto-merge (squash) September 4, 2026 21:11
@tianleiwu
Tianlei Wu (tianleiwu) merged commit 781a325 into main Sep 4, 2026
91 checks passed
@tianleiwu
Tianlei Wu (tianleiwu) deleted the copilot/fix-macos-ci-flaky-test branch September 4, 2026 23:34
@justinchuby

Copy link
Copy Markdown
Contributor

FYI you may also use the onnx textual format to simplify the fixture code

adrastogi pushed a commit that referenced this pull request Oct 1, 2026
…n_subgraph (#32443)

Backport the local ONNX fixture so the shared quantization test no longer depends on Hugging Face certificate trust in release CI.

(cherry picked from commit 781a325)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Oct 12, 2026
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.

4 participants