diffusers 0.32.2__py3-none-any.whl → 0.33.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diffusers/__init__.py +186 -3
- diffusers/configuration_utils.py +40 -12
- diffusers/dependency_versions_table.py +9 -2
- diffusers/hooks/__init__.py +9 -0
- diffusers/hooks/faster_cache.py +653 -0
- diffusers/hooks/group_offloading.py +793 -0
- diffusers/hooks/hooks.py +236 -0
- diffusers/hooks/layerwise_casting.py +245 -0
- diffusers/hooks/pyramid_attention_broadcast.py +311 -0
- diffusers/loaders/__init__.py +6 -0
- diffusers/loaders/ip_adapter.py +38 -30
- diffusers/loaders/lora_base.py +121 -86
- diffusers/loaders/lora_conversion_utils.py +504 -44
- diffusers/loaders/lora_pipeline.py +1769 -181
- diffusers/loaders/peft.py +167 -57
- diffusers/loaders/single_file.py +17 -2
- diffusers/loaders/single_file_model.py +53 -5
- diffusers/loaders/single_file_utils.py +646 -72
- diffusers/loaders/textual_inversion.py +9 -9
- diffusers/loaders/transformer_flux.py +8 -9
- diffusers/loaders/transformer_sd3.py +120 -39
- diffusers/loaders/unet.py +20 -7
- diffusers/models/__init__.py +22 -0
- diffusers/models/activations.py +9 -9
- diffusers/models/attention.py +0 -1
- diffusers/models/attention_processor.py +163 -25
- diffusers/models/auto_model.py +169 -0
- diffusers/models/autoencoders/__init__.py +2 -0
- diffusers/models/autoencoders/autoencoder_asym_kl.py +2 -0
- diffusers/models/autoencoders/autoencoder_dc.py +106 -4
- diffusers/models/autoencoders/autoencoder_kl.py +0 -4
- diffusers/models/autoencoders/autoencoder_kl_allegro.py +5 -23
- diffusers/models/autoencoders/autoencoder_kl_cogvideox.py +17 -55
- diffusers/models/autoencoders/autoencoder_kl_hunyuan_video.py +17 -97
- diffusers/models/autoencoders/autoencoder_kl_ltx.py +326 -107
- diffusers/models/autoencoders/autoencoder_kl_magvit.py +1094 -0
- diffusers/models/autoencoders/autoencoder_kl_mochi.py +21 -56
- diffusers/models/autoencoders/autoencoder_kl_temporal_decoder.py +11 -42
- diffusers/models/autoencoders/autoencoder_kl_wan.py +855 -0
- diffusers/models/autoencoders/autoencoder_oobleck.py +1 -0
- diffusers/models/autoencoders/autoencoder_tiny.py +0 -4
- diffusers/models/autoencoders/consistency_decoder_vae.py +3 -1
- diffusers/models/autoencoders/vae.py +31 -141
- diffusers/models/autoencoders/vq_model.py +3 -0
- diffusers/models/cache_utils.py +108 -0
- diffusers/models/controlnets/__init__.py +1 -0
- diffusers/models/controlnets/controlnet.py +3 -8
- diffusers/models/controlnets/controlnet_flux.py +14 -42
- diffusers/models/controlnets/controlnet_sd3.py +58 -34
- diffusers/models/controlnets/controlnet_sparsectrl.py +4 -7
- diffusers/models/controlnets/controlnet_union.py +27 -18
- diffusers/models/controlnets/controlnet_xs.py +7 -46
- diffusers/models/controlnets/multicontrolnet_union.py +196 -0
- diffusers/models/embeddings.py +18 -7
- diffusers/models/model_loading_utils.py +122 -80
- diffusers/models/modeling_flax_pytorch_utils.py +1 -1
- diffusers/models/modeling_flax_utils.py +1 -1
- diffusers/models/modeling_pytorch_flax_utils.py +1 -1
- diffusers/models/modeling_utils.py +617 -272
- diffusers/models/normalization.py +67 -14
- diffusers/models/resnet.py +1 -1
- diffusers/models/transformers/__init__.py +6 -0
- diffusers/models/transformers/auraflow_transformer_2d.py +9 -35
- diffusers/models/transformers/cogvideox_transformer_3d.py +13 -24
- diffusers/models/transformers/consisid_transformer_3d.py +789 -0
- diffusers/models/transformers/dit_transformer_2d.py +5 -19
- diffusers/models/transformers/hunyuan_transformer_2d.py +4 -3
- diffusers/models/transformers/latte_transformer_3d.py +20 -15
- diffusers/models/transformers/lumina_nextdit2d.py +3 -1
- diffusers/models/transformers/pixart_transformer_2d.py +4 -19
- diffusers/models/transformers/prior_transformer.py +5 -1
- diffusers/models/transformers/sana_transformer.py +144 -40
- diffusers/models/transformers/stable_audio_transformer.py +5 -20
- diffusers/models/transformers/transformer_2d.py +7 -22
- diffusers/models/transformers/transformer_allegro.py +9 -17
- diffusers/models/transformers/transformer_cogview3plus.py +6 -17
- diffusers/models/transformers/transformer_cogview4.py +462 -0
- diffusers/models/transformers/transformer_easyanimate.py +527 -0
- diffusers/models/transformers/transformer_flux.py +68 -110
- diffusers/models/transformers/transformer_hunyuan_video.py +404 -46
- diffusers/models/transformers/transformer_ltx.py +53 -35
- diffusers/models/transformers/transformer_lumina2.py +548 -0
- diffusers/models/transformers/transformer_mochi.py +6 -17
- diffusers/models/transformers/transformer_omnigen.py +469 -0
- diffusers/models/transformers/transformer_sd3.py +56 -86
- diffusers/models/transformers/transformer_temporal.py +5 -11
- diffusers/models/transformers/transformer_wan.py +469 -0
- diffusers/models/unets/unet_1d.py +3 -1
- diffusers/models/unets/unet_2d.py +21 -20
- diffusers/models/unets/unet_2d_blocks.py +19 -243
- diffusers/models/unets/unet_2d_condition.py +4 -6
- diffusers/models/unets/unet_3d_blocks.py +14 -127
- diffusers/models/unets/unet_3d_condition.py +8 -12
- diffusers/models/unets/unet_i2vgen_xl.py +5 -13
- diffusers/models/unets/unet_kandinsky3.py +0 -4
- diffusers/models/unets/unet_motion_model.py +20 -114
- diffusers/models/unets/unet_spatio_temporal_condition.py +7 -8
- diffusers/models/unets/unet_stable_cascade.py +8 -35
- diffusers/models/unets/uvit_2d.py +1 -4
- diffusers/optimization.py +2 -2
- diffusers/pipelines/__init__.py +57 -8
- diffusers/pipelines/allegro/pipeline_allegro.py +22 -2
- diffusers/pipelines/amused/pipeline_amused.py +15 -2
- diffusers/pipelines/amused/pipeline_amused_img2img.py +15 -2
- diffusers/pipelines/amused/pipeline_amused_inpaint.py +15 -2
- diffusers/pipelines/animatediff/pipeline_animatediff.py +15 -2
- diffusers/pipelines/animatediff/pipeline_animatediff_controlnet.py +15 -3
- diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py +24 -4
- diffusers/pipelines/animatediff/pipeline_animatediff_sparsectrl.py +15 -2
- diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py +16 -4
- diffusers/pipelines/animatediff/pipeline_animatediff_video2video_controlnet.py +16 -4
- diffusers/pipelines/audioldm/pipeline_audioldm.py +13 -2
- diffusers/pipelines/audioldm2/modeling_audioldm2.py +13 -68
- diffusers/pipelines/audioldm2/pipeline_audioldm2.py +39 -9
- diffusers/pipelines/aura_flow/pipeline_aura_flow.py +63 -7
- diffusers/pipelines/auto_pipeline.py +35 -14
- diffusers/pipelines/blip_diffusion/blip_image_processing.py +1 -1
- diffusers/pipelines/blip_diffusion/modeling_blip2.py +5 -8
- diffusers/pipelines/blip_diffusion/pipeline_blip_diffusion.py +12 -0
- diffusers/pipelines/cogvideo/pipeline_cogvideox.py +22 -6
- diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py +22 -6
- diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py +22 -5
- diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py +22 -6
- diffusers/pipelines/cogview3/pipeline_cogview3plus.py +12 -4
- diffusers/pipelines/cogview4/__init__.py +49 -0
- diffusers/pipelines/cogview4/pipeline_cogview4.py +684 -0
- diffusers/pipelines/cogview4/pipeline_cogview4_control.py +732 -0
- diffusers/pipelines/cogview4/pipeline_output.py +21 -0
- diffusers/pipelines/consisid/__init__.py +49 -0
- diffusers/pipelines/consisid/consisid_utils.py +357 -0
- diffusers/pipelines/consisid/pipeline_consisid.py +974 -0
- diffusers/pipelines/consisid/pipeline_output.py +20 -0
- diffusers/pipelines/consistency_models/pipeline_consistency_models.py +11 -0
- diffusers/pipelines/controlnet/pipeline_controlnet.py +6 -5
- diffusers/pipelines/controlnet/pipeline_controlnet_blip_diffusion.py +13 -0
- diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py +17 -5
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py +31 -12
- diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py +26 -7
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py +20 -3
- diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py +22 -3
- diffusers/pipelines/controlnet/pipeline_controlnet_union_inpaint_sd_xl.py +26 -25
- diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl.py +224 -109
- diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl_img2img.py +25 -29
- diffusers/pipelines/controlnet/pipeline_flax_controlnet.py +7 -4
- diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py +3 -5
- diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py +121 -10
- diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet_inpainting.py +122 -11
- diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs.py +12 -1
- diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs_sd_xl.py +20 -3
- diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py +14 -2
- diffusers/pipelines/ddim/pipeline_ddim.py +14 -1
- diffusers/pipelines/ddpm/pipeline_ddpm.py +15 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if.py +12 -0
- diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py +12 -0
- diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py +14 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py +12 -0
- diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py +14 -1
- diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py +14 -1
- diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py +11 -7
- diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py +11 -7
- diffusers/pipelines/deprecated/repaint/pipeline_repaint.py +1 -1
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py +10 -6
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_onnx_stable_diffusion_inpaint_legacy.py +2 -2
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py +11 -7
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_model_editing.py +1 -1
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_paradigms.py +1 -1
- diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py +1 -1
- diffusers/pipelines/deprecated/versatile_diffusion/modeling_text_unet.py +10 -105
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion.py +1 -1
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py +1 -1
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py +1 -1
- diffusers/pipelines/deprecated/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py +1 -1
- diffusers/pipelines/dit/pipeline_dit.py +15 -2
- diffusers/pipelines/easyanimate/__init__.py +52 -0
- diffusers/pipelines/easyanimate/pipeline_easyanimate.py +770 -0
- diffusers/pipelines/easyanimate/pipeline_easyanimate_control.py +994 -0
- diffusers/pipelines/easyanimate/pipeline_easyanimate_inpaint.py +1234 -0
- diffusers/pipelines/easyanimate/pipeline_output.py +20 -0
- diffusers/pipelines/flux/pipeline_flux.py +53 -21
- diffusers/pipelines/flux/pipeline_flux_control.py +9 -12
- diffusers/pipelines/flux/pipeline_flux_control_img2img.py +6 -10
- diffusers/pipelines/flux/pipeline_flux_control_inpaint.py +8 -10
- diffusers/pipelines/flux/pipeline_flux_controlnet.py +185 -13
- diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py +8 -10
- diffusers/pipelines/flux/pipeline_flux_controlnet_inpainting.py +16 -16
- diffusers/pipelines/flux/pipeline_flux_fill.py +107 -39
- diffusers/pipelines/flux/pipeline_flux_img2img.py +193 -15
- diffusers/pipelines/flux/pipeline_flux_inpaint.py +199 -19
- diffusers/pipelines/free_noise_utils.py +3 -3
- diffusers/pipelines/hunyuan_video/__init__.py +4 -0
- diffusers/pipelines/hunyuan_video/pipeline_hunyuan_skyreels_image2video.py +804 -0
- diffusers/pipelines/hunyuan_video/pipeline_hunyuan_video.py +90 -23
- diffusers/pipelines/hunyuan_video/pipeline_hunyuan_video_image2video.py +924 -0
- diffusers/pipelines/hunyuandit/pipeline_hunyuandit.py +3 -5
- diffusers/pipelines/i2vgen_xl/pipeline_i2vgen_xl.py +13 -1
- diffusers/pipelines/kandinsky/pipeline_kandinsky.py +12 -0
- diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py +1 -1
- diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py +12 -0
- diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py +13 -1
- diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py +12 -0
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py +12 -1
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py +13 -0
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py +12 -0
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py +12 -1
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py +12 -1
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior.py +12 -0
- diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py +12 -0
- diffusers/pipelines/kandinsky3/pipeline_kandinsky3.py +12 -0
- diffusers/pipelines/kandinsky3/pipeline_kandinsky3_img2img.py +12 -0
- diffusers/pipelines/kolors/pipeline_kolors.py +10 -8
- diffusers/pipelines/kolors/pipeline_kolors_img2img.py +6 -4
- diffusers/pipelines/kolors/text_encoder.py +7 -34
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py +12 -1
- diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py +13 -1
- diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py +14 -13
- diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion_superresolution.py +12 -1
- diffusers/pipelines/latte/pipeline_latte.py +36 -7
- diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion.py +67 -13
- diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion_xl.py +60 -15
- diffusers/pipelines/ltx/__init__.py +2 -0
- diffusers/pipelines/ltx/pipeline_ltx.py +25 -13
- diffusers/pipelines/ltx/pipeline_ltx_condition.py +1194 -0
- diffusers/pipelines/ltx/pipeline_ltx_image2video.py +31 -17
- diffusers/pipelines/lumina/__init__.py +2 -2
- diffusers/pipelines/lumina/pipeline_lumina.py +83 -20
- diffusers/pipelines/lumina2/__init__.py +48 -0
- diffusers/pipelines/lumina2/pipeline_lumina2.py +790 -0
- diffusers/pipelines/marigold/__init__.py +2 -0
- diffusers/pipelines/marigold/marigold_image_processing.py +127 -14
- diffusers/pipelines/marigold/pipeline_marigold_depth.py +31 -16
- diffusers/pipelines/marigold/pipeline_marigold_intrinsics.py +721 -0
- diffusers/pipelines/marigold/pipeline_marigold_normals.py +31 -16
- diffusers/pipelines/mochi/pipeline_mochi.py +14 -18
- diffusers/pipelines/musicldm/pipeline_musicldm.py +16 -1
- diffusers/pipelines/omnigen/__init__.py +50 -0
- diffusers/pipelines/omnigen/pipeline_omnigen.py +512 -0
- diffusers/pipelines/omnigen/processor_omnigen.py +327 -0
- diffusers/pipelines/onnx_utils.py +5 -3
- diffusers/pipelines/pag/pag_utils.py +1 -1
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd.py +12 -1
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd_inpaint.py +15 -4
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd_xl.py +20 -3
- diffusers/pipelines/pag/pipeline_pag_controlnet_sd_xl_img2img.py +20 -3
- diffusers/pipelines/pag/pipeline_pag_hunyuandit.py +1 -3
- diffusers/pipelines/pag/pipeline_pag_kolors.py +6 -4
- diffusers/pipelines/pag/pipeline_pag_pixart_sigma.py +16 -3
- diffusers/pipelines/pag/pipeline_pag_sana.py +65 -8
- diffusers/pipelines/pag/pipeline_pag_sd.py +23 -7
- diffusers/pipelines/pag/pipeline_pag_sd_3.py +3 -5
- diffusers/pipelines/pag/pipeline_pag_sd_3_img2img.py +3 -5
- diffusers/pipelines/pag/pipeline_pag_sd_animatediff.py +13 -1
- diffusers/pipelines/pag/pipeline_pag_sd_img2img.py +23 -7
- diffusers/pipelines/pag/pipeline_pag_sd_inpaint.py +26 -10
- diffusers/pipelines/pag/pipeline_pag_sd_xl.py +12 -4
- diffusers/pipelines/pag/pipeline_pag_sd_xl_img2img.py +7 -3
- diffusers/pipelines/pag/pipeline_pag_sd_xl_inpaint.py +10 -6
- diffusers/pipelines/paint_by_example/pipeline_paint_by_example.py +13 -3
- diffusers/pipelines/pia/pipeline_pia.py +13 -1
- diffusers/pipelines/pipeline_flax_utils.py +7 -7
- diffusers/pipelines/pipeline_loading_utils.py +193 -83
- diffusers/pipelines/pipeline_utils.py +221 -106
- diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py +17 -5
- diffusers/pipelines/pixart_alpha/pipeline_pixart_sigma.py +17 -4
- diffusers/pipelines/sana/__init__.py +2 -0
- diffusers/pipelines/sana/pipeline_sana.py +183 -58
- diffusers/pipelines/sana/pipeline_sana_sprint.py +889 -0
- diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py +12 -2
- diffusers/pipelines/shap_e/pipeline_shap_e.py +12 -0
- diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py +12 -0
- diffusers/pipelines/shap_e/renderer.py +6 -6
- diffusers/pipelines/stable_audio/pipeline_stable_audio.py +1 -1
- diffusers/pipelines/stable_cascade/pipeline_stable_cascade.py +15 -4
- diffusers/pipelines/stable_cascade/pipeline_stable_cascade_combined.py +12 -8
- diffusers/pipelines/stable_cascade/pipeline_stable_cascade_prior.py +12 -1
- diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +3 -2
- diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py +14 -10
- diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py +3 -3
- diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py +14 -10
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py +2 -2
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py +4 -3
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py +5 -4
- diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_upscale.py +2 -2
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py +18 -13
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py +30 -8
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py +24 -10
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py +28 -12
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py +39 -18
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py +17 -6
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_latent_upscale.py +13 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py +20 -3
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py +14 -2
- diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py +13 -1
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py +16 -17
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_img2img.py +136 -18
- diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_inpaint.py +150 -21
- diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py +15 -3
- diffusers/pipelines/stable_diffusion_diffedit/pipeline_stable_diffusion_diffedit.py +26 -11
- diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen.py +15 -3
- diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen_text_image.py +22 -4
- diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_k_diffusion.py +30 -13
- diffusers/pipelines/stable_diffusion_k_diffusion/pipeline_stable_diffusion_xl_k_diffusion.py +12 -4
- diffusers/pipelines/stable_diffusion_ldm3d/pipeline_stable_diffusion_ldm3d.py +15 -3
- diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py +15 -3
- diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py +26 -12
- diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py +16 -4
- diffusers/pipelines/stable_diffusion_xl/pipeline_flax_stable_diffusion_xl.py +1 -1
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py +12 -4
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py +7 -3
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py +10 -6
- diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_instruct_pix2pix.py +11 -4
- diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py +13 -2
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py +18 -4
- diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_xl_adapter.py +26 -5
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py +13 -1
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py +13 -1
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py +28 -6
- diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero_sdxl.py +26 -4
- diffusers/pipelines/transformers_loading_utils.py +121 -0
- diffusers/pipelines/unclip/pipeline_unclip.py +11 -1
- diffusers/pipelines/unclip/pipeline_unclip_image_variation.py +11 -1
- diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py +19 -2
- diffusers/pipelines/wan/__init__.py +51 -0
- diffusers/pipelines/wan/pipeline_output.py +20 -0
- diffusers/pipelines/wan/pipeline_wan.py +593 -0
- diffusers/pipelines/wan/pipeline_wan_i2v.py +722 -0
- diffusers/pipelines/wan/pipeline_wan_video2video.py +725 -0
- diffusers/pipelines/wuerstchen/modeling_wuerstchen_prior.py +7 -31
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen.py +12 -1
- diffusers/pipelines/wuerstchen/pipeline_wuerstchen_prior.py +12 -1
- diffusers/quantizers/auto.py +5 -1
- diffusers/quantizers/base.py +5 -9
- diffusers/quantizers/bitsandbytes/bnb_quantizer.py +41 -29
- diffusers/quantizers/bitsandbytes/utils.py +30 -20
- diffusers/quantizers/gguf/gguf_quantizer.py +1 -0
- diffusers/quantizers/gguf/utils.py +4 -2
- diffusers/quantizers/quantization_config.py +59 -4
- diffusers/quantizers/quanto/__init__.py +1 -0
- diffusers/quantizers/quanto/quanto_quantizer.py +177 -0
- diffusers/quantizers/quanto/utils.py +60 -0
- diffusers/quantizers/torchao/__init__.py +1 -1
- diffusers/quantizers/torchao/torchao_quantizer.py +47 -2
- diffusers/schedulers/__init__.py +2 -1
- diffusers/schedulers/scheduling_consistency_models.py +1 -2
- diffusers/schedulers/scheduling_ddim_inverse.py +1 -1
- diffusers/schedulers/scheduling_ddpm.py +2 -3
- diffusers/schedulers/scheduling_ddpm_parallel.py +1 -2
- diffusers/schedulers/scheduling_dpmsolver_multistep.py +12 -4
- diffusers/schedulers/scheduling_edm_euler.py +45 -10
- diffusers/schedulers/scheduling_flow_match_euler_discrete.py +116 -28
- diffusers/schedulers/scheduling_flow_match_heun_discrete.py +7 -6
- diffusers/schedulers/scheduling_heun_discrete.py +1 -1
- diffusers/schedulers/scheduling_lcm.py +1 -2
- diffusers/schedulers/scheduling_lms_discrete.py +1 -1
- diffusers/schedulers/scheduling_repaint.py +5 -1
- diffusers/schedulers/scheduling_scm.py +265 -0
- diffusers/schedulers/scheduling_tcd.py +1 -2
- diffusers/schedulers/scheduling_utils.py +2 -1
- diffusers/training_utils.py +14 -7
- diffusers/utils/__init__.py +9 -1
- diffusers/utils/constants.py +13 -1
- diffusers/utils/deprecation_utils.py +1 -1
- diffusers/utils/dummy_bitsandbytes_objects.py +17 -0
- diffusers/utils/dummy_gguf_objects.py +17 -0
- diffusers/utils/dummy_optimum_quanto_objects.py +17 -0
- diffusers/utils/dummy_pt_objects.py +233 -0
- diffusers/utils/dummy_torch_and_transformers_and_opencv_objects.py +17 -0
- diffusers/utils/dummy_torch_and_transformers_objects.py +270 -0
- diffusers/utils/dummy_torchao_objects.py +17 -0
- diffusers/utils/dynamic_modules_utils.py +1 -1
- diffusers/utils/export_utils.py +28 -3
- diffusers/utils/hub_utils.py +52 -102
- diffusers/utils/import_utils.py +121 -221
- diffusers/utils/loading_utils.py +2 -1
- diffusers/utils/logging.py +1 -2
- diffusers/utils/peft_utils.py +6 -14
- diffusers/utils/remote_utils.py +425 -0
- diffusers/utils/source_code_parsing_utils.py +52 -0
- diffusers/utils/state_dict_utils.py +15 -1
- diffusers/utils/testing_utils.py +243 -13
- diffusers/utils/torch_utils.py +10 -0
- diffusers/utils/typing_utils.py +91 -0
- diffusers/video_processor.py +1 -1
- {diffusers-0.32.2.dist-info → diffusers-0.33.0.dist-info}/METADATA +76 -44
- diffusers-0.33.0.dist-info/RECORD +608 -0
- {diffusers-0.32.2.dist-info → diffusers-0.33.0.dist-info}/WHEEL +1 -1
- diffusers-0.32.2.dist-info/RECORD +0 -550
- {diffusers-0.32.2.dist-info → diffusers-0.33.0.dist-info}/LICENSE +0 -0
- {diffusers-0.32.2.dist-info → diffusers-0.33.0.dist-info}/entry_points.txt +0 -0
- {diffusers-0.32.2.dist-info → diffusers-0.33.0.dist-info}/top_level.txt +0 -0
@@ -362,6 +362,36 @@ class CogView3PlusPipeline(metaclass=DummyObject):
|
|
362
362
|
requires_backends(cls, ["torch", "transformers"])
|
363
363
|
|
364
364
|
|
365
|
+
class CogView4ControlPipeline(metaclass=DummyObject):
|
366
|
+
_backends = ["torch", "transformers"]
|
367
|
+
|
368
|
+
def __init__(self, *args, **kwargs):
|
369
|
+
requires_backends(self, ["torch", "transformers"])
|
370
|
+
|
371
|
+
@classmethod
|
372
|
+
def from_config(cls, *args, **kwargs):
|
373
|
+
requires_backends(cls, ["torch", "transformers"])
|
374
|
+
|
375
|
+
@classmethod
|
376
|
+
def from_pretrained(cls, *args, **kwargs):
|
377
|
+
requires_backends(cls, ["torch", "transformers"])
|
378
|
+
|
379
|
+
|
380
|
+
class CogView4Pipeline(metaclass=DummyObject):
|
381
|
+
_backends = ["torch", "transformers"]
|
382
|
+
|
383
|
+
def __init__(self, *args, **kwargs):
|
384
|
+
requires_backends(self, ["torch", "transformers"])
|
385
|
+
|
386
|
+
@classmethod
|
387
|
+
def from_config(cls, *args, **kwargs):
|
388
|
+
requires_backends(cls, ["torch", "transformers"])
|
389
|
+
|
390
|
+
@classmethod
|
391
|
+
def from_pretrained(cls, *args, **kwargs):
|
392
|
+
requires_backends(cls, ["torch", "transformers"])
|
393
|
+
|
394
|
+
|
365
395
|
class CycleDiffusionPipeline(metaclass=DummyObject):
|
366
396
|
_backends = ["torch", "transformers"]
|
367
397
|
|
@@ -377,6 +407,51 @@ class CycleDiffusionPipeline(metaclass=DummyObject):
|
|
377
407
|
requires_backends(cls, ["torch", "transformers"])
|
378
408
|
|
379
409
|
|
410
|
+
class EasyAnimateControlPipeline(metaclass=DummyObject):
|
411
|
+
_backends = ["torch", "transformers"]
|
412
|
+
|
413
|
+
def __init__(self, *args, **kwargs):
|
414
|
+
requires_backends(self, ["torch", "transformers"])
|
415
|
+
|
416
|
+
@classmethod
|
417
|
+
def from_config(cls, *args, **kwargs):
|
418
|
+
requires_backends(cls, ["torch", "transformers"])
|
419
|
+
|
420
|
+
@classmethod
|
421
|
+
def from_pretrained(cls, *args, **kwargs):
|
422
|
+
requires_backends(cls, ["torch", "transformers"])
|
423
|
+
|
424
|
+
|
425
|
+
class EasyAnimateInpaintPipeline(metaclass=DummyObject):
|
426
|
+
_backends = ["torch", "transformers"]
|
427
|
+
|
428
|
+
def __init__(self, *args, **kwargs):
|
429
|
+
requires_backends(self, ["torch", "transformers"])
|
430
|
+
|
431
|
+
@classmethod
|
432
|
+
def from_config(cls, *args, **kwargs):
|
433
|
+
requires_backends(cls, ["torch", "transformers"])
|
434
|
+
|
435
|
+
@classmethod
|
436
|
+
def from_pretrained(cls, *args, **kwargs):
|
437
|
+
requires_backends(cls, ["torch", "transformers"])
|
438
|
+
|
439
|
+
|
440
|
+
class EasyAnimatePipeline(metaclass=DummyObject):
|
441
|
+
_backends = ["torch", "transformers"]
|
442
|
+
|
443
|
+
def __init__(self, *args, **kwargs):
|
444
|
+
requires_backends(self, ["torch", "transformers"])
|
445
|
+
|
446
|
+
@classmethod
|
447
|
+
def from_config(cls, *args, **kwargs):
|
448
|
+
requires_backends(cls, ["torch", "transformers"])
|
449
|
+
|
450
|
+
@classmethod
|
451
|
+
def from_pretrained(cls, *args, **kwargs):
|
452
|
+
requires_backends(cls, ["torch", "transformers"])
|
453
|
+
|
454
|
+
|
380
455
|
class FluxControlImg2ImgPipeline(metaclass=DummyObject):
|
381
456
|
_backends = ["torch", "transformers"]
|
382
457
|
|
@@ -587,6 +662,36 @@ class HunyuanDiTPipeline(metaclass=DummyObject):
|
|
587
662
|
requires_backends(cls, ["torch", "transformers"])
|
588
663
|
|
589
664
|
|
665
|
+
class HunyuanSkyreelsImageToVideoPipeline(metaclass=DummyObject):
|
666
|
+
_backends = ["torch", "transformers"]
|
667
|
+
|
668
|
+
def __init__(self, *args, **kwargs):
|
669
|
+
requires_backends(self, ["torch", "transformers"])
|
670
|
+
|
671
|
+
@classmethod
|
672
|
+
def from_config(cls, *args, **kwargs):
|
673
|
+
requires_backends(cls, ["torch", "transformers"])
|
674
|
+
|
675
|
+
@classmethod
|
676
|
+
def from_pretrained(cls, *args, **kwargs):
|
677
|
+
requires_backends(cls, ["torch", "transformers"])
|
678
|
+
|
679
|
+
|
680
|
+
class HunyuanVideoImageToVideoPipeline(metaclass=DummyObject):
|
681
|
+
_backends = ["torch", "transformers"]
|
682
|
+
|
683
|
+
def __init__(self, *args, **kwargs):
|
684
|
+
requires_backends(self, ["torch", "transformers"])
|
685
|
+
|
686
|
+
@classmethod
|
687
|
+
def from_config(cls, *args, **kwargs):
|
688
|
+
requires_backends(cls, ["torch", "transformers"])
|
689
|
+
|
690
|
+
@classmethod
|
691
|
+
def from_pretrained(cls, *args, **kwargs):
|
692
|
+
requires_backends(cls, ["torch", "transformers"])
|
693
|
+
|
694
|
+
|
590
695
|
class HunyuanVideoPipeline(metaclass=DummyObject):
|
591
696
|
_backends = ["torch", "transformers"]
|
592
697
|
|
@@ -1097,6 +1202,21 @@ class LEditsPPPipelineStableDiffusionXL(metaclass=DummyObject):
|
|
1097
1202
|
requires_backends(cls, ["torch", "transformers"])
|
1098
1203
|
|
1099
1204
|
|
1205
|
+
class LTXConditionPipeline(metaclass=DummyObject):
|
1206
|
+
_backends = ["torch", "transformers"]
|
1207
|
+
|
1208
|
+
def __init__(self, *args, **kwargs):
|
1209
|
+
requires_backends(self, ["torch", "transformers"])
|
1210
|
+
|
1211
|
+
@classmethod
|
1212
|
+
def from_config(cls, *args, **kwargs):
|
1213
|
+
requires_backends(cls, ["torch", "transformers"])
|
1214
|
+
|
1215
|
+
@classmethod
|
1216
|
+
def from_pretrained(cls, *args, **kwargs):
|
1217
|
+
requires_backends(cls, ["torch", "transformers"])
|
1218
|
+
|
1219
|
+
|
1100
1220
|
class LTXImageToVideoPipeline(metaclass=DummyObject):
|
1101
1221
|
_backends = ["torch", "transformers"]
|
1102
1222
|
|
@@ -1127,6 +1247,51 @@ class LTXPipeline(metaclass=DummyObject):
|
|
1127
1247
|
requires_backends(cls, ["torch", "transformers"])
|
1128
1248
|
|
1129
1249
|
|
1250
|
+
class Lumina2Pipeline(metaclass=DummyObject):
|
1251
|
+
_backends = ["torch", "transformers"]
|
1252
|
+
|
1253
|
+
def __init__(self, *args, **kwargs):
|
1254
|
+
requires_backends(self, ["torch", "transformers"])
|
1255
|
+
|
1256
|
+
@classmethod
|
1257
|
+
def from_config(cls, *args, **kwargs):
|
1258
|
+
requires_backends(cls, ["torch", "transformers"])
|
1259
|
+
|
1260
|
+
@classmethod
|
1261
|
+
def from_pretrained(cls, *args, **kwargs):
|
1262
|
+
requires_backends(cls, ["torch", "transformers"])
|
1263
|
+
|
1264
|
+
|
1265
|
+
class Lumina2Text2ImgPipeline(metaclass=DummyObject):
|
1266
|
+
_backends = ["torch", "transformers"]
|
1267
|
+
|
1268
|
+
def __init__(self, *args, **kwargs):
|
1269
|
+
requires_backends(self, ["torch", "transformers"])
|
1270
|
+
|
1271
|
+
@classmethod
|
1272
|
+
def from_config(cls, *args, **kwargs):
|
1273
|
+
requires_backends(cls, ["torch", "transformers"])
|
1274
|
+
|
1275
|
+
@classmethod
|
1276
|
+
def from_pretrained(cls, *args, **kwargs):
|
1277
|
+
requires_backends(cls, ["torch", "transformers"])
|
1278
|
+
|
1279
|
+
|
1280
|
+
class LuminaPipeline(metaclass=DummyObject):
|
1281
|
+
_backends = ["torch", "transformers"]
|
1282
|
+
|
1283
|
+
def __init__(self, *args, **kwargs):
|
1284
|
+
requires_backends(self, ["torch", "transformers"])
|
1285
|
+
|
1286
|
+
@classmethod
|
1287
|
+
def from_config(cls, *args, **kwargs):
|
1288
|
+
requires_backends(cls, ["torch", "transformers"])
|
1289
|
+
|
1290
|
+
@classmethod
|
1291
|
+
def from_pretrained(cls, *args, **kwargs):
|
1292
|
+
requires_backends(cls, ["torch", "transformers"])
|
1293
|
+
|
1294
|
+
|
1130
1295
|
class LuminaText2ImgPipeline(metaclass=DummyObject):
|
1131
1296
|
_backends = ["torch", "transformers"]
|
1132
1297
|
|
@@ -1157,6 +1322,21 @@ class MarigoldDepthPipeline(metaclass=DummyObject):
|
|
1157
1322
|
requires_backends(cls, ["torch", "transformers"])
|
1158
1323
|
|
1159
1324
|
|
1325
|
+
class MarigoldIntrinsicsPipeline(metaclass=DummyObject):
|
1326
|
+
_backends = ["torch", "transformers"]
|
1327
|
+
|
1328
|
+
def __init__(self, *args, **kwargs):
|
1329
|
+
requires_backends(self, ["torch", "transformers"])
|
1330
|
+
|
1331
|
+
@classmethod
|
1332
|
+
def from_config(cls, *args, **kwargs):
|
1333
|
+
requires_backends(cls, ["torch", "transformers"])
|
1334
|
+
|
1335
|
+
@classmethod
|
1336
|
+
def from_pretrained(cls, *args, **kwargs):
|
1337
|
+
requires_backends(cls, ["torch", "transformers"])
|
1338
|
+
|
1339
|
+
|
1160
1340
|
class MarigoldNormalsPipeline(metaclass=DummyObject):
|
1161
1341
|
_backends = ["torch", "transformers"]
|
1162
1342
|
|
@@ -1202,6 +1382,21 @@ class MusicLDMPipeline(metaclass=DummyObject):
|
|
1202
1382
|
requires_backends(cls, ["torch", "transformers"])
|
1203
1383
|
|
1204
1384
|
|
1385
|
+
class OmniGenPipeline(metaclass=DummyObject):
|
1386
|
+
_backends = ["torch", "transformers"]
|
1387
|
+
|
1388
|
+
def __init__(self, *args, **kwargs):
|
1389
|
+
requires_backends(self, ["torch", "transformers"])
|
1390
|
+
|
1391
|
+
@classmethod
|
1392
|
+
def from_config(cls, *args, **kwargs):
|
1393
|
+
requires_backends(cls, ["torch", "transformers"])
|
1394
|
+
|
1395
|
+
@classmethod
|
1396
|
+
def from_pretrained(cls, *args, **kwargs):
|
1397
|
+
requires_backends(cls, ["torch", "transformers"])
|
1398
|
+
|
1399
|
+
|
1205
1400
|
class PaintByExamplePipeline(metaclass=DummyObject):
|
1206
1401
|
_backends = ["torch", "transformers"]
|
1207
1402
|
|
@@ -1322,6 +1517,21 @@ class SanaPipeline(metaclass=DummyObject):
|
|
1322
1517
|
requires_backends(cls, ["torch", "transformers"])
|
1323
1518
|
|
1324
1519
|
|
1520
|
+
class SanaSprintPipeline(metaclass=DummyObject):
|
1521
|
+
_backends = ["torch", "transformers"]
|
1522
|
+
|
1523
|
+
def __init__(self, *args, **kwargs):
|
1524
|
+
requires_backends(self, ["torch", "transformers"])
|
1525
|
+
|
1526
|
+
@classmethod
|
1527
|
+
def from_config(cls, *args, **kwargs):
|
1528
|
+
requires_backends(cls, ["torch", "transformers"])
|
1529
|
+
|
1530
|
+
@classmethod
|
1531
|
+
def from_pretrained(cls, *args, **kwargs):
|
1532
|
+
requires_backends(cls, ["torch", "transformers"])
|
1533
|
+
|
1534
|
+
|
1325
1535
|
class SemanticStableDiffusionPipeline(metaclass=DummyObject):
|
1326
1536
|
_backends = ["torch", "transformers"]
|
1327
1537
|
|
@@ -1442,6 +1652,21 @@ class StableCascadePriorPipeline(metaclass=DummyObject):
|
|
1442
1652
|
requires_backends(cls, ["torch", "transformers"])
|
1443
1653
|
|
1444
1654
|
|
1655
|
+
class StableDiffusion3ControlNetInpaintingPipeline(metaclass=DummyObject):
|
1656
|
+
_backends = ["torch", "transformers"]
|
1657
|
+
|
1658
|
+
def __init__(self, *args, **kwargs):
|
1659
|
+
requires_backends(self, ["torch", "transformers"])
|
1660
|
+
|
1661
|
+
@classmethod
|
1662
|
+
def from_config(cls, *args, **kwargs):
|
1663
|
+
requires_backends(cls, ["torch", "transformers"])
|
1664
|
+
|
1665
|
+
@classmethod
|
1666
|
+
def from_pretrained(cls, *args, **kwargs):
|
1667
|
+
requires_backends(cls, ["torch", "transformers"])
|
1668
|
+
|
1669
|
+
|
1445
1670
|
class StableDiffusion3ControlNetPipeline(metaclass=DummyObject):
|
1446
1671
|
_backends = ["torch", "transformers"]
|
1447
1672
|
|
@@ -2492,6 +2717,51 @@ class VQDiffusionPipeline(metaclass=DummyObject):
|
|
2492
2717
|
requires_backends(cls, ["torch", "transformers"])
|
2493
2718
|
|
2494
2719
|
|
2720
|
+
class WanImageToVideoPipeline(metaclass=DummyObject):
|
2721
|
+
_backends = ["torch", "transformers"]
|
2722
|
+
|
2723
|
+
def __init__(self, *args, **kwargs):
|
2724
|
+
requires_backends(self, ["torch", "transformers"])
|
2725
|
+
|
2726
|
+
@classmethod
|
2727
|
+
def from_config(cls, *args, **kwargs):
|
2728
|
+
requires_backends(cls, ["torch", "transformers"])
|
2729
|
+
|
2730
|
+
@classmethod
|
2731
|
+
def from_pretrained(cls, *args, **kwargs):
|
2732
|
+
requires_backends(cls, ["torch", "transformers"])
|
2733
|
+
|
2734
|
+
|
2735
|
+
class WanPipeline(metaclass=DummyObject):
|
2736
|
+
_backends = ["torch", "transformers"]
|
2737
|
+
|
2738
|
+
def __init__(self, *args, **kwargs):
|
2739
|
+
requires_backends(self, ["torch", "transformers"])
|
2740
|
+
|
2741
|
+
@classmethod
|
2742
|
+
def from_config(cls, *args, **kwargs):
|
2743
|
+
requires_backends(cls, ["torch", "transformers"])
|
2744
|
+
|
2745
|
+
@classmethod
|
2746
|
+
def from_pretrained(cls, *args, **kwargs):
|
2747
|
+
requires_backends(cls, ["torch", "transformers"])
|
2748
|
+
|
2749
|
+
|
2750
|
+
class WanVideoToVideoPipeline(metaclass=DummyObject):
|
2751
|
+
_backends = ["torch", "transformers"]
|
2752
|
+
|
2753
|
+
def __init__(self, *args, **kwargs):
|
2754
|
+
requires_backends(self, ["torch", "transformers"])
|
2755
|
+
|
2756
|
+
@classmethod
|
2757
|
+
def from_config(cls, *args, **kwargs):
|
2758
|
+
requires_backends(cls, ["torch", "transformers"])
|
2759
|
+
|
2760
|
+
@classmethod
|
2761
|
+
def from_pretrained(cls, *args, **kwargs):
|
2762
|
+
requires_backends(cls, ["torch", "transformers"])
|
2763
|
+
|
2764
|
+
|
2495
2765
|
class WuerstchenCombinedPipeline(metaclass=DummyObject):
|
2496
2766
|
_backends = ["torch", "transformers"]
|
2497
2767
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file is autogenerated by the command `make fix-copies`, do not edit.
|
2
|
+
from ..utils import DummyObject, requires_backends
|
3
|
+
|
4
|
+
|
5
|
+
class TorchAoConfig(metaclass=DummyObject):
|
6
|
+
_backends = ["torchao"]
|
7
|
+
|
8
|
+
def __init__(self, *args, **kwargs):
|
9
|
+
requires_backends(self, ["torchao"])
|
10
|
+
|
11
|
+
@classmethod
|
12
|
+
def from_config(cls, *args, **kwargs):
|
13
|
+
requires_backends(cls, ["torchao"])
|
14
|
+
|
15
|
+
@classmethod
|
16
|
+
def from_pretrained(cls, *args, **kwargs):
|
17
|
+
requires_backends(cls, ["torchao"])
|
diffusers/utils/export_utils.py
CHANGED
@@ -3,7 +3,7 @@ import random
|
|
3
3
|
import struct
|
4
4
|
import tempfile
|
5
5
|
from contextlib import contextmanager
|
6
|
-
from typing import List, Union
|
6
|
+
from typing import List, Optional, Union
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
import PIL.Image
|
@@ -139,8 +139,31 @@ def _legacy_export_to_video(
|
|
139
139
|
|
140
140
|
|
141
141
|
def export_to_video(
|
142
|
-
video_frames: Union[List[np.ndarray], List[PIL.Image.Image]],
|
142
|
+
video_frames: Union[List[np.ndarray], List[PIL.Image.Image]],
|
143
|
+
output_video_path: str = None,
|
144
|
+
fps: int = 10,
|
145
|
+
quality: float = 5.0,
|
146
|
+
bitrate: Optional[int] = None,
|
147
|
+
macro_block_size: Optional[int] = 16,
|
143
148
|
) -> str:
|
149
|
+
"""
|
150
|
+
quality:
|
151
|
+
Video output quality. Default is 5. Uses variable bit rate. Highest quality is 10, lowest is 0. Set to None to
|
152
|
+
prevent variable bitrate flags to FFMPEG so you can manually specify them using output_params instead.
|
153
|
+
Specifying a fixed bitrate using `bitrate` disables this parameter.
|
154
|
+
|
155
|
+
bitrate:
|
156
|
+
Set a constant bitrate for the video encoding. Default is None causing `quality` parameter to be used instead.
|
157
|
+
Better quality videos with smaller file sizes will result from using the `quality` variable bitrate parameter
|
158
|
+
rather than specifiying a fixed bitrate with this parameter.
|
159
|
+
|
160
|
+
macro_block_size:
|
161
|
+
Size constraint for video. Width and height, must be divisible by this number. If not divisible by this number
|
162
|
+
imageio will tell ffmpeg to scale the image up to the next closest size divisible by this number. Most codecs
|
163
|
+
are compatible with a macroblock size of 16 (default), some can go smaller (4, 8). To disable this automatic
|
164
|
+
feature set it to None or 1, however be warned many players can't decode videos that are odd in size and some
|
165
|
+
codecs will produce poor results or fail. See https://en.wikipedia.org/wiki/Macroblock.
|
166
|
+
"""
|
144
167
|
# TODO: Dhruv. Remove by Diffusers release 0.33.0
|
145
168
|
# Added to prevent breaking existing code
|
146
169
|
if not is_imageio_available():
|
@@ -177,7 +200,9 @@ def export_to_video(
|
|
177
200
|
elif isinstance(video_frames[0], PIL.Image.Image):
|
178
201
|
video_frames = [np.array(frame) for frame in video_frames]
|
179
202
|
|
180
|
-
with imageio.get_writer(
|
203
|
+
with imageio.get_writer(
|
204
|
+
output_video_path, fps=fps, quality=quality, bitrate=bitrate, macro_block_size=macro_block_size
|
205
|
+
) as writer:
|
181
206
|
for frame in video_frames:
|
182
207
|
writer.append_data(frame)
|
183
208
|
|
diffusers/utils/hub_utils.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# coding=utf-8
|
2
|
-
# Copyright
|
2
|
+
# Copyright 2025 The HuggingFace Inc. team.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -19,13 +19,13 @@ import os
|
|
19
19
|
import re
|
20
20
|
import sys
|
21
21
|
import tempfile
|
22
|
-
import traceback
|
23
22
|
import warnings
|
24
23
|
from pathlib import Path
|
25
24
|
from typing import Dict, List, Optional, Union
|
26
25
|
from uuid import uuid4
|
27
26
|
|
28
27
|
from huggingface_hub import (
|
28
|
+
DDUFEntry,
|
29
29
|
ModelCard,
|
30
30
|
ModelCardData,
|
31
31
|
create_repo,
|
@@ -34,7 +34,7 @@ from huggingface_hub import (
|
|
34
34
|
snapshot_download,
|
35
35
|
upload_folder,
|
36
36
|
)
|
37
|
-
from huggingface_hub.constants import
|
37
|
+
from huggingface_hub.constants import HF_HUB_DISABLE_TELEMETRY, HF_HUB_OFFLINE
|
38
38
|
from huggingface_hub.file_download import REGEX_COMMIT_HASH
|
39
39
|
from huggingface_hub.utils import (
|
40
40
|
EntryNotFoundError,
|
@@ -196,78 +196,6 @@ def extract_commit_hash(resolved_file: Optional[str], commit_hash: Optional[str]
|
|
196
196
|
return commit_hash if REGEX_COMMIT_HASH.match(commit_hash) else None
|
197
197
|
|
198
198
|
|
199
|
-
# Old default cache path, potentially to be migrated.
|
200
|
-
# This logic was more or less taken from `transformers`, with the following differences:
|
201
|
-
# - Diffusers doesn't use custom environment variables to specify the cache path.
|
202
|
-
# - There is no need to migrate the cache format, just move the files to the new location.
|
203
|
-
hf_cache_home = os.path.expanduser(
|
204
|
-
os.getenv("HF_HOME", os.path.join(os.getenv("XDG_CACHE_HOME", "~/.cache"), "huggingface"))
|
205
|
-
)
|
206
|
-
old_diffusers_cache = os.path.join(hf_cache_home, "diffusers")
|
207
|
-
|
208
|
-
|
209
|
-
def move_cache(old_cache_dir: Optional[str] = None, new_cache_dir: Optional[str] = None) -> None:
|
210
|
-
if new_cache_dir is None:
|
211
|
-
new_cache_dir = HF_HUB_CACHE
|
212
|
-
if old_cache_dir is None:
|
213
|
-
old_cache_dir = old_diffusers_cache
|
214
|
-
|
215
|
-
old_cache_dir = Path(old_cache_dir).expanduser()
|
216
|
-
new_cache_dir = Path(new_cache_dir).expanduser()
|
217
|
-
for old_blob_path in old_cache_dir.glob("**/blobs/*"):
|
218
|
-
if old_blob_path.is_file() and not old_blob_path.is_symlink():
|
219
|
-
new_blob_path = new_cache_dir / old_blob_path.relative_to(old_cache_dir)
|
220
|
-
new_blob_path.parent.mkdir(parents=True, exist_ok=True)
|
221
|
-
os.replace(old_blob_path, new_blob_path)
|
222
|
-
try:
|
223
|
-
os.symlink(new_blob_path, old_blob_path)
|
224
|
-
except OSError:
|
225
|
-
logger.warning(
|
226
|
-
"Could not create symlink between old cache and new cache. If you use an older version of diffusers again, files will be re-downloaded."
|
227
|
-
)
|
228
|
-
# At this point, old_cache_dir contains symlinks to the new cache (it can still be used).
|
229
|
-
|
230
|
-
|
231
|
-
cache_version_file = os.path.join(HF_HUB_CACHE, "version_diffusers_cache.txt")
|
232
|
-
if not os.path.isfile(cache_version_file):
|
233
|
-
cache_version = 0
|
234
|
-
else:
|
235
|
-
with open(cache_version_file) as f:
|
236
|
-
try:
|
237
|
-
cache_version = int(f.read())
|
238
|
-
except ValueError:
|
239
|
-
cache_version = 0
|
240
|
-
|
241
|
-
if cache_version < 1:
|
242
|
-
old_cache_is_not_empty = os.path.isdir(old_diffusers_cache) and len(os.listdir(old_diffusers_cache)) > 0
|
243
|
-
if old_cache_is_not_empty:
|
244
|
-
logger.warning(
|
245
|
-
"The cache for model files in Diffusers v0.14.0 has moved to a new location. Moving your "
|
246
|
-
"existing cached models. This is a one-time operation, you can interrupt it or run it "
|
247
|
-
"later by calling `diffusers.utils.hub_utils.move_cache()`."
|
248
|
-
)
|
249
|
-
try:
|
250
|
-
move_cache()
|
251
|
-
except Exception as e:
|
252
|
-
trace = "\n".join(traceback.format_tb(e.__traceback__))
|
253
|
-
logger.error(
|
254
|
-
f"There was a problem when trying to move your cache:\n\n{trace}\n{e.__class__.__name__}: {e}\n\nPlease "
|
255
|
-
"file an issue at https://github.com/huggingface/diffusers/issues/new/choose, copy paste this whole "
|
256
|
-
"message and we will do our best to help."
|
257
|
-
)
|
258
|
-
|
259
|
-
if cache_version < 1:
|
260
|
-
try:
|
261
|
-
os.makedirs(HF_HUB_CACHE, exist_ok=True)
|
262
|
-
with open(cache_version_file, "w") as f:
|
263
|
-
f.write("1")
|
264
|
-
except Exception:
|
265
|
-
logger.warning(
|
266
|
-
f"There was a problem when trying to write in your cache folder ({HF_HUB_CACHE}). Please, ensure "
|
267
|
-
"the directory exists and can be written to."
|
268
|
-
)
|
269
|
-
|
270
|
-
|
271
199
|
def _add_variant(weights_name: str, variant: Optional[str] = None) -> str:
|
272
200
|
if variant is not None:
|
273
201
|
splits = weights_name.split(".")
|
@@ -291,9 +219,26 @@ def _get_model_file(
|
|
291
219
|
user_agent: Optional[Union[Dict, str]] = None,
|
292
220
|
revision: Optional[str] = None,
|
293
221
|
commit_hash: Optional[str] = None,
|
222
|
+
dduf_entries: Optional[Dict[str, DDUFEntry]] = None,
|
294
223
|
):
|
295
224
|
pretrained_model_name_or_path = str(pretrained_model_name_or_path)
|
296
|
-
|
225
|
+
|
226
|
+
if dduf_entries:
|
227
|
+
if subfolder is not None:
|
228
|
+
raise ValueError(
|
229
|
+
"DDUF file only allow for 1 level of directory (e.g transformer/model1/model.safetentors is not allowed). "
|
230
|
+
"Please check the DDUF structure"
|
231
|
+
)
|
232
|
+
model_file = (
|
233
|
+
weights_name
|
234
|
+
if pretrained_model_name_or_path == ""
|
235
|
+
else "/".join([pretrained_model_name_or_path, weights_name])
|
236
|
+
)
|
237
|
+
if model_file in dduf_entries:
|
238
|
+
return model_file
|
239
|
+
else:
|
240
|
+
raise EnvironmentError(f"Error no file named {weights_name} found in archive {dduf_entries.keys()}.")
|
241
|
+
elif os.path.isfile(pretrained_model_name_or_path):
|
297
242
|
return pretrained_model_name_or_path
|
298
243
|
elif os.path.isdir(pretrained_model_name_or_path):
|
299
244
|
if os.path.isfile(os.path.join(pretrained_model_name_or_path, weights_name)):
|
@@ -393,22 +338,6 @@ def _get_model_file(
|
|
393
338
|
) from e
|
394
339
|
|
395
340
|
|
396
|
-
# Adapted from
|
397
|
-
# https://github.com/huggingface/transformers/blob/1360801a69c0b169e3efdbb0cd05d9a0e72bfb70/src/transformers/utils/hub.py#L976
|
398
|
-
# Differences are in parallelization of shard downloads and checking if shards are present.
|
399
|
-
|
400
|
-
|
401
|
-
def _check_if_shards_exist_locally(local_dir, subfolder, original_shard_filenames):
|
402
|
-
shards_path = os.path.join(local_dir, subfolder)
|
403
|
-
shard_filenames = [os.path.join(shards_path, f) for f in original_shard_filenames]
|
404
|
-
for shard_file in shard_filenames:
|
405
|
-
if not os.path.exists(shard_file):
|
406
|
-
raise ValueError(
|
407
|
-
f"{shards_path} does not appear to have a file named {shard_file} which is "
|
408
|
-
"required according to the checkpoint index."
|
409
|
-
)
|
410
|
-
|
411
|
-
|
412
341
|
def _get_checkpoint_shard_files(
|
413
342
|
pretrained_model_name_or_path,
|
414
343
|
index_filename,
|
@@ -419,6 +348,7 @@ def _get_checkpoint_shard_files(
|
|
419
348
|
user_agent=None,
|
420
349
|
revision=None,
|
421
350
|
subfolder="",
|
351
|
+
dduf_entries: Optional[Dict[str, DDUFEntry]] = None,
|
422
352
|
):
|
423
353
|
"""
|
424
354
|
For a given model:
|
@@ -430,11 +360,18 @@ def _get_checkpoint_shard_files(
|
|
430
360
|
For the description of each arg, see [`PreTrainedModel.from_pretrained`]. `index_filename` is the full path to the
|
431
361
|
index (downloaded and cached if `pretrained_model_name_or_path` is a model ID on the Hub).
|
432
362
|
"""
|
433
|
-
if
|
434
|
-
|
363
|
+
if dduf_entries:
|
364
|
+
if index_filename not in dduf_entries:
|
365
|
+
raise ValueError(f"Can't find a checkpoint index ({index_filename}) in {pretrained_model_name_or_path}.")
|
366
|
+
else:
|
367
|
+
if not os.path.isfile(index_filename):
|
368
|
+
raise ValueError(f"Can't find a checkpoint index ({index_filename}) in {pretrained_model_name_or_path}.")
|
435
369
|
|
436
|
-
|
437
|
-
index = json.loads(
|
370
|
+
if dduf_entries:
|
371
|
+
index = json.loads(dduf_entries[index_filename].read_text())
|
372
|
+
else:
|
373
|
+
with open(index_filename, "r") as f:
|
374
|
+
index = json.loads(f.read())
|
438
375
|
|
439
376
|
original_shard_filenames = sorted(set(index["weight_map"].values()))
|
440
377
|
sharded_metadata = index["metadata"]
|
@@ -443,11 +380,22 @@ def _get_checkpoint_shard_files(
|
|
443
380
|
shards_path = os.path.join(pretrained_model_name_or_path, subfolder)
|
444
381
|
|
445
382
|
# First, let's deal with local folder.
|
446
|
-
if os.path.isdir(pretrained_model_name_or_path):
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
383
|
+
if os.path.isdir(pretrained_model_name_or_path) or dduf_entries:
|
384
|
+
shard_filenames = [os.path.join(shards_path, f) for f in original_shard_filenames]
|
385
|
+
for shard_file in shard_filenames:
|
386
|
+
if dduf_entries:
|
387
|
+
if shard_file not in dduf_entries:
|
388
|
+
raise FileNotFoundError(
|
389
|
+
f"{shards_path} does not appear to have a file named {shard_file} which is "
|
390
|
+
"required according to the checkpoint index."
|
391
|
+
)
|
392
|
+
else:
|
393
|
+
if not os.path.exists(shard_file):
|
394
|
+
raise FileNotFoundError(
|
395
|
+
f"{shards_path} does not appear to have a file named {shard_file} which is "
|
396
|
+
"required according to the checkpoint index."
|
397
|
+
)
|
398
|
+
return shard_filenames, sharded_metadata
|
451
399
|
|
452
400
|
# At this stage pretrained_model_name_or_path is a model identifier on the Hub
|
453
401
|
allow_patterns = original_shard_filenames
|
@@ -489,7 +437,9 @@ def _get_checkpoint_shard_files(
|
|
489
437
|
" again after checking your internet connection."
|
490
438
|
) from e
|
491
439
|
|
492
|
-
|
440
|
+
cached_filenames = [os.path.join(cached_folder, f) for f in original_shard_filenames]
|
441
|
+
|
442
|
+
return cached_filenames, sharded_metadata
|
493
443
|
|
494
444
|
|
495
445
|
def _check_legacy_sharding_variant_format(folder: str = None, filenames: List[str] = None, variant: str = None):
|