-
Couldn't load subscription status.
- Fork 6.5k
Fix: update type hints for Tuple parameters across multiple files to support variable-length tuples #12544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…support variable-length tuples
There was a problem hiding this 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 fixes type hint inconsistencies across multiple files by updating Tuple type annotations to use variable-length syntax (Tuple[type, ...]) where parameters accept tuples of arbitrary length. This addresses issues similar to #4806 where fixed-length tuple annotations were incorrectly used for parameters that should accept variable-length tuples.
Key changes:
- Updated type hints from
Tuple[str]toTuple[str, ...]for block type parameters - Updated type hints from
Tuple[int]toTuple[int, ...]for channel configuration parameters - Fixed one incorrect annotation from
Tuple[str]tostrfor a non-tuple parameter
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/diffusers/pipelines/shap_e/renderer.py | Updated tuple type hints for param_names, param_shapes, and background parameters |
| src/diffusers/pipelines/deprecated/versatile_diffusion/modeling_text_unet.py | Fixed type hints for down_block_types, up_block_types, and block_out_channels |
| src/diffusers/pipelines/audioldm2/modeling_audioldm2.py | Updated block type and channel configuration tuple hints |
| src/diffusers/models/vae_flax.py | Fixed type hints across Encoder, Decoder, and AutoencoderKL classes |
| src/diffusers/models/unets/unet_stable_cascade.py | Updated tuple hints for block channels, attention heads, and layer configuration |
| src/diffusers/models/unets/unet_spatio_temporal_condition.py | Fixed block type and configuration parameter type hints |
| src/diffusers/models/unets/unet_kandinsky3.py | Updated block_out_channels type hint |
| src/diffusers/models/unets/unet_2d_condition.py | Fixed type hints in both init and _check_config methods |
| src/diffusers/models/unets/unet_1d.py | Updated block type and channel hints, corrected mid_block_type from Tuple to str |
| src/diffusers/models/transformers/transformer_wan_vace.py | Fixed patch_size type hint |
| src/diffusers/models/transformers/transformer_wan.py | Fixed patch_size type hint |
| src/diffusers/models/transformers/transformer_skyreels_v2.py | Fixed patch_size type hint |
| src/diffusers/models/transformers/transformer_hunyuanimage.py | Updated rope_axes_dim type hint |
| src/diffusers/models/transformers/transformer_hunyuan_video_framepack.py | Updated rope_axes_dim type hint |
| src/diffusers/models/transformers/transformer_hunyuan_video.py | Updated rope_axes_dim type hint |
| src/diffusers/models/controlnets/controlnet_xs.py | Fixed multiple tuple type hints for conditioning and block parameters |
| src/diffusers/models/autoencoders/autoencoder_kl_wan.py | Updated dim_mult type hint and changed default from list to tuple |
| src/diffusers/models/autoencoders/autoencoder_kl_temporal_decoder.py | Fixed block configuration type hints |
| src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py | Updated dim_mult type hint and changed default from list to tuple |
| src/diffusers/models/autoencoders/autoencoder_kl_mochi.py | Fixed encoder and decoder block channel type hints |
| src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py | Updated block_out_channels type hint |
| src/diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py | Fixed block_out_channels type hint |
| src/diffusers/models/autoencoders/autoencoder_kl_cogvideox.py | Updated block type and channel configuration hints |
| src/diffusers/models/autoencoders/autoencoder_kl.py | Fixed encoder and decoder block type hints |
| src/diffusers/models/autoencoders/autoencoder_dc.py | Updated multiple tuple hints including qkv_mutliscales, block_out_channels, and layers_per_block |
| examples/community/pipeline_faithdiff_stable_diffusion_xl.py | Fixed block type and channel configuration type hints |
| examples/community/matryoshka.py | Updated type hints in both init and _check_config methods |
| examples/community/img2img_inpainting.py | Fixed paste_offset type hint |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@bot /style |
|
Style bot fixed some files and pushed the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
What does this PR do?
Many classes exhibit the issues present in #4806, but these have not been fixed or reported. This PR attempts to resolve a batch of similar issues.
Fixes all issues like #4806
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.