Skip to content

Fix ort genai model builder compatible issue - #2665

Merged
Xiaoyu Z (xiaoyu-work) merged 2 commits into
mainfrom
fix/ort-genai-016-model-builder
Sep 14, 2026
Merged

Xiaoyu Z (xiaoyu-work) merged 2 commits into
mainfrom
fix/ort-genai-016-model-builder

Conversation

@xiaoyu-work

Copy link
Copy Markdown
Member

Describe your changes

Fix ort genai model builder compatible issue

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

(Optional) Issue link

Use the new quantized loader modules and public group_size setter without legacy compatibility. Require GenAI 0.16 in test environments and align the Qwen3 smoke model special tokens with its tokenizer.
@xiaoyu-work
Xiaoyu Z (xiaoyu-work) marked this pull request as ready for review September 14, 2026 22:00
Copilot AI lite review requested due to automatic review settings September 14, 2026 22:00

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.

🟡 Changes recommended

Two unresolved critical findings remain in olive/passes/onnx/model_builder.py.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request updates ORT GenAI ModelBuilder compatibility for newer loader layouts and quantized models, with expanded regression coverage.

Changes:

  • Updates quantization loader integration and group-size handling.
  • Adds loader-patching and quantization tests.
  • Aligns Qwen3 token configuration.
  • Cleans up test requirements formatting.
File summaries
File Summary
test/requirements-test-cpu.txt Removes extraneous formatting.
test/passes/onnx/test_model_builder.py Adds loader and quantization regression coverage.
test/cli/test_cli_test_model_smoke.py Validates matching Qwen3 token IDs.
olive/passes/onnx/model_builder.py Updates loader patching and quantized tensor handling. Critical (3 votes, line 493): unconditional newer loader imports break older ORT GenAI versions. Critical (1 vote, line 585): group_size=-1 must be normalized to the input dimension.
Review details

Suppressed comments (1)

olive/passes/onnx/model_builder.py:585

  • Changing the assignment from _group_size to group_size is only valid for the new loader class, which added a writable setter. The legacy QuantizedTensorModule exposes group_size as a read-only property backed by _group_size, so a legacy fallback would raise AttributeError while loading every quantized tensor; use a compatibility helper or assign the appropriate backing field for each loader version.
                for q_attr, q_value in [("bits", local_bits), ("group_size", local_group_size)]:
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread olive/passes/onnx/model_builder.py
Comment thread olive/passes/onnx/model_builder.py
@xiaoyu-work
Xiaoyu Z (xiaoyu-work) enabled auto-merge (squash) September 14, 2026 22:55
@xiaoyu-work
Xiaoyu Z (xiaoyu-work) merged commit 551a0af into main Sep 14, 2026
13 checks passed
@xiaoyu-work
Xiaoyu Z (xiaoyu-work) deleted the fix/ort-genai-016-model-builder branch September 14, 2026 22:55
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.

3 participants