Skip to content

Fix forwarding ARN sequence lengths from QairtPipelinePass to QairtEncapsulationPass#2526

Open
qti-kromero wants to merge 4 commits into
microsoft:mainfrom
CodeLinaro:dev/qti-kromero/qairt-pipeline-context-lengths
Open

Fix forwarding ARN sequence lengths from QairtPipelinePass to QairtEncapsulationPass#2526
qti-kromero wants to merge 4 commits into
microsoft:mainfrom
CodeLinaro:dev/qti-kromero/qairt-pipeline-context-lengths

Conversation

@qti-kromero

@qti-kromero qti-kromero commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

QairtEncapsulation uses sequence_lengths from model_attributes to compute max_length in genai_config.json. QairtGenAIBuilder populates this via its own config, but QairtPipelinePass had no equivalent path. Extract the arn list from the genai_builder.transform_options in the YAML recipe and pass it through model_attributes so QairtEncapsulation can pick it up.

Previously caused an issue in execution where context length would be exceeded and some kind of crash would occur

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

…tion

QairtEncapsulation uses sequence_lengths from model_attributes to compute
max_length in genai_config.json. QairtGenAIBuilder populates this via its
own config, but QairtPipelinePass had no equivalent path. Extract the arn
list from the genai_builder.transform_options in the YAML recipe and pass
it through model_attributes so QairtEncapsulation can pick it up.
Covers the case where arn is present in genai_builder.transform_options
and forwarded as sequence_lengths in model_attributes, and the case where
arn is absent and sequence_lengths is not set.
@qti-kromero qti-kromero changed the title Forward ARN sequence lengths from QairtPipelinePass to QairtEncapsulationPass Fix forwarding ARN sequence lengths from QairtPipelinePass to QairtEncapsulationPass Jun 23, 2026
@qti-kromero qti-kromero marked this pull request as ready for review June 23, 2026 20:00
Copilot AI review requested due to automatic review settings June 23, 2026 20: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.

Pull request overview

This PR ensures QAIRT pipeline recipes that specify AR decode lengths (stages.genai_builder.transform_options.arn) correctly forward that information through QairtPipelinePass via model_attributes["sequence_lengths"], enabling QairtEncapsulation to compute genai_config.json max_length consistently with the QairtGenAIBuilder path.

Changes:

  • Forward arn from the pipeline recipe into QairtModelHandler.model_attributes["sequence_lengths"] in QairtPipelinePass.
  • Add unit tests verifying arn is forwarded when present and omitted when absent.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
olive/passes/qairt/pipeline.py Extracts arn from recipe and forwards it as sequence_lengths via model_attributes for downstream encapsulation.
test/passes/qairt/test_pipeline_pass.py Adds coverage for forwarding behavior and the no-arn behavior.

Comment thread olive/passes/qairt/pipeline.py
…psulation

QairtEncapsulation calls min(sequence_lengths) on the forwarded value, so a
malformed YAML arn (string, bare int, empty list, mixed types) would fail with
an opaque error. Raise a clear ValueError at the pipeline pass boundary instead.
@qti-kromero

Copy link
Copy Markdown
Contributor Author

@maintainers - this is ready for human review

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