Skip to content

Add QairtModelHandler input support to QairtPipelinePass#2545

Draft
qti-kromero wants to merge 1 commit into
microsoft:mainfrom
CodeLinaro:dev/kromero/qairt-pipeline-chain-handler
Draft

Add QairtModelHandler input support to QairtPipelinePass#2545
qti-kromero wants to merge 1 commit into
microsoft:mainfrom
CodeLinaro:dev/kromero/qairt-pipeline-chain-handler

Conversation

@qti-kromero

Copy link
Copy Markdown
Contributor

Allow QairtPipelinePass to accept a QairtModelHandler as input in addition to HfModelHandler. This enables chaining two pipeline passes in an Olive recipe — the first pass exports an HF checkpoint via save_pretrained, and the second pass loads from that checkpoint as its model_id_or_path.

When input is QairtModelHandler: model.model_path is used directly as model_id_or_path; the recipe must not also specify model_id_or_path (raises ValueError if it does); config.json and generation_config.json are copied from model.model_path rather than via snapshot_download.

Describe your changes

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

Allow QairtPipelinePass to accept a QairtModelHandler as input in
addition to HfModelHandler. This enables chaining two pipeline passes
in an Olive recipe — the first pass exports an HF checkpoint via
save_pretrained, and the second pass loads from that checkpoint as its
model_id_or_path.

When input is QairtModelHandler: model.model_path is used directly as
model_id_or_path; the recipe must not also specify model_id_or_path
(raises ValueError if it does); config.json and generation_config.json
are copied from model.model_path rather than via snapshot_download.

if not isinstance(model, HfModelHandler):
raise ValueError(f"QairtPipelinePass requires HfModelHandler as input, got {type(model).__name__}")
if isinstance(model, HfModelHandler):
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.

2 participants