diffusers 0.27.1__py3-none-any.whl → 0.32.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- diffusers/__init__.py +233 -6
- diffusers/callbacks.py +209 -0
- diffusers/commands/env.py +102 -6
- diffusers/configuration_utils.py +45 -16
- diffusers/dependency_versions_table.py +4 -3
- diffusers/image_processor.py +434 -110
- diffusers/loaders/__init__.py +42 -9
- diffusers/loaders/ip_adapter.py +626 -36
- diffusers/loaders/lora_base.py +900 -0
- diffusers/loaders/lora_conversion_utils.py +991 -125
- diffusers/loaders/lora_pipeline.py +3812 -0
- diffusers/loaders/peft.py +571 -7
- diffusers/loaders/single_file.py +405 -173
- diffusers/loaders/single_file_model.py +385 -0
- diffusers/loaders/single_file_utils.py +1783 -713
- diffusers/loaders/textual_inversion.py +41 -23
- diffusers/loaders/transformer_flux.py +181 -0
- diffusers/loaders/transformer_sd3.py +89 -0
- diffusers/loaders/unet.py +464 -540
- diffusers/loaders/unet_loader_utils.py +163 -0
- diffusers/models/__init__.py +76 -7
- diffusers/models/activations.py +65 -10
- diffusers/models/adapter.py +53 -53
- diffusers/models/attention.py +605 -18
- diffusers/models/attention_flax.py +1 -1
- diffusers/models/attention_processor.py +4304 -687
- diffusers/models/autoencoders/__init__.py +8 -0
- diffusers/models/autoencoders/autoencoder_asym_kl.py +15 -17
- diffusers/models/autoencoders/autoencoder_dc.py +620 -0
- diffusers/models/autoencoders/autoencoder_kl.py +110 -28
- diffusers/models/autoencoders/autoencoder_kl_allegro.py +1149 -0
- diffusers/models/autoencoders/autoencoder_kl_cogvideox.py +1482 -0
- diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py +1176 -0
- diffusers/models/autoencoders/autoencoder_kl_ltx.py +1338 -0
- diffusers/models/autoencoders/autoencoder_kl_mochi.py +1166 -0
- diffusers/models/autoencoders/autoencoder_kl_temporal_decoder.py +19 -24
- diffusers/models/autoencoders/autoencoder_oobleck.py +464 -0
- diffusers/models/autoencoders/autoencoder_tiny.py +21 -18
- diffusers/models/autoencoders/consistency_decoder_vae.py +45 -20
- diffusers/models/autoencoders/vae.py +41 -29
- diffusers/models/autoencoders/vq_model.py +182 -0
- diffusers/models/controlnet.py +47 -800
- diffusers/models/controlnet_flux.py +70 -0
- diffusers/models/controlnet_sd3.py +68 -0
- diffusers/models/controlnet_sparsectrl.py +116 -0
- diffusers/models/controlnets/__init__.py +23 -0
- diffusers/models/controlnets/controlnet.py +872 -0
- diffusers/models/{controlnet_flax.py → controlnets/controlnet_flax.py} +9 -9
- diffusers/models/controlnets/controlnet_flux.py +536 -0
- diffusers/models/controlnets/controlnet_hunyuan.py +401 -0
- diffusers/models/controlnets/controlnet_sd3.py +489 -0
- diffusers/models/controlnets/controlnet_sparsectrl.py +788 -0
- diffusers/models/controlnets/controlnet_union.py +832 -0
- diffusers/models/controlnets/controlnet_xs.py +1946 -0
- diffusers/models/controlnets/multicontrolnet.py +183 -0
- diffusers/models/downsampling.py +85 -18
- diffusers/models/embeddings.py +1856 -158
- diffusers/models/embeddings_flax.py +23 -9
- diffusers/models/model_loading_utils.py +480 -0
- diffusers/models/modeling_flax_pytorch_utils.py +2 -1
- diffusers/models/modeling_flax_utils.py +2 -7
- diffusers/models/modeling_outputs.py +14 -0
- diffusers/models/modeling_pytorch_flax_utils.py +1 -1
- diffusers/models/modeling_utils.py +611 -146
- diffusers/models/normalization.py +361 -20
- diffusers/models/resnet.py +18 -23
- diffusers/models/transformers/__init__.py +16 -0
- diffusers/models/transformers/auraflow_transformer_2d.py +544 -0
- diffusers/models/transformers/cogvideox_transformer_3d.py +542 -0
- diffusers/models/transformers/dit_transformer_2d.py +240 -0
- diffusers/models/transformers/dual_transformer_2d.py +9 -8
- diffusers/models/transformers/hunyuan_transformer_2d.py +578 -0
- diffusers/models/transformers/latte_transformer_3d.py +327 -0
- diffusers/models/transformers/lumina_nextdit2d.py +340 -0
- diffusers/models/transformers/pixart_transformer_2d.py +445 -0
- diffusers/models/transformers/prior_transformer.py +13 -13
- diffusers/models/transformers/sana_transformer.py +488 -0
- diffusers/models/transformers/stable_audio_transformer.py +458 -0
- diffusers/models/transformers/t5_film_transformer.py +17 -19
- diffusers/models/transformers/transformer_2d.py +297 -187
- diffusers/models/transformers/transformer_allegro.py +422 -0
- diffusers/models/transformers/transformer_cogview3plus.py +386 -0
- diffusers/models/transformers/transformer_flux.py +593 -0
- diffusers/models/transformers/transformer_hunyuan_video.py +791 -0
- diffusers/models/transformers/transformer_ltx.py +469 -0
- diffusers/models/transformers/transformer_mochi.py +499 -0
- diffusers/models/transformers/transformer_sd3.py +461 -0
- diffusers/models/transformers/transformer_temporal.py +21 -19
- diffusers/models/unets/unet_1d.py +8 -8
- diffusers/models/unets/unet_1d_blocks.py +31 -31
- diffusers/models/unets/unet_2d.py +17 -10
- diffusers/models/unets/unet_2d_blocks.py +225 -149
- diffusers/models/unets/unet_2d_condition.py +41 -40
- diffusers/models/unets/unet_2d_condition_flax.py +6 -5
- diffusers/models/unets/unet_3d_blocks.py +192 -1057
- diffusers/models/unets/unet_3d_condition.py +22 -27
- diffusers/models/unets/unet_i2vgen_xl.py +22 -18
- diffusers/models/unets/unet_kandinsky3.py +2 -2
- diffusers/models/unets/unet_motion_model.py +1413 -89
- diffusers/models/unets/unet_spatio_temporal_condition.py +40 -16
- diffusers/models/unets/unet_stable_cascade.py +19 -18
- diffusers/models/unets/uvit_2d.py +2 -2
- diffusers/models/upsampling.py +95 -26
- diffusers/models/vq_model.py +12 -164
- diffusers/optimization.py +1 -1
- diffusers/pipelines/__init__.py +202 -3
- diffusers/pipelines/allegro/__init__.py +48 -0
- diffusers/pipelines/allegro/pipeline_allegro.py +938 -0
- diffusers/pipelines/allegro/pipeline_output.py +23 -0
- diffusers/pipelines/amused/pipeline_amused.py +12 -12
- diffusers/pipelines/amused/pipeline_amused_img2img.py +14 -12
- diffusers/pipelines/amused/pipeline_amused_inpaint.py +13 -11
- diffusers/pipelines/animatediff/__init__.py +8 -0
- diffusers/pipelines/animatediff/pipeline_animatediff.py +122 -109
- diffusers/pipelines/animatediff/pipeline_animatediff_controlnet.py +1106 -0
- diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py +1288 -0
- diffusers/pipelines/animatediff/pipeline_animatediff_sparsectrl.py +1010 -0
- diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py +236 -180
- diffusers/pipelines/animatediff/pipeline_animatediff_video2video_controlnet.py +1341 -0
- diffusers/pipelines/animatediff/pipeline_output.py +3 -2
- diffusers/pipelines/audioldm/pipeline_audioldm.py +14 -14
- diffusers/pipelines/audioldm2/modeling_audioldm2.py +58 -39
- diffusers/pipelines/audioldm2/pipeline_audioldm2.py +121 -36
- diffusers/pipelines/aura_flow/__init__.py +48 -0
- diffusers/pipelines/aura_flow/pipeline_aura_flow.py +584 -0
- diffusers/pipelines/auto_pipeline.py +196 -28
- diffusers/pipelines/blip_diffusion/blip_image_processing.py +1 -1
- diffusers/pipelines/blip_diffusion/modeling_blip2.py +6 -6
- diffusers/pipelines/blip_diffusion/modeling_ctx_clip.py +1 -1
- diffusers/pipelines/blip_diffusion/pipeline_blip_diffusion.py +2 -2
- diffusers/pipelines/cogvideo/__init__.py +54 -0
- diffusers/pipelines/cogvideo/pipeline_cogvideox.py +772 -0
- diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py +825 -0
- diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py +885 -0
- diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py +851 -0
- diffusers/pipelines/cogvideo/pipeline_output.py +20 -0
- diffusers/pipelines/cogview3/__init__.py +47 -0
- diffusers/pipelines/cogview3/pipeline_cogview3plus.py +674 -0
- diffusers/pipelines/cogview3/pipeline_output.py +21 -0
- diffusers/pipelines/consistency_models/pipeline_consistency_models.py +6 -6
- diffusers/pipelines/controlnet/__init__.py +86 -80
- diffusers/pipelines/controlnet/multicontrolnet.py +7 -182
- diffusers/pipelines/controlnet/pipeline_controlnet.py +134 -87
- diffusers/pipelines/controlnet/pipeline_controlnet_blip_diffusion.py +2 -2
- diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +93 -77
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py +88 -197
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py +136 -90
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py +176 -80
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py +125 -89
- diffusers/pipelines/controlnet/pipeline_controlnet_union_inpaint_sd_xl.py +1790 -0
- diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl.py +1501 -0
- diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl_img2img.py +1627 -0
- diffusers/pipelines/controlnet/pipeline_flax_controlnet.py +2 -2
- diffusers/pipelines/controlnet_hunyuandit/__init__.py +48 -0
- diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py +1060 -0
- diffusers/pipelines/controlnet_sd3/__init__.py +57 -0
- diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py +1133 -0
- diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet_inpainting.py +1153 -0
- diffusers/pipelines/controlnet_xs/__init__.py +68 -0
- diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs.py +916 -0
- diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs_sd_xl.py +1111 -0
- diffusers/pipelines/ddpm/pipeline_ddpm.py +2 -2
- diffusers/pipelines/deepfloyd_if/pipeline_if.py +16 -30
- diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py +20 -35
- diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py +23 -41
- diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py +22 -38
- diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py +25 -41
- diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py +19 -34
- diffusers/pipelines/deepfloyd_if/pipeline_output.py +6 -5
- diffusers/pipelines/deepfloyd_if/watermark.py +1 -1
- diffusers/pipelines/deprecated/alt_diffusion/modeling_roberta_series.py +11 -11
- diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py +70 -30
- diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py +48 -25
- diffusers/pipelines/deprecated/repaint/pipeline_repaint.py +2 -2
- diffusers/pipelines/deprecated/spectrogram_diffusion/pipeline_spectrogram_diffusion.py +7 -7
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py +21 -20
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py +27 -29
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_model_editing.py +33 -27
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_paradigms.py +33 -23
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py +36 -30
- diffusers/pipelines/deprecated/versatile_diffusion/modeling_text_unet.py +102 -69
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion.py +13 -13
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py +10 -5
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py +11 -6
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py +10 -5
- diffusers/pipelines/deprecated/vq_diffusion/pipeline_vq_diffusion.py +5 -5
- diffusers/pipelines/dit/pipeline_dit.py +7 -4
- diffusers/pipelines/flux/__init__.py +69 -0
- diffusers/pipelines/flux/modeling_flux.py +47 -0
- diffusers/pipelines/flux/pipeline_flux.py +957 -0
- diffusers/pipelines/flux/pipeline_flux_control.py +889 -0
- diffusers/pipelines/flux/pipeline_flux_control_img2img.py +945 -0
- diffusers/pipelines/flux/pipeline_flux_control_inpaint.py +1141 -0
- diffusers/pipelines/flux/pipeline_flux_controlnet.py +1006 -0
- diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py +998 -0
- diffusers/pipelines/flux/pipeline_flux_controlnet_inpainting.py +1204 -0
- diffusers/pipelines/flux/pipeline_flux_fill.py +969 -0
- diffusers/pipelines/flux/pipeline_flux_img2img.py +856 -0
- diffusers/pipelines/flux/pipeline_flux_inpaint.py +1022 -0
- diffusers/pipelines/flux/pipeline_flux_prior_redux.py +492 -0
- diffusers/pipelines/flux/pipeline_output.py +37 -0
- diffusers/pipelines/free_init_utils.py +41 -38
- diffusers/pipelines/free_noise_utils.py +596 -0
- diffusers/pipelines/hunyuan_video/__init__.py +48 -0
- diffusers/pipelines/hunyuan_video/pipeline_hunyuan_video.py +687 -0
- diffusers/pipelines/hunyuan_video/pipeline_output.py +20 -0
- diffusers/pipelines/hunyuandit/__init__.py +48 -0
- diffusers/pipelines/hunyuandit/pipeline_hunyuandit.py +916 -0
- diffusers/pipelines/i2vgen_xl/pipeline_i2vgen_xl.py +33 -48
- diffusers/pipelines/kandinsky/pipeline_kandinsky.py +8 -8
- diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py +32 -29
- diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py +11 -11
- diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py +12 -12
- diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py +10 -10
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py +6 -6
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_combined.py +34 -31
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py +10 -10
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py +10 -10
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py +6 -6
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py +8 -8
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior.py +7 -7
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py +6 -6
- diffusers/pipelines/kandinsky3/convert_kandinsky3_unet.py +3 -3
- diffusers/pipelines/kandinsky3/pipeline_kandinsky3.py +22 -35
- diffusers/pipelines/kandinsky3/pipeline_kandinsky3_img2img.py +26 -37
- diffusers/pipelines/kolors/__init__.py +54 -0
- diffusers/pipelines/kolors/pipeline_kolors.py +1070 -0
- diffusers/pipelines/kolors/pipeline_kolors_img2img.py +1250 -0
- diffusers/pipelines/kolors/pipeline_output.py +21 -0
- diffusers/pipelines/kolors/text_encoder.py +889 -0
- diffusers/pipelines/kolors/tokenizer.py +338 -0
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py +82 -62
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py +77 -60
- diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py +12 -12
- diffusers/pipelines/latte/__init__.py +48 -0
- diffusers/pipelines/latte/pipeline_latte.py +881 -0
- diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion.py +80 -74
- diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion_xl.py +85 -76
- diffusers/pipelines/ledits_pp/pipeline_output.py +2 -2
- diffusers/pipelines/ltx/__init__.py +50 -0
- diffusers/pipelines/ltx/pipeline_ltx.py +789 -0
- diffusers/pipelines/ltx/pipeline_ltx_image2video.py +885 -0
- diffusers/pipelines/ltx/pipeline_output.py +20 -0
- diffusers/pipelines/lumina/__init__.py +48 -0
- diffusers/pipelines/lumina/pipeline_lumina.py +890 -0
- diffusers/pipelines/marigold/__init__.py +50 -0
- diffusers/pipelines/marigold/marigold_image_processing.py +576 -0
- diffusers/pipelines/marigold/pipeline_marigold_depth.py +813 -0
- diffusers/pipelines/marigold/pipeline_marigold_normals.py +690 -0
- diffusers/pipelines/mochi/__init__.py +48 -0
- diffusers/pipelines/mochi/pipeline_mochi.py +748 -0
- diffusers/pipelines/mochi/pipeline_output.py +20 -0
- diffusers/pipelines/musicldm/pipeline_musicldm.py +14 -14
- diffusers/pipelines/pag/__init__.py +80 -0
- diffusers/pipelines/pag/pag_utils.py +243 -0
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd.py +1328 -0
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd_inpaint.py +1543 -0
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd_xl.py +1610 -0
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd_xl_img2img.py +1683 -0
- diffusers/pipelines/pag/pipeline_pag_hunyuandit.py +969 -0
- diffusers/pipelines/pag/pipeline_pag_kolors.py +1136 -0
- diffusers/pipelines/pag/pipeline_pag_pixart_sigma.py +865 -0
- diffusers/pipelines/pag/pipeline_pag_sana.py +886 -0
- diffusers/pipelines/pag/pipeline_pag_sd.py +1062 -0
- diffusers/pipelines/pag/pipeline_pag_sd_3.py +994 -0
- diffusers/pipelines/pag/pipeline_pag_sd_3_img2img.py +1058 -0
- diffusers/pipelines/pag/pipeline_pag_sd_animatediff.py +866 -0
- diffusers/pipelines/pag/pipeline_pag_sd_img2img.py +1094 -0
- diffusers/pipelines/pag/pipeline_pag_sd_inpaint.py +1356 -0
- diffusers/pipelines/pag/pipeline_pag_sd_xl.py +1345 -0
- diffusers/pipelines/pag/pipeline_pag_sd_xl_img2img.py +1544 -0
- diffusers/pipelines/pag/pipeline_pag_sd_xl_inpaint.py +1776 -0
- diffusers/pipelines/paint_by_example/pipeline_paint_by_example.py +17 -12
- diffusers/pipelines/pia/pipeline_pia.py +74 -164
- diffusers/pipelines/pipeline_flax_utils.py +5 -10
- diffusers/pipelines/pipeline_loading_utils.py +515 -53
- diffusers/pipelines/pipeline_utils.py +411 -222
- diffusers/pipelines/pixart_alpha/__init__.py +8 -1
- diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py +76 -93
- diffusers/pipelines/pixart_alpha/pipeline_pixart_sigma.py +873 -0
- diffusers/pipelines/sana/__init__.py +47 -0
- diffusers/pipelines/sana/pipeline_output.py +21 -0
- diffusers/pipelines/sana/pipeline_sana.py +884 -0
- diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py +27 -23
- diffusers/pipelines/shap_e/pipeline_shap_e.py +3 -3
- diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py +14 -14
- diffusers/pipelines/shap_e/renderer.py +1 -1
- diffusers/pipelines/stable_audio/__init__.py +50 -0
- diffusers/pipelines/stable_audio/modeling_stable_audio.py +158 -0
- diffusers/pipelines/stable_audio/pipeline_stable_audio.py +756 -0
- diffusers/pipelines/stable_cascade/pipeline_stable_cascade.py +71 -25
- diffusers/pipelines/stable_cascade/pipeline_stable_cascade_combined.py +23 -19
- diffusers/pipelines/stable_cascade/pipeline_stable_cascade_prior.py +35 -34
- diffusers/pipelines/stable_diffusion/__init__.py +0 -1
- diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +20 -11
- diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py +1 -1
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py +2 -2
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_upscale.py +6 -6
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +145 -79
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py +43 -28
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py +13 -8
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +100 -68
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +109 -201
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py +131 -32
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_latent_upscale.py +247 -87
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py +30 -29
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py +35 -27
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py +49 -42
- diffusers/pipelines/stable_diffusion/safety_checker.py +2 -1
- diffusers/pipelines/stable_diffusion_3/__init__.py +54 -0
- diffusers/pipelines/stable_diffusion_3/pipeline_output.py +21 -0
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py +1140 -0
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_img2img.py +1036 -0
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_inpaint.py +1250 -0
- diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py +29 -20
- diffusers/pipelines/stable_diffusion_diffedit/pipeline_stable_diffusion_diffedit.py +59 -58
- diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen.py +31 -25
- diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen_text_image.py +38 -22
- diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_k_diffusion.py +30 -24
- diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_xl_k_diffusion.py +24 -23
- diffusers/pipelines/stable_diffusion_ldm3d/pipeline_stable_diffusion_ldm3d.py +107 -67
- diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py +316 -69
- diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py +10 -5
- diffusers/pipelines/stable_diffusion_safe/safety_checker.py +1 -1
- diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py +98 -30
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +121 -83
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py +161 -105
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py +142 -218
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_instruct_pix2pix.py +45 -29
- diffusers/pipelines/stable_diffusion_xl/watermark.py +9 -3
- diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py +110 -57
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py +69 -39
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_xl_adapter.py +105 -74
- diffusers/pipelines/text_to_video_synthesis/pipeline_output.py +3 -2
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py +29 -49
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py +32 -93
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py +37 -25
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero_sdxl.py +54 -40
- diffusers/pipelines/unclip/pipeline_unclip.py +6 -6
- diffusers/pipelines/unclip/pipeline_unclip_image_variation.py +6 -6
- diffusers/pipelines/unidiffuser/modeling_text_decoder.py +1 -1
- diffusers/pipelines/unidiffuser/modeling_uvit.py +12 -12
- diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py +29 -28
- diffusers/pipelines/wuerstchen/modeling_paella_vq_model.py +5 -5
- diffusers/pipelines/wuerstchen/modeling_wuerstchen_common.py +5 -10
- diffusers/pipelines/wuerstchen/modeling_wuerstchen_prior.py +6 -8
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen.py +4 -4
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen_combined.py +12 -12
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen_prior.py +15 -14
- diffusers/{models/dual_transformer_2d.py → quantizers/__init__.py} +2 -6
- diffusers/quantizers/auto.py +139 -0
- diffusers/quantizers/base.py +233 -0
- diffusers/quantizers/bitsandbytes/__init__.py +2 -0
- diffusers/quantizers/bitsandbytes/bnb_quantizer.py +561 -0
- diffusers/quantizers/bitsandbytes/utils.py +306 -0
- diffusers/quantizers/gguf/__init__.py +1 -0
- diffusers/quantizers/gguf/gguf_quantizer.py +159 -0
- diffusers/quantizers/gguf/utils.py +456 -0
- diffusers/quantizers/quantization_config.py +669 -0
- diffusers/quantizers/torchao/__init__.py +15 -0
- diffusers/quantizers/torchao/torchao_quantizer.py +292 -0
- diffusers/schedulers/__init__.py +12 -2
- diffusers/schedulers/deprecated/__init__.py +1 -1
- diffusers/schedulers/deprecated/scheduling_karras_ve.py +25 -25
- diffusers/schedulers/scheduling_amused.py +5 -5
- diffusers/schedulers/scheduling_consistency_decoder.py +11 -11
- diffusers/schedulers/scheduling_consistency_models.py +23 -25
- diffusers/schedulers/scheduling_cosine_dpmsolver_multistep.py +572 -0
- diffusers/schedulers/scheduling_ddim.py +27 -26
- diffusers/schedulers/scheduling_ddim_cogvideox.py +452 -0
- diffusers/schedulers/scheduling_ddim_flax.py +2 -1
- diffusers/schedulers/scheduling_ddim_inverse.py +16 -16
- diffusers/schedulers/scheduling_ddim_parallel.py +32 -31
- diffusers/schedulers/scheduling_ddpm.py +27 -30
- diffusers/schedulers/scheduling_ddpm_flax.py +7 -3
- diffusers/schedulers/scheduling_ddpm_parallel.py +33 -36
- diffusers/schedulers/scheduling_ddpm_wuerstchen.py +14 -14
- diffusers/schedulers/scheduling_deis_multistep.py +150 -50
- diffusers/schedulers/scheduling_dpm_cogvideox.py +489 -0
- diffusers/schedulers/scheduling_dpmsolver_multistep.py +221 -84
- diffusers/schedulers/scheduling_dpmsolver_multistep_flax.py +2 -2
- diffusers/schedulers/scheduling_dpmsolver_multistep_inverse.py +158 -52
- diffusers/schedulers/scheduling_dpmsolver_sde.py +153 -34
- diffusers/schedulers/scheduling_dpmsolver_singlestep.py +275 -86
- diffusers/schedulers/scheduling_edm_dpmsolver_multistep.py +81 -57
- diffusers/schedulers/scheduling_edm_euler.py +62 -39
- diffusers/schedulers/scheduling_euler_ancestral_discrete.py +30 -29
- diffusers/schedulers/scheduling_euler_discrete.py +255 -74
- diffusers/schedulers/scheduling_flow_match_euler_discrete.py +458 -0
- diffusers/schedulers/scheduling_flow_match_heun_discrete.py +320 -0
- diffusers/schedulers/scheduling_heun_discrete.py +174 -46
- diffusers/schedulers/scheduling_ipndm.py +9 -9
- diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py +138 -29
- diffusers/schedulers/scheduling_k_dpm_2_discrete.py +132 -26
- diffusers/schedulers/scheduling_karras_ve_flax.py +6 -6
- diffusers/schedulers/scheduling_lcm.py +23 -29
- diffusers/schedulers/scheduling_lms_discrete.py +105 -28
- diffusers/schedulers/scheduling_pndm.py +20 -20
- diffusers/schedulers/scheduling_repaint.py +21 -21
- diffusers/schedulers/scheduling_sasolver.py +157 -60
- diffusers/schedulers/scheduling_sde_ve.py +19 -19
- diffusers/schedulers/scheduling_tcd.py +41 -36
- diffusers/schedulers/scheduling_unclip.py +19 -16
- diffusers/schedulers/scheduling_unipc_multistep.py +243 -47
- diffusers/schedulers/scheduling_utils.py +12 -5
- diffusers/schedulers/scheduling_utils_flax.py +1 -3
- diffusers/schedulers/scheduling_vq_diffusion.py +10 -10
- diffusers/training_utils.py +214 -30
- diffusers/utils/__init__.py +17 -1
- diffusers/utils/constants.py +3 -0
- diffusers/utils/doc_utils.py +1 -0
- diffusers/utils/dummy_pt_objects.py +592 -7
- diffusers/utils/dummy_torch_and_torchsde_objects.py +15 -0
- diffusers/utils/dummy_torch_and_transformers_and_sentencepiece_objects.py +47 -0
- diffusers/utils/dummy_torch_and_transformers_objects.py +1001 -71
- diffusers/utils/dynamic_modules_utils.py +34 -29
- diffusers/utils/export_utils.py +50 -6
- diffusers/utils/hub_utils.py +131 -17
- diffusers/utils/import_utils.py +210 -8
- diffusers/utils/loading_utils.py +118 -5
- diffusers/utils/logging.py +4 -2
- diffusers/utils/peft_utils.py +37 -7
- diffusers/utils/state_dict_utils.py +13 -2
- diffusers/utils/testing_utils.py +193 -11
- diffusers/utils/torch_utils.py +4 -0
- diffusers/video_processor.py +113 -0
- {diffusers-0.27.1.dist-info → diffusers-0.32.2.dist-info}/METADATA +82 -91
- diffusers-0.32.2.dist-info/RECORD +550 -0
- {diffusers-0.27.1.dist-info → diffusers-0.32.2.dist-info}/WHEEL +1 -1
- diffusers/loaders/autoencoder.py +0 -146
- diffusers/loaders/controlnet.py +0 -136
- diffusers/loaders/lora.py +0 -1349
- diffusers/models/prior_transformer.py +0 -12
- diffusers/models/t5_film_transformer.py +0 -70
- diffusers/models/transformer_2d.py +0 -25
- diffusers/models/transformer_temporal.py +0 -34
- diffusers/models/unet_1d.py +0 -26
- diffusers/models/unet_1d_blocks.py +0 -203
- diffusers/models/unet_2d.py +0 -27
- diffusers/models/unet_2d_blocks.py +0 -375
- diffusers/models/unet_2d_condition.py +0 -25
- diffusers-0.27.1.dist-info/RECORD +0 -399
- {diffusers-0.27.1.dist-info → diffusers-0.32.2.dist-info}/LICENSE +0 -0
- {diffusers-0.27.1.dist-info → diffusers-0.32.2.dist-info}/entry_points.txt +0 -0
- {diffusers-0.27.1.dist-info → diffusers-0.32.2.dist-info}/top_level.txt +0 -0
@@ -18,6 +18,10 @@ from collections import OrderedDict
|
|
18
18
|
from huggingface_hub.utils import validate_hf_hub_args
|
19
19
|
|
20
20
|
from ..configuration_utils import ConfigMixin
|
21
|
+
from ..models.controlnets import ControlNetUnionModel
|
22
|
+
from ..utils import is_sentencepiece_available
|
23
|
+
from .aura_flow import AuraFlowPipeline
|
24
|
+
from .cogview3 import CogView3PlusPipeline
|
21
25
|
from .controlnet import (
|
22
26
|
StableDiffusionControlNetImg2ImgPipeline,
|
23
27
|
StableDiffusionControlNetInpaintPipeline,
|
@@ -25,8 +29,23 @@ from .controlnet import (
|
|
25
29
|
StableDiffusionXLControlNetImg2ImgPipeline,
|
26
30
|
StableDiffusionXLControlNetInpaintPipeline,
|
27
31
|
StableDiffusionXLControlNetPipeline,
|
32
|
+
StableDiffusionXLControlNetUnionImg2ImgPipeline,
|
33
|
+
StableDiffusionXLControlNetUnionInpaintPipeline,
|
34
|
+
StableDiffusionXLControlNetUnionPipeline,
|
28
35
|
)
|
29
36
|
from .deepfloyd_if import IFImg2ImgPipeline, IFInpaintingPipeline, IFPipeline
|
37
|
+
from .flux import (
|
38
|
+
FluxControlImg2ImgPipeline,
|
39
|
+
FluxControlInpaintPipeline,
|
40
|
+
FluxControlNetImg2ImgPipeline,
|
41
|
+
FluxControlNetInpaintPipeline,
|
42
|
+
FluxControlNetPipeline,
|
43
|
+
FluxControlPipeline,
|
44
|
+
FluxImg2ImgPipeline,
|
45
|
+
FluxInpaintPipeline,
|
46
|
+
FluxPipeline,
|
47
|
+
)
|
48
|
+
from .hunyuandit import HunyuanDiTPipeline
|
30
49
|
from .kandinsky import (
|
31
50
|
KandinskyCombinedPipeline,
|
32
51
|
KandinskyImg2ImgCombinedPipeline,
|
@@ -45,12 +64,35 @@ from .kandinsky2_2 import (
|
|
45
64
|
)
|
46
65
|
from .kandinsky3 import Kandinsky3Img2ImgPipeline, Kandinsky3Pipeline
|
47
66
|
from .latent_consistency_models import LatentConsistencyModelImg2ImgPipeline, LatentConsistencyModelPipeline
|
48
|
-
from .
|
67
|
+
from .lumina import LuminaText2ImgPipeline
|
68
|
+
from .pag import (
|
69
|
+
HunyuanDiTPAGPipeline,
|
70
|
+
PixArtSigmaPAGPipeline,
|
71
|
+
StableDiffusion3PAGImg2ImgPipeline,
|
72
|
+
StableDiffusion3PAGPipeline,
|
73
|
+
StableDiffusionControlNetPAGInpaintPipeline,
|
74
|
+
StableDiffusionControlNetPAGPipeline,
|
75
|
+
StableDiffusionPAGImg2ImgPipeline,
|
76
|
+
StableDiffusionPAGInpaintPipeline,
|
77
|
+
StableDiffusionPAGPipeline,
|
78
|
+
StableDiffusionXLControlNetPAGImg2ImgPipeline,
|
79
|
+
StableDiffusionXLControlNetPAGPipeline,
|
80
|
+
StableDiffusionXLPAGImg2ImgPipeline,
|
81
|
+
StableDiffusionXLPAGInpaintPipeline,
|
82
|
+
StableDiffusionXLPAGPipeline,
|
83
|
+
)
|
84
|
+
from .pixart_alpha import PixArtAlphaPipeline, PixArtSigmaPipeline
|
85
|
+
from .stable_cascade import StableCascadeCombinedPipeline, StableCascadeDecoderPipeline
|
49
86
|
from .stable_diffusion import (
|
50
87
|
StableDiffusionImg2ImgPipeline,
|
51
88
|
StableDiffusionInpaintPipeline,
|
52
89
|
StableDiffusionPipeline,
|
53
90
|
)
|
91
|
+
from .stable_diffusion_3 import (
|
92
|
+
StableDiffusion3Img2ImgPipeline,
|
93
|
+
StableDiffusion3InpaintPipeline,
|
94
|
+
StableDiffusion3Pipeline,
|
95
|
+
)
|
54
96
|
from .stable_diffusion_xl import (
|
55
97
|
StableDiffusionXLImg2ImgPipeline,
|
56
98
|
StableDiffusionXLInpaintPipeline,
|
@@ -63,15 +105,33 @@ AUTO_TEXT2IMAGE_PIPELINES_MAPPING = OrderedDict(
|
|
63
105
|
[
|
64
106
|
("stable-diffusion", StableDiffusionPipeline),
|
65
107
|
("stable-diffusion-xl", StableDiffusionXLPipeline),
|
108
|
+
("stable-diffusion-3", StableDiffusion3Pipeline),
|
109
|
+
("stable-diffusion-3-pag", StableDiffusion3PAGPipeline),
|
66
110
|
("if", IFPipeline),
|
111
|
+
("hunyuan", HunyuanDiTPipeline),
|
112
|
+
("hunyuan-pag", HunyuanDiTPAGPipeline),
|
67
113
|
("kandinsky", KandinskyCombinedPipeline),
|
68
114
|
("kandinsky22", KandinskyV22CombinedPipeline),
|
69
115
|
("kandinsky3", Kandinsky3Pipeline),
|
70
116
|
("stable-diffusion-controlnet", StableDiffusionControlNetPipeline),
|
71
117
|
("stable-diffusion-xl-controlnet", StableDiffusionXLControlNetPipeline),
|
118
|
+
("stable-diffusion-xl-controlnet-union", StableDiffusionXLControlNetUnionPipeline),
|
72
119
|
("wuerstchen", WuerstchenCombinedPipeline),
|
120
|
+
("cascade", StableCascadeCombinedPipeline),
|
73
121
|
("lcm", LatentConsistencyModelPipeline),
|
74
|
-
("pixart", PixArtAlphaPipeline),
|
122
|
+
("pixart-alpha", PixArtAlphaPipeline),
|
123
|
+
("pixart-sigma", PixArtSigmaPipeline),
|
124
|
+
("stable-diffusion-pag", StableDiffusionPAGPipeline),
|
125
|
+
("stable-diffusion-controlnet-pag", StableDiffusionControlNetPAGPipeline),
|
126
|
+
("stable-diffusion-xl-pag", StableDiffusionXLPAGPipeline),
|
127
|
+
("stable-diffusion-xl-controlnet-pag", StableDiffusionXLControlNetPAGPipeline),
|
128
|
+
("pixart-sigma-pag", PixArtSigmaPAGPipeline),
|
129
|
+
("auraflow", AuraFlowPipeline),
|
130
|
+
("flux", FluxPipeline),
|
131
|
+
("flux-control", FluxControlPipeline),
|
132
|
+
("flux-controlnet", FluxControlNetPipeline),
|
133
|
+
("lumina", LuminaText2ImgPipeline),
|
134
|
+
("cogview3", CogView3PlusPipeline),
|
75
135
|
]
|
76
136
|
)
|
77
137
|
|
@@ -79,13 +139,22 @@ AUTO_IMAGE2IMAGE_PIPELINES_MAPPING = OrderedDict(
|
|
79
139
|
[
|
80
140
|
("stable-diffusion", StableDiffusionImg2ImgPipeline),
|
81
141
|
("stable-diffusion-xl", StableDiffusionXLImg2ImgPipeline),
|
142
|
+
("stable-diffusion-3", StableDiffusion3Img2ImgPipeline),
|
143
|
+
("stable-diffusion-3-pag", StableDiffusion3PAGImg2ImgPipeline),
|
82
144
|
("if", IFImg2ImgPipeline),
|
83
145
|
("kandinsky", KandinskyImg2ImgCombinedPipeline),
|
84
146
|
("kandinsky22", KandinskyV22Img2ImgCombinedPipeline),
|
85
147
|
("kandinsky3", Kandinsky3Img2ImgPipeline),
|
86
148
|
("stable-diffusion-controlnet", StableDiffusionControlNetImg2ImgPipeline),
|
149
|
+
("stable-diffusion-pag", StableDiffusionPAGImg2ImgPipeline),
|
87
150
|
("stable-diffusion-xl-controlnet", StableDiffusionXLControlNetImg2ImgPipeline),
|
151
|
+
("stable-diffusion-xl-controlnet-union", StableDiffusionXLControlNetUnionImg2ImgPipeline),
|
152
|
+
("stable-diffusion-xl-pag", StableDiffusionXLPAGImg2ImgPipeline),
|
153
|
+
("stable-diffusion-xl-controlnet-pag", StableDiffusionXLControlNetPAGImg2ImgPipeline),
|
88
154
|
("lcm", LatentConsistencyModelImg2ImgPipeline),
|
155
|
+
("flux", FluxImg2ImgPipeline),
|
156
|
+
("flux-controlnet", FluxControlNetImg2ImgPipeline),
|
157
|
+
("flux-control", FluxControlImg2ImgPipeline),
|
89
158
|
]
|
90
159
|
)
|
91
160
|
|
@@ -93,11 +162,19 @@ AUTO_INPAINT_PIPELINES_MAPPING = OrderedDict(
|
|
93
162
|
[
|
94
163
|
("stable-diffusion", StableDiffusionInpaintPipeline),
|
95
164
|
("stable-diffusion-xl", StableDiffusionXLInpaintPipeline),
|
165
|
+
("stable-diffusion-3", StableDiffusion3InpaintPipeline),
|
96
166
|
("if", IFInpaintingPipeline),
|
97
167
|
("kandinsky", KandinskyInpaintCombinedPipeline),
|
98
168
|
("kandinsky22", KandinskyV22InpaintCombinedPipeline),
|
99
169
|
("stable-diffusion-controlnet", StableDiffusionControlNetInpaintPipeline),
|
170
|
+
("stable-diffusion-controlnet-pag", StableDiffusionControlNetPAGInpaintPipeline),
|
100
171
|
("stable-diffusion-xl-controlnet", StableDiffusionXLControlNetInpaintPipeline),
|
172
|
+
("stable-diffusion-xl-controlnet-union", StableDiffusionXLControlNetUnionInpaintPipeline),
|
173
|
+
("stable-diffusion-xl-pag", StableDiffusionXLPAGInpaintPipeline),
|
174
|
+
("flux", FluxInpaintPipeline),
|
175
|
+
("flux-controlnet", FluxControlNetInpaintPipeline),
|
176
|
+
("flux-control", FluxControlInpaintPipeline),
|
177
|
+
("stable-diffusion-pag", StableDiffusionPAGInpaintPipeline),
|
101
178
|
]
|
102
179
|
)
|
103
180
|
|
@@ -106,6 +183,7 @@ _AUTO_TEXT2IMAGE_DECODER_PIPELINES_MAPPING = OrderedDict(
|
|
106
183
|
("kandinsky", KandinskyPipeline),
|
107
184
|
("kandinsky22", KandinskyV22Pipeline),
|
108
185
|
("wuerstchen", WuerstchenDecoderPipeline),
|
186
|
+
("cascade", StableCascadeDecoderPipeline),
|
109
187
|
]
|
110
188
|
)
|
111
189
|
_AUTO_IMAGE2IMAGE_DECODER_PIPELINES_MAPPING = OrderedDict(
|
@@ -121,6 +199,14 @@ _AUTO_INPAINT_DECODER_PIPELINES_MAPPING = OrderedDict(
|
|
121
199
|
]
|
122
200
|
)
|
123
201
|
|
202
|
+
if is_sentencepiece_available():
|
203
|
+
from .kolors import KolorsImg2ImgPipeline, KolorsPipeline
|
204
|
+
from .pag import KolorsPAGPipeline
|
205
|
+
|
206
|
+
AUTO_TEXT2IMAGE_PIPELINES_MAPPING["kolors"] = KolorsPipeline
|
207
|
+
AUTO_TEXT2IMAGE_PIPELINES_MAPPING["kolors-pag"] = KolorsPAGPipeline
|
208
|
+
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING["kolors"] = KolorsImg2ImgPipeline
|
209
|
+
|
124
210
|
SUPPORTED_TASKS_MAPPINGS = [
|
125
211
|
AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
|
126
212
|
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
|
@@ -213,7 +299,7 @@ class AutoPipelineForText2Image(ConfigMixin):
|
|
213
299
|
```
|
214
300
|
|
215
301
|
Parameters:
|
216
|
-
|
302
|
+
pretrained_model_or_path (`str` or `os.PathLike`, *optional*):
|
217
303
|
Can be either:
|
218
304
|
|
219
305
|
- A string, the *repo id* (for example `CompVis/ldm-text2im-large-256`) of a pretrained pipeline
|
@@ -230,9 +316,7 @@ class AutoPipelineForText2Image(ConfigMixin):
|
|
230
316
|
cache_dir (`Union[str, os.PathLike]`, *optional*):
|
231
317
|
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
|
232
318
|
is not used.
|
233
|
-
|
234
|
-
Whether or not to resume downloading the model weights and configuration files. If set to `False`, any
|
235
|
-
incompletely downloaded files are deleted.
|
319
|
+
|
236
320
|
proxies (`Dict[str, str]`, *optional*):
|
237
321
|
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
|
238
322
|
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
|
@@ -307,7 +391,6 @@ class AutoPipelineForText2Image(ConfigMixin):
|
|
307
391
|
"""
|
308
392
|
cache_dir = kwargs.pop("cache_dir", None)
|
309
393
|
force_download = kwargs.pop("force_download", False)
|
310
|
-
resume_download = kwargs.pop("resume_download", False)
|
311
394
|
proxies = kwargs.pop("proxies", None)
|
312
395
|
token = kwargs.pop("token", None)
|
313
396
|
local_files_only = kwargs.pop("local_files_only", False)
|
@@ -316,7 +399,6 @@ class AutoPipelineForText2Image(ConfigMixin):
|
|
316
399
|
load_config_kwargs = {
|
317
400
|
"cache_dir": cache_dir,
|
318
401
|
"force_download": force_download,
|
319
|
-
"resume_download": resume_download,
|
320
402
|
"proxies": proxies,
|
321
403
|
"token": token,
|
322
404
|
"local_files_only": local_files_only,
|
@@ -325,9 +407,20 @@ class AutoPipelineForText2Image(ConfigMixin):
|
|
325
407
|
|
326
408
|
config = cls.load_config(pretrained_model_or_path, **load_config_kwargs)
|
327
409
|
orig_class_name = config["_class_name"]
|
410
|
+
if "ControlPipeline" in orig_class_name:
|
411
|
+
to_replace = "ControlPipeline"
|
412
|
+
else:
|
413
|
+
to_replace = "Pipeline"
|
328
414
|
|
329
415
|
if "controlnet" in kwargs:
|
330
|
-
|
416
|
+
if isinstance(kwargs["controlnet"], ControlNetUnionModel):
|
417
|
+
orig_class_name = config["_class_name"].replace(to_replace, "ControlNetUnionPipeline")
|
418
|
+
else:
|
419
|
+
orig_class_name = config["_class_name"].replace(to_replace, "ControlNetPipeline")
|
420
|
+
if "enable_pag" in kwargs:
|
421
|
+
enable_pag = kwargs.pop("enable_pag")
|
422
|
+
if enable_pag:
|
423
|
+
orig_class_name = orig_class_name.replace(to_replace, "PAGPipeline")
|
331
424
|
|
332
425
|
text_2_image_cls = _get_task_class(AUTO_TEXT2IMAGE_PIPELINES_MAPPING, orig_class_name)
|
333
426
|
|
@@ -371,14 +464,28 @@ class AutoPipelineForText2Image(ConfigMixin):
|
|
371
464
|
|
372
465
|
if "controlnet" in kwargs:
|
373
466
|
if kwargs["controlnet"] is not None:
|
467
|
+
to_replace = "PAGPipeline" if "PAG" in text_2_image_cls.__name__ else "Pipeline"
|
468
|
+
text_2_image_cls = _get_task_class(
|
469
|
+
AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
|
470
|
+
text_2_image_cls.__name__.replace("ControlNet", "").replace(to_replace, "ControlNet" + to_replace),
|
471
|
+
)
|
472
|
+
else:
|
473
|
+
text_2_image_cls = _get_task_class(
|
474
|
+
AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
|
475
|
+
text_2_image_cls.__name__.replace("ControlNet", ""),
|
476
|
+
)
|
477
|
+
|
478
|
+
if "enable_pag" in kwargs:
|
479
|
+
enable_pag = kwargs.pop("enable_pag")
|
480
|
+
if enable_pag:
|
374
481
|
text_2_image_cls = _get_task_class(
|
375
482
|
AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
|
376
|
-
text_2_image_cls.__name__.replace("
|
483
|
+
text_2_image_cls.__name__.replace("PAG", "").replace("Pipeline", "PAGPipeline"),
|
377
484
|
)
|
378
485
|
else:
|
379
486
|
text_2_image_cls = _get_task_class(
|
380
487
|
AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
|
381
|
-
text_2_image_cls.__name__.replace("
|
488
|
+
text_2_image_cls.__name__.replace("PAG", ""),
|
382
489
|
)
|
383
490
|
|
384
491
|
# define expected module and optional kwargs given the pipeline signature
|
@@ -486,7 +593,7 @@ class AutoPipelineForImage2Image(ConfigMixin):
|
|
486
593
|
```
|
487
594
|
|
488
595
|
Parameters:
|
489
|
-
|
596
|
+
pretrained_model_or_path (`str` or `os.PathLike`, *optional*):
|
490
597
|
Can be either:
|
491
598
|
|
492
599
|
- A string, the *repo id* (for example `CompVis/ldm-text2im-large-256`) of a pretrained pipeline
|
@@ -503,9 +610,7 @@ class AutoPipelineForImage2Image(ConfigMixin):
|
|
503
610
|
cache_dir (`Union[str, os.PathLike]`, *optional*):
|
504
611
|
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
|
505
612
|
is not used.
|
506
|
-
|
507
|
-
Whether or not to resume downloading the model weights and configuration files. If set to `False`, any
|
508
|
-
incompletely downloaded files are deleted.
|
613
|
+
|
509
614
|
proxies (`Dict[str, str]`, *optional*):
|
510
615
|
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
|
511
616
|
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
|
@@ -580,7 +685,6 @@ class AutoPipelineForImage2Image(ConfigMixin):
|
|
580
685
|
"""
|
581
686
|
cache_dir = kwargs.pop("cache_dir", None)
|
582
687
|
force_download = kwargs.pop("force_download", False)
|
583
|
-
resume_download = kwargs.pop("resume_download", False)
|
584
688
|
proxies = kwargs.pop("proxies", None)
|
585
689
|
token = kwargs.pop("token", None)
|
586
690
|
local_files_only = kwargs.pop("local_files_only", False)
|
@@ -589,7 +693,6 @@ class AutoPipelineForImage2Image(ConfigMixin):
|
|
589
693
|
load_config_kwargs = {
|
590
694
|
"cache_dir": cache_dir,
|
591
695
|
"force_download": force_download,
|
592
|
-
"resume_download": resume_download,
|
593
696
|
"proxies": proxies,
|
594
697
|
"token": token,
|
595
698
|
"local_files_only": local_files_only,
|
@@ -599,8 +702,29 @@ class AutoPipelineForImage2Image(ConfigMixin):
|
|
599
702
|
config = cls.load_config(pretrained_model_or_path, **load_config_kwargs)
|
600
703
|
orig_class_name = config["_class_name"]
|
601
704
|
|
705
|
+
# the `orig_class_name` can be:
|
706
|
+
# `- *Pipeline` (for regular text-to-image checkpoint)
|
707
|
+
# - `*ControlPipeline` (for Flux tools specific checkpoint)
|
708
|
+
# `- *Img2ImgPipeline` (for refiner checkpoint)
|
709
|
+
if "Img2Img" in orig_class_name:
|
710
|
+
to_replace = "Img2ImgPipeline"
|
711
|
+
elif "ControlPipeline" in orig_class_name:
|
712
|
+
to_replace = "ControlPipeline"
|
713
|
+
else:
|
714
|
+
to_replace = "Pipeline"
|
715
|
+
|
602
716
|
if "controlnet" in kwargs:
|
603
|
-
|
717
|
+
if isinstance(kwargs["controlnet"], ControlNetUnionModel):
|
718
|
+
orig_class_name = orig_class_name.replace(to_replace, "ControlNetUnion" + to_replace)
|
719
|
+
else:
|
720
|
+
orig_class_name = orig_class_name.replace(to_replace, "ControlNet" + to_replace)
|
721
|
+
if "enable_pag" in kwargs:
|
722
|
+
enable_pag = kwargs.pop("enable_pag")
|
723
|
+
if enable_pag:
|
724
|
+
orig_class_name = orig_class_name.replace(to_replace, "PAG" + to_replace)
|
725
|
+
|
726
|
+
if to_replace == "ControlPipeline":
|
727
|
+
orig_class_name = orig_class_name.replace(to_replace, "ControlImg2ImgPipeline")
|
604
728
|
|
605
729
|
image_2_image_cls = _get_task_class(AUTO_IMAGE2IMAGE_PIPELINES_MAPPING, orig_class_name)
|
606
730
|
|
@@ -646,16 +770,32 @@ class AutoPipelineForImage2Image(ConfigMixin):
|
|
646
770
|
|
647
771
|
if "controlnet" in kwargs:
|
648
772
|
if kwargs["controlnet"] is not None:
|
773
|
+
to_replace = "Img2ImgPipeline"
|
774
|
+
if "PAG" in image_2_image_cls.__name__:
|
775
|
+
to_replace = "PAG" + to_replace
|
649
776
|
image_2_image_cls = _get_task_class(
|
650
777
|
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
|
651
778
|
image_2_image_cls.__name__.replace("ControlNet", "").replace(
|
652
|
-
|
779
|
+
to_replace, "ControlNet" + to_replace
|
653
780
|
),
|
654
781
|
)
|
655
782
|
else:
|
656
783
|
image_2_image_cls = _get_task_class(
|
657
784
|
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
|
658
|
-
image_2_image_cls.__name__.replace("
|
785
|
+
image_2_image_cls.__name__.replace("ControlNet", ""),
|
786
|
+
)
|
787
|
+
|
788
|
+
if "enable_pag" in kwargs:
|
789
|
+
enable_pag = kwargs.pop("enable_pag")
|
790
|
+
if enable_pag:
|
791
|
+
image_2_image_cls = _get_task_class(
|
792
|
+
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
|
793
|
+
image_2_image_cls.__name__.replace("PAG", "").replace("Img2ImgPipeline", "PAGImg2ImgPipeline"),
|
794
|
+
)
|
795
|
+
else:
|
796
|
+
image_2_image_cls = _get_task_class(
|
797
|
+
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
|
798
|
+
image_2_image_cls.__name__.replace("PAG", ""),
|
659
799
|
)
|
660
800
|
|
661
801
|
# define expected module and optional kwargs given the pipeline signature
|
@@ -762,7 +902,7 @@ class AutoPipelineForInpainting(ConfigMixin):
|
|
762
902
|
```
|
763
903
|
|
764
904
|
Parameters:
|
765
|
-
|
905
|
+
pretrained_model_or_path (`str` or `os.PathLike`, *optional*):
|
766
906
|
Can be either:
|
767
907
|
|
768
908
|
- A string, the *repo id* (for example `CompVis/ldm-text2im-large-256`) of a pretrained pipeline
|
@@ -779,9 +919,7 @@ class AutoPipelineForInpainting(ConfigMixin):
|
|
779
919
|
cache_dir (`Union[str, os.PathLike]`, *optional*):
|
780
920
|
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
|
781
921
|
is not used.
|
782
|
-
|
783
|
-
Whether or not to resume downloading the model weights and configuration files. If set to `False`, any
|
784
|
-
incompletely downloaded files are deleted.
|
922
|
+
|
785
923
|
proxies (`Dict[str, str]`, *optional*):
|
786
924
|
A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
|
787
925
|
'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
|
@@ -856,7 +994,6 @@ class AutoPipelineForInpainting(ConfigMixin):
|
|
856
994
|
"""
|
857
995
|
cache_dir = kwargs.pop("cache_dir", None)
|
858
996
|
force_download = kwargs.pop("force_download", False)
|
859
|
-
resume_download = kwargs.pop("resume_download", False)
|
860
997
|
proxies = kwargs.pop("proxies", None)
|
861
998
|
token = kwargs.pop("token", None)
|
862
999
|
local_files_only = kwargs.pop("local_files_only", False)
|
@@ -865,7 +1002,6 @@ class AutoPipelineForInpainting(ConfigMixin):
|
|
865
1002
|
load_config_kwargs = {
|
866
1003
|
"cache_dir": cache_dir,
|
867
1004
|
"force_download": force_download,
|
868
|
-
"resume_download": resume_download,
|
869
1005
|
"proxies": proxies,
|
870
1006
|
"token": token,
|
871
1007
|
"local_files_only": local_files_only,
|
@@ -875,9 +1011,28 @@ class AutoPipelineForInpainting(ConfigMixin):
|
|
875
1011
|
config = cls.load_config(pretrained_model_or_path, **load_config_kwargs)
|
876
1012
|
orig_class_name = config["_class_name"]
|
877
1013
|
|
878
|
-
|
879
|
-
|
1014
|
+
# The `orig_class_name`` can be:
|
1015
|
+
# `- *InpaintPipeline` (for inpaint-specific checkpoint)
|
1016
|
+
# - `*ControlPipeline` (for Flux tools specific checkpoint)
|
1017
|
+
# - or *Pipeline (for regular text-to-image checkpoint)
|
1018
|
+
if "Inpaint" in orig_class_name:
|
1019
|
+
to_replace = "InpaintPipeline"
|
1020
|
+
elif "ControlPipeline" in orig_class_name:
|
1021
|
+
to_replace = "ControlPipeline"
|
1022
|
+
else:
|
1023
|
+
to_replace = "Pipeline"
|
880
1024
|
|
1025
|
+
if "controlnet" in kwargs:
|
1026
|
+
if isinstance(kwargs["controlnet"], ControlNetUnionModel):
|
1027
|
+
orig_class_name = orig_class_name.replace(to_replace, "ControlNetUnion" + to_replace)
|
1028
|
+
else:
|
1029
|
+
orig_class_name = orig_class_name.replace(to_replace, "ControlNet" + to_replace)
|
1030
|
+
if "enable_pag" in kwargs:
|
1031
|
+
enable_pag = kwargs.pop("enable_pag")
|
1032
|
+
if enable_pag:
|
1033
|
+
orig_class_name = orig_class_name.replace(to_replace, "PAG" + to_replace)
|
1034
|
+
if to_replace == "ControlPipeline":
|
1035
|
+
orig_class_name = orig_class_name.replace(to_replace, "ControlInpaintPipeline")
|
881
1036
|
inpainting_cls = _get_task_class(AUTO_INPAINT_PIPELINES_MAPPING, orig_class_name)
|
882
1037
|
|
883
1038
|
kwargs = {**load_config_kwargs, **kwargs}
|
@@ -933,6 +1088,19 @@ class AutoPipelineForInpainting(ConfigMixin):
|
|
933
1088
|
inpainting_cls.__name__.replace("ControlNetInpaintPipeline", "InpaintPipeline"),
|
934
1089
|
)
|
935
1090
|
|
1091
|
+
if "enable_pag" in kwargs:
|
1092
|
+
enable_pag = kwargs.pop("enable_pag")
|
1093
|
+
if enable_pag:
|
1094
|
+
inpainting_cls = _get_task_class(
|
1095
|
+
AUTO_INPAINT_PIPELINES_MAPPING,
|
1096
|
+
inpainting_cls.__name__.replace("PAG", "").replace("InpaintPipeline", "PAGInpaintPipeline"),
|
1097
|
+
)
|
1098
|
+
else:
|
1099
|
+
inpainting_cls = _get_task_class(
|
1100
|
+
AUTO_INPAINT_PIPELINES_MAPPING,
|
1101
|
+
inpainting_cls.__name__.replace("PAGInpaintPipeline", "InpaintPipeline"),
|
1102
|
+
)
|
1103
|
+
|
936
1104
|
# define expected module and optional kwargs given the pipeline signature
|
937
1105
|
expected_modules, optional_kwargs = inpainting_cls._get_signature_keys(inpainting_cls)
|
938
1106
|
|
@@ -298,7 +298,7 @@ class BlipImageProcessor(BaseImageProcessor):
|
|
298
298
|
return encoded_outputs
|
299
299
|
|
300
300
|
# Follows diffusers.VaeImageProcessor.postprocess
|
301
|
-
def postprocess(self, sample: torch.
|
301
|
+
def postprocess(self, sample: torch.Tensor, output_type: str = "pil"):
|
302
302
|
if output_type not in ["pt", "np", "pil"]:
|
303
303
|
raise ValueError(
|
304
304
|
f"output_type={output_type} is not supported. Make sure to choose one of ['pt', 'np', or 'pil']"
|
@@ -117,7 +117,7 @@ class Blip2VisionEmbeddings(nn.Module):
|
|
117
117
|
|
118
118
|
self.position_embedding = nn.Parameter(torch.randn(1, self.num_positions, self.embed_dim))
|
119
119
|
|
120
|
-
def forward(self, pixel_values: torch.
|
120
|
+
def forward(self, pixel_values: torch.Tensor) -> torch.Tensor:
|
121
121
|
batch_size = pixel_values.shape[0]
|
122
122
|
target_dtype = self.patch_embedding.weight.dtype
|
123
123
|
patch_embeds = self.patch_embedding(pixel_values.to(dtype=target_dtype)) # shape = [*, width, grid, grid]
|
@@ -167,7 +167,7 @@ class Blip2QFormerEncoder(nn.Module):
|
|
167
167
|
layer_head_mask = head_mask[i] if head_mask is not None else None
|
168
168
|
past_key_value = past_key_values[i] if past_key_values is not None else None
|
169
169
|
|
170
|
-
if getattr(self.config, "gradient_checkpointing", False) and
|
170
|
+
if getattr(self.config, "gradient_checkpointing", False) and torch.is_grad_enabled():
|
171
171
|
if use_cache:
|
172
172
|
logger.warning(
|
173
173
|
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
@@ -376,7 +376,7 @@ class Blip2VisionModel(Blip2PreTrainedModel):
|
|
376
376
|
@replace_return_docstrings(output_type=BaseModelOutputWithPooling, config_class=Blip2VisionConfig)
|
377
377
|
def forward(
|
378
378
|
self,
|
379
|
-
pixel_values: Optional[torch.
|
379
|
+
pixel_values: Optional[torch.Tensor] = None,
|
380
380
|
output_attentions: Optional[bool] = None,
|
381
381
|
output_hidden_states: Optional[bool] = None,
|
382
382
|
return_dict: Optional[bool] = None,
|
@@ -524,15 +524,15 @@ class Blip2QFormerModel(Blip2PreTrainedModel):
|
|
524
524
|
return_dict=None,
|
525
525
|
):
|
526
526
|
r"""
|
527
|
-
encoder_hidden_states (`torch.
|
527
|
+
encoder_hidden_states (`torch.Tensor` of shape `(batch_size, sequence_length, hidden_size)`, `optional`):
|
528
528
|
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
|
529
529
|
the model is configured as a decoder.
|
530
|
-
encoder_attention_mask (`torch.
|
530
|
+
encoder_attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, `optional`):
|
531
531
|
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
|
532
532
|
the cross-attention if the model is configured as a decoder. Mask values selected in `[0, 1]`:
|
533
533
|
- 1 for tokens that are **not masked**,
|
534
534
|
- 0 for tokens that are **masked**.
|
535
|
-
past_key_values (`tuple(tuple(torch.
|
535
|
+
past_key_values (`tuple(tuple(torch.Tensor))` of length `config.n_layers` with each tuple having 4 tensors of:
|
536
536
|
shape `(batch_size, num_heads, sequence_length - 1, embed_size_per_head)`): Contains precomputed key and
|
537
537
|
value hidden states of the attention blocks. Can be used to speed up decoding. If `past_key_values` are
|
538
538
|
used, the user can optionally input only the last `decoder_input_ids` (those that don't have their past key
|
@@ -186,7 +186,7 @@ class ContextCLIPTextEmbeddings(nn.Module):
|
|
186
186
|
ctx_begin_pos: list,
|
187
187
|
input_ids: Optional[torch.LongTensor] = None,
|
188
188
|
position_ids: Optional[torch.LongTensor] = None,
|
189
|
-
inputs_embeds: Optional[torch.
|
189
|
+
inputs_embeds: Optional[torch.Tensor] = None,
|
190
190
|
) -> torch.Tensor:
|
191
191
|
if ctx_embeddings is None:
|
192
192
|
ctx_len = 0
|
@@ -191,7 +191,7 @@ class BlipDiffusionPipeline(DiffusionPipeline):
|
|
191
191
|
reference_image: PIL.Image.Image,
|
192
192
|
source_subject_category: List[str],
|
193
193
|
target_subject_category: List[str],
|
194
|
-
latents: Optional[torch.
|
194
|
+
latents: Optional[torch.Tensor] = None,
|
195
195
|
guidance_scale: float = 7.5,
|
196
196
|
height: int = 512,
|
197
197
|
width: int = 512,
|
@@ -215,7 +215,7 @@ class BlipDiffusionPipeline(DiffusionPipeline):
|
|
215
215
|
The source subject category.
|
216
216
|
target_subject_category (`List[str]`):
|
217
217
|
The target subject category.
|
218
|
-
latents (`torch.
|
218
|
+
latents (`torch.Tensor`, *optional*):
|
219
219
|
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
|
220
220
|
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
|
221
221
|
tensor will ge generated by random sampling.
|
@@ -0,0 +1,54 @@
|
|
1
|
+
from typing import TYPE_CHECKING
|
2
|
+
|
3
|
+
from ...utils import (
|
4
|
+
DIFFUSERS_SLOW_IMPORT,
|
5
|
+
OptionalDependencyNotAvailable,
|
6
|
+
_LazyModule,
|
7
|
+
get_objects_from_module,
|
8
|
+
is_torch_available,
|
9
|
+
is_transformers_available,
|
10
|
+
)
|
11
|
+
|
12
|
+
|
13
|
+
_dummy_objects = {}
|
14
|
+
_import_structure = {}
|
15
|
+
|
16
|
+
|
17
|
+
try:
|
18
|
+
if not (is_transformers_available() and is_torch_available()):
|
19
|
+
raise OptionalDependencyNotAvailable()
|
20
|
+
except OptionalDependencyNotAvailable:
|
21
|
+
from ...utils import dummy_torch_and_transformers_objects # noqa F403
|
22
|
+
|
23
|
+
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
|
24
|
+
else:
|
25
|
+
_import_structure["pipeline_cogvideox"] = ["CogVideoXPipeline"]
|
26
|
+
_import_structure["pipeline_cogvideox_fun_control"] = ["CogVideoXFunControlPipeline"]
|
27
|
+
_import_structure["pipeline_cogvideox_image2video"] = ["CogVideoXImageToVideoPipeline"]
|
28
|
+
_import_structure["pipeline_cogvideox_video2video"] = ["CogVideoXVideoToVideoPipeline"]
|
29
|
+
|
30
|
+
if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
|
31
|
+
try:
|
32
|
+
if not (is_transformers_available() and is_torch_available()):
|
33
|
+
raise OptionalDependencyNotAvailable()
|
34
|
+
|
35
|
+
except OptionalDependencyNotAvailable:
|
36
|
+
from ...utils.dummy_torch_and_transformers_objects import *
|
37
|
+
else:
|
38
|
+
from .pipeline_cogvideox import CogVideoXPipeline
|
39
|
+
from .pipeline_cogvideox_fun_control import CogVideoXFunControlPipeline
|
40
|
+
from .pipeline_cogvideox_image2video import CogVideoXImageToVideoPipeline
|
41
|
+
from .pipeline_cogvideox_video2video import CogVideoXVideoToVideoPipeline
|
42
|
+
|
43
|
+
else:
|
44
|
+
import sys
|
45
|
+
|
46
|
+
sys.modules[__name__] = _LazyModule(
|
47
|
+
__name__,
|
48
|
+
globals()["__file__"],
|
49
|
+
_import_structure,
|
50
|
+
module_spec=__spec__,
|
51
|
+
)
|
52
|
+
|
53
|
+
for name, value in _dummy_objects.items():
|
54
|
+
setattr(sys.modules[__name__], name, value)
|