Skip to content

Make changes to integrate with Whisper recipes#2450

Open
kunal-vaishnavi wants to merge 6 commits intomainfrom
kvaishnavi/update-for-whisper-recipe
Open

Make changes to integrate with Whisper recipes#2450
kunal-vaishnavi wants to merge 6 commits intomainfrom
kvaishnavi/update-for-whisper-recipe

Conversation

@kunal-vaishnavi
Copy link
Copy Markdown
Contributor

@kunal-vaishnavi kunal-vaishnavi commented May 7, 2026

Description

This PR makes changes to work with multiple models produced by model builder.

Motivation and Context

This PR unblocks using model builder to create the Whisper models in Olive recipes such as here.

Copilot Summary

This pull request improves support for multi-file ONNX models (such as Whisper encoder/decoder) and adds robustness to model file handling in the ONNX model builder and quantization passes. The main changes ensure that output file names and paths are handled correctly for both single-file and composite models, and that annotation and metadata logic gracefully handles missing files.

Multi-file/composite model support:

  • The ONNX model builder now detects when multiple .onnx files are generated, constructs a CompositeModelHandler for these cases, and ensures that component file names are preserved for downstream passes.
  • In the quantization pass, the output file path logic strips redundant .onnx extensions to prevent double extensions when handling composite model components.
  • When saving models, output file names are now checked and corrected to avoid duplicate .onnx extensions.

File handling and robustness:

  • The model builder now checks for the existence of the expected ONNX file before applying split assignments or layer annotations, and logs a warning if the file is missing.
  • For single-file models, if the expected output file is missing but another .onnx file is found, the builder falls back to using the discovered file and logs this substitution.

Output path and metadata management:

  • Output model file paths are now constructed to preserve the resolved output directory and avoid path errors.
  • The list of additional files in model attributes is now correctly filtered to exclude all primary ONNX model files and their associated data files, supporting both single-file and multi-file scenarios.

Copilot AI review requested due to automatic review settings May 7, 2026 22:16
Comment thread olive/passes/onnx/model_builder.py Fixed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Olive’s ONNX ModelBuilder and related save/quantization logic to better support multi-file ONNX outputs (e.g., Whisper encoder/decoder) produced by the ORT GenAI model builder, while improving output filename/path robustness for downstream passes and cache export.

Changes:

  • Extend ModelBuilder to detect multiple generated .onnx files and return a CompositeModelHandler with preserved component filenames.
  • Adjust OnnxKQuantQuantization output path handling to avoid double .onnx extensions for composite components.
  • Update cache export for composite ONNX components to avoid appending a second .onnx suffix when component names already include it.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
olive/passes/onnx/model_builder.py Adds composite/multi-file output support, improves output path handling, and refines additional_files filtering and annotation behavior.
olive/passes/onnx/kquant_quantization.py Tweaks output path formation for composite components to prevent .onnx.onnx outputs.
olive/cache.py Ensures composite ONNX component save/export doesn’t create double .onnx filenames.

Comment thread olive/passes/onnx/model_builder.py Outdated
Comment thread olive/passes/onnx/model_builder.py Outdated
Comment thread olive/passes/onnx/model_builder.py
Copilot AI and others added 2 commits May 9, 2026 00:19
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/43ccb782-c444-474a-b13f-ecb09a594886

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/43ccb782-c444-474a-b13f-ecb09a594886

Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

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:

  • huggingface.co
    • Triggering command: /home/REDACTED/.local/bin/pytest pytest -q test/passes/onnx/test_model_builder.py (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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