Fix QwenImageEditPlus max_sequence_length and transformer text seq len kwargs #12991
+55
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR fixes two issues in QwenImageEditPlusPipeline (pipeline_qwenimage_edit_plus.py) related to text sequence length handling:
Make max_sequence_length effective: the parameter was accepted by the public API but previously not applied. We now truncate prompt_embeds and prompt_embeds_mask to max_sequence_length.
Prevent failures in the denoising loop: QwenImage transformer/RoPE needs an explicit text sequence length, but some accelerated/quantized transformer implementations (e.g. nunchaku) don’t accept the new max_txt_seq_len kwarg. The pipeline now adapts to the transformer forward signature:
Prefer passing max_txt_seq_len when supported (or when **kwargs is accepted)
Otherwise fall back to deprecated txt_seq_lens
Otherwise pass nothing (let the implementation handle it)
This avoids runtime errors such as:
ValueError: Either max_txt_seq_len or txt_seq_lens ... must be provided
TypeError: ... forward() got an unexpected keyword argument 'max_txt_seq_len'
Who can review?
Tagging: @yiyixuxu @asomoza (pipelines)