Fix QwenImageEditPlus max_sequence_length and transformer text seq len kwargs#12991
Fix QwenImageEditPlus max_sequence_length and transformer text seq len kwargs#12991tonera wants to merge 1 commit intohuggingface:mainfrom
Conversation
|
gentle ping @yiyixuxu @sayakpaul @asomoza |
|
hi @tonera thanks for the PR |
|
not sure why was this pr closed? its definitely an issue since not all code handles changes introduced in diffusers (yes, nunchaku is an example). |
The pull request was submitted when version 0.37 was still in beta, and the current version is 0.38. The maintenance team is processing it too slowly. |
|
@yiyixuxu @sayakpaul this is a real issue and we had a valid pr 3 months ago, now we lost it :( |
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)