Full Code of snap-research/stable-flow for AI

main c99ac0eba297 cached
478 files
10.6 MB
2.8M tokens
6563 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (11,266K chars total). Download the full file to get everything.
Repository: snap-research/stable-flow
Branch: main
Commit: c99ac0eba297
Files: 478
Total size: 10.6 MB

Directory structure:
gitextract_693itit8/

├── .gitignore
├── LICENSE
├── README.md
├── environment.yml
├── run_stable_flow.py
├── setup.py
└── src/
    └── diffusers/
        ├── __init__.py
        ├── callbacks.py
        ├── commands/
        │   ├── __init__.py
        │   ├── diffusers_cli.py
        │   ├── env.py
        │   └── fp16_safetensors.py
        ├── configuration_utils.py
        ├── dependency_versions_check.py
        ├── dependency_versions_table.py
        ├── experimental/
        │   ├── README.md
        │   ├── __init__.py
        │   └── rl/
        │       ├── __init__.py
        │       └── value_guided_sampling.py
        ├── image_processor.py
        ├── loaders/
        │   ├── __init__.py
        │   ├── ip_adapter.py
        │   ├── lora_base.py
        │   ├── lora_conversion_utils.py
        │   ├── lora_pipeline.py
        │   ├── peft.py
        │   ├── single_file.py
        │   ├── single_file_model.py
        │   ├── single_file_utils.py
        │   ├── textual_inversion.py
        │   ├── unet.py
        │   ├── unet_loader_utils.py
        │   └── utils.py
        ├── models/
        │   ├── README.md
        │   ├── __init__.py
        │   ├── activations.py
        │   ├── adapter.py
        │   ├── attention.py
        │   ├── attention_flax.py
        │   ├── attention_processor.py
        │   ├── autoencoders/
        │   │   ├── __init__.py
        │   │   ├── autoencoder_asym_kl.py
        │   │   ├── autoencoder_kl.py
        │   │   ├── autoencoder_kl_cogvideox.py
        │   │   ├── autoencoder_kl_temporal_decoder.py
        │   │   ├── autoencoder_oobleck.py
        │   │   ├── autoencoder_tiny.py
        │   │   ├── consistency_decoder_vae.py
        │   │   ├── vae.py
        │   │   └── vq_model.py
        │   ├── controlnet.py
        │   ├── controlnet_flax.py
        │   ├── controlnet_hunyuan.py
        │   ├── controlnet_sd3.py
        │   ├── controlnet_sparsectrl.py
        │   ├── controlnet_xs.py
        │   ├── downsampling.py
        │   ├── embeddings.py
        │   ├── embeddings_flax.py
        │   ├── lora.py
        │   ├── model_loading_utils.py
        │   ├── modeling_flax_pytorch_utils.py
        │   ├── modeling_flax_utils.py
        │   ├── modeling_outputs.py
        │   ├── modeling_pytorch_flax_utils.py
        │   ├── modeling_utils.py
        │   ├── normalization.py
        │   ├── resnet.py
        │   ├── resnet_flax.py
        │   ├── transformers/
        │   │   ├── __init__.py
        │   │   ├── auraflow_transformer_2d.py
        │   │   ├── cogvideox_transformer_3d.py
        │   │   ├── dit_transformer_2d.py
        │   │   ├── dual_transformer_2d.py
        │   │   ├── hunyuan_transformer_2d.py
        │   │   ├── latte_transformer_3d.py
        │   │   ├── lumina_nextdit2d.py
        │   │   ├── pixart_transformer_2d.py
        │   │   ├── prior_transformer.py
        │   │   ├── stable_audio_transformer.py
        │   │   ├── t5_film_transformer.py
        │   │   ├── transformer_2d.py
        │   │   ├── transformer_flux.py
        │   │   ├── transformer_sd3.py
        │   │   └── transformer_temporal.py
        │   ├── unets/
        │   │   ├── __init__.py
        │   │   ├── unet_1d.py
        │   │   ├── unet_1d_blocks.py
        │   │   ├── unet_2d.py
        │   │   ├── unet_2d_blocks.py
        │   │   ├── unet_2d_blocks_flax.py
        │   │   ├── unet_2d_condition.py
        │   │   ├── unet_2d_condition_flax.py
        │   │   ├── unet_3d_blocks.py
        │   │   ├── unet_3d_condition.py
        │   │   ├── unet_i2vgen_xl.py
        │   │   ├── unet_kandinsky3.py
        │   │   ├── unet_motion_model.py
        │   │   ├── unet_spatio_temporal_condition.py
        │   │   ├── unet_stable_cascade.py
        │   │   └── uvit_2d.py
        │   ├── upsampling.py
        │   ├── vae_flax.py
        │   └── vq_model.py
        ├── optimization.py
        ├── pipelines/
        │   ├── README.md
        │   ├── __init__.py
        │   ├── amused/
        │   │   ├── __init__.py
        │   │   ├── pipeline_amused.py
        │   │   ├── pipeline_amused_img2img.py
        │   │   └── pipeline_amused_inpaint.py
        │   ├── animatediff/
        │   │   ├── __init__.py
        │   │   ├── pipeline_animatediff.py
        │   │   ├── pipeline_animatediff_controlnet.py
        │   │   ├── pipeline_animatediff_sdxl.py
        │   │   ├── pipeline_animatediff_sparsectrl.py
        │   │   ├── pipeline_animatediff_video2video.py
        │   │   └── pipeline_output.py
        │   ├── audioldm/
        │   │   ├── __init__.py
        │   │   └── pipeline_audioldm.py
        │   ├── audioldm2/
        │   │   ├── __init__.py
        │   │   ├── modeling_audioldm2.py
        │   │   └── pipeline_audioldm2.py
        │   ├── aura_flow/
        │   │   ├── __init__.py
        │   │   └── pipeline_aura_flow.py
        │   ├── auto_pipeline.py
        │   ├── blip_diffusion/
        │   │   ├── __init__.py
        │   │   ├── blip_image_processing.py
        │   │   ├── modeling_blip2.py
        │   │   ├── modeling_ctx_clip.py
        │   │   └── pipeline_blip_diffusion.py
        │   ├── cogvideo/
        │   │   ├── __init__.py
        │   │   └── pipeline_cogvideox.py
        │   ├── consistency_models/
        │   │   ├── __init__.py
        │   │   └── pipeline_consistency_models.py
        │   ├── controlnet/
        │   │   ├── __init__.py
        │   │   ├── multicontrolnet.py
        │   │   ├── pipeline_controlnet.py
        │   │   ├── pipeline_controlnet_blip_diffusion.py
        │   │   ├── pipeline_controlnet_img2img.py
        │   │   ├── pipeline_controlnet_inpaint.py
        │   │   ├── pipeline_controlnet_inpaint_sd_xl.py
        │   │   ├── pipeline_controlnet_sd_xl.py
        │   │   ├── pipeline_controlnet_sd_xl_img2img.py
        │   │   └── pipeline_flax_controlnet.py
        │   ├── controlnet_hunyuandit/
        │   │   ├── __init__.py
        │   │   └── pipeline_hunyuandit_controlnet.py
        │   ├── controlnet_sd3/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_3_controlnet.py
        │   ├── controlnet_xs/
        │   │   ├── __init__.py
        │   │   ├── pipeline_controlnet_xs.py
        │   │   └── pipeline_controlnet_xs_sd_xl.py
        │   ├── dance_diffusion/
        │   │   ├── __init__.py
        │   │   └── pipeline_dance_diffusion.py
        │   ├── ddim/
        │   │   ├── __init__.py
        │   │   └── pipeline_ddim.py
        │   ├── ddpm/
        │   │   ├── __init__.py
        │   │   └── pipeline_ddpm.py
        │   ├── deepfloyd_if/
        │   │   ├── __init__.py
        │   │   ├── pipeline_if.py
        │   │   ├── pipeline_if_img2img.py
        │   │   ├── pipeline_if_img2img_superresolution.py
        │   │   ├── pipeline_if_inpainting.py
        │   │   ├── pipeline_if_inpainting_superresolution.py
        │   │   ├── pipeline_if_superresolution.py
        │   │   ├── pipeline_output.py
        │   │   ├── safety_checker.py
        │   │   ├── timesteps.py
        │   │   └── watermark.py
        │   ├── deprecated/
        │   │   ├── README.md
        │   │   ├── __init__.py
        │   │   ├── alt_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── modeling_roberta_series.py
        │   │   │   ├── pipeline_alt_diffusion.py
        │   │   │   ├── pipeline_alt_diffusion_img2img.py
        │   │   │   └── pipeline_output.py
        │   │   ├── audio_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── mel.py
        │   │   │   └── pipeline_audio_diffusion.py
        │   │   ├── latent_diffusion_uncond/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_latent_diffusion_uncond.py
        │   │   ├── pndm/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_pndm.py
        │   │   ├── repaint/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_repaint.py
        │   │   ├── score_sde_ve/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_score_sde_ve.py
        │   │   ├── spectrogram_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── continuous_encoder.py
        │   │   │   ├── midi_utils.py
        │   │   │   ├── notes_encoder.py
        │   │   │   └── pipeline_spectrogram_diffusion.py
        │   │   ├── stable_diffusion_variants/
        │   │   │   ├── __init__.py
        │   │   │   ├── pipeline_cycle_diffusion.py
        │   │   │   ├── pipeline_onnx_stable_diffusion_inpaint_legacy.py
        │   │   │   ├── pipeline_stable_diffusion_inpaint_legacy.py
        │   │   │   ├── pipeline_stable_diffusion_model_editing.py
        │   │   │   ├── pipeline_stable_diffusion_paradigms.py
        │   │   │   └── pipeline_stable_diffusion_pix2pix_zero.py
        │   │   ├── stochastic_karras_ve/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_stochastic_karras_ve.py
        │   │   ├── versatile_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── modeling_text_unet.py
        │   │   │   ├── pipeline_versatile_diffusion.py
        │   │   │   ├── pipeline_versatile_diffusion_dual_guided.py
        │   │   │   ├── pipeline_versatile_diffusion_image_variation.py
        │   │   │   └── pipeline_versatile_diffusion_text_to_image.py
        │   │   └── vq_diffusion/
        │   │       ├── __init__.py
        │   │       └── pipeline_vq_diffusion.py
        │   ├── dit/
        │   │   ├── __init__.py
        │   │   └── pipeline_dit.py
        │   ├── flux/
        │   │   ├── __init__.py
        │   │   ├── pipeline_flux.py
        │   │   └── pipeline_output.py
        │   ├── free_init_utils.py
        │   ├── free_noise_utils.py
        │   ├── hunyuandit/
        │   │   ├── __init__.py
        │   │   └── pipeline_hunyuandit.py
        │   ├── i2vgen_xl/
        │   │   ├── __init__.py
        │   │   └── pipeline_i2vgen_xl.py
        │   ├── kandinsky/
        │   │   ├── __init__.py
        │   │   ├── pipeline_kandinsky.py
        │   │   ├── pipeline_kandinsky_combined.py
        │   │   ├── pipeline_kandinsky_img2img.py
        │   │   ├── pipeline_kandinsky_inpaint.py
        │   │   ├── pipeline_kandinsky_prior.py
        │   │   └── text_encoder.py
        │   ├── kandinsky2_2/
        │   │   ├── __init__.py
        │   │   ├── pipeline_kandinsky2_2.py
        │   │   ├── pipeline_kandinsky2_2_combined.py
        │   │   ├── pipeline_kandinsky2_2_controlnet.py
        │   │   ├── pipeline_kandinsky2_2_controlnet_img2img.py
        │   │   ├── pipeline_kandinsky2_2_img2img.py
        │   │   ├── pipeline_kandinsky2_2_inpainting.py
        │   │   ├── pipeline_kandinsky2_2_prior.py
        │   │   └── pipeline_kandinsky2_2_prior_emb2emb.py
        │   ├── kandinsky3/
        │   │   ├── __init__.py
        │   │   ├── convert_kandinsky3_unet.py
        │   │   ├── pipeline_kandinsky3.py
        │   │   └── pipeline_kandinsky3_img2img.py
        │   ├── kolors/
        │   │   ├── __init__.py
        │   │   ├── pipeline_kolors.py
        │   │   ├── pipeline_kolors_img2img.py
        │   │   ├── pipeline_output.py
        │   │   ├── text_encoder.py
        │   │   └── tokenizer.py
        │   ├── latent_consistency_models/
        │   │   ├── __init__.py
        │   │   ├── pipeline_latent_consistency_img2img.py
        │   │   └── pipeline_latent_consistency_text2img.py
        │   ├── latent_diffusion/
        │   │   ├── __init__.py
        │   │   ├── pipeline_latent_diffusion.py
        │   │   └── pipeline_latent_diffusion_superresolution.py
        │   ├── latte/
        │   │   ├── __init__.py
        │   │   └── pipeline_latte.py
        │   ├── ledits_pp/
        │   │   ├── __init__.py
        │   │   ├── pipeline_leditspp_stable_diffusion.py
        │   │   ├── pipeline_leditspp_stable_diffusion_xl.py
        │   │   └── pipeline_output.py
        │   ├── lumina/
        │   │   ├── __init__.py
        │   │   └── pipeline_lumina.py
        │   ├── marigold/
        │   │   ├── __init__.py
        │   │   ├── marigold_image_processing.py
        │   │   ├── pipeline_marigold_depth.py
        │   │   └── pipeline_marigold_normals.py
        │   ├── musicldm/
        │   │   ├── __init__.py
        │   │   └── pipeline_musicldm.py
        │   ├── onnx_utils.py
        │   ├── pag/
        │   │   ├── __init__.py
        │   │   ├── pag_utils.py
        │   │   ├── pipeline_pag_controlnet_sd.py
        │   │   ├── pipeline_pag_controlnet_sd_xl.py
        │   │   ├── pipeline_pag_hunyuandit.py
        │   │   ├── pipeline_pag_kolors.py
        │   │   ├── pipeline_pag_pixart_sigma.py
        │   │   ├── pipeline_pag_sd.py
        │   │   ├── pipeline_pag_sd_3.py
        │   │   ├── pipeline_pag_sd_animatediff.py
        │   │   ├── pipeline_pag_sd_xl.py
        │   │   ├── pipeline_pag_sd_xl_img2img.py
        │   │   └── pipeline_pag_sd_xl_inpaint.py
        │   ├── paint_by_example/
        │   │   ├── __init__.py
        │   │   ├── image_encoder.py
        │   │   └── pipeline_paint_by_example.py
        │   ├── pia/
        │   │   ├── __init__.py
        │   │   └── pipeline_pia.py
        │   ├── pipeline_flax_utils.py
        │   ├── pipeline_loading_utils.py
        │   ├── pipeline_utils.py
        │   ├── pixart_alpha/
        │   │   ├── __init__.py
        │   │   ├── pipeline_pixart_alpha.py
        │   │   └── pipeline_pixart_sigma.py
        │   ├── semantic_stable_diffusion/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   └── pipeline_semantic_stable_diffusion.py
        │   ├── shap_e/
        │   │   ├── __init__.py
        │   │   ├── camera.py
        │   │   ├── pipeline_shap_e.py
        │   │   ├── pipeline_shap_e_img2img.py
        │   │   └── renderer.py
        │   ├── stable_audio/
        │   │   ├── __init__.py
        │   │   ├── modeling_stable_audio.py
        │   │   └── pipeline_stable_audio.py
        │   ├── stable_cascade/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_cascade.py
        │   │   ├── pipeline_stable_cascade_combined.py
        │   │   └── pipeline_stable_cascade_prior.py
        │   ├── stable_diffusion/
        │   │   ├── README.md
        │   │   ├── __init__.py
        │   │   ├── clip_image_project_model.py
        │   │   ├── convert_from_ckpt.py
        │   │   ├── pipeline_flax_stable_diffusion.py
        │   │   ├── pipeline_flax_stable_diffusion_img2img.py
        │   │   ├── pipeline_flax_stable_diffusion_inpaint.py
        │   │   ├── pipeline_onnx_stable_diffusion.py
        │   │   ├── pipeline_onnx_stable_diffusion_img2img.py
        │   │   ├── pipeline_onnx_stable_diffusion_inpaint.py
        │   │   ├── pipeline_onnx_stable_diffusion_upscale.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion.py
        │   │   ├── pipeline_stable_diffusion_depth2img.py
        │   │   ├── pipeline_stable_diffusion_image_variation.py
        │   │   ├── pipeline_stable_diffusion_img2img.py
        │   │   ├── pipeline_stable_diffusion_inpaint.py
        │   │   ├── pipeline_stable_diffusion_instruct_pix2pix.py
        │   │   ├── pipeline_stable_diffusion_latent_upscale.py
        │   │   ├── pipeline_stable_diffusion_upscale.py
        │   │   ├── pipeline_stable_unclip.py
        │   │   ├── pipeline_stable_unclip_img2img.py
        │   │   ├── safety_checker.py
        │   │   ├── safety_checker_flax.py
        │   │   └── stable_unclip_image_normalizer.py
        │   ├── stable_diffusion_3/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion_3.py
        │   │   ├── pipeline_stable_diffusion_3_img2img.py
        │   │   └── pipeline_stable_diffusion_3_inpaint.py
        │   ├── stable_diffusion_attend_and_excite/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_attend_and_excite.py
        │   ├── stable_diffusion_diffedit/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_diffedit.py
        │   ├── stable_diffusion_gligen/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_diffusion_gligen.py
        │   │   └── pipeline_stable_diffusion_gligen_text_image.py
        │   ├── stable_diffusion_k_diffusion/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_diffusion_k_diffusion.py
        │   │   └── pipeline_stable_diffusion_xl_k_diffusion.py
        │   ├── stable_diffusion_ldm3d/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_ldm3d.py
        │   ├── stable_diffusion_panorama/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_panorama.py
        │   ├── stable_diffusion_safe/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion_safe.py
        │   │   └── safety_checker.py
        │   ├── stable_diffusion_sag/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_sag.py
        │   ├── stable_diffusion_xl/
        │   │   ├── __init__.py
        │   │   ├── pipeline_flax_stable_diffusion_xl.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion_xl.py
        │   │   ├── pipeline_stable_diffusion_xl_img2img.py
        │   │   ├── pipeline_stable_diffusion_xl_inpaint.py
        │   │   ├── pipeline_stable_diffusion_xl_instruct_pix2pix.py
        │   │   └── watermark.py
        │   ├── stable_video_diffusion/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_video_diffusion.py
        │   ├── t2i_adapter/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_diffusion_adapter.py
        │   │   └── pipeline_stable_diffusion_xl_adapter.py
        │   ├── text_to_video_synthesis/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_text_to_video_synth.py
        │   │   ├── pipeline_text_to_video_synth_img2img.py
        │   │   ├── pipeline_text_to_video_zero.py
        │   │   └── pipeline_text_to_video_zero_sdxl.py
        │   ├── unclip/
        │   │   ├── __init__.py
        │   │   ├── pipeline_unclip.py
        │   │   ├── pipeline_unclip_image_variation.py
        │   │   └── text_proj.py
        │   ├── unidiffuser/
        │   │   ├── __init__.py
        │   │   ├── modeling_text_decoder.py
        │   │   ├── modeling_uvit.py
        │   │   └── pipeline_unidiffuser.py
        │   └── wuerstchen/
        │       ├── __init__.py
        │       ├── modeling_paella_vq_model.py
        │       ├── modeling_wuerstchen_common.py
        │       ├── modeling_wuerstchen_diffnext.py
        │       ├── modeling_wuerstchen_prior.py
        │       ├── pipeline_wuerstchen.py
        │       ├── pipeline_wuerstchen_combined.py
        │       └── pipeline_wuerstchen_prior.py
        ├── py.typed
        ├── schedulers/
        │   ├── README.md
        │   ├── __init__.py
        │   ├── deprecated/
        │   │   ├── __init__.py
        │   │   ├── scheduling_karras_ve.py
        │   │   └── scheduling_sde_vp.py
        │   ├── scheduling_amused.py
        │   ├── scheduling_consistency_decoder.py
        │   ├── scheduling_consistency_models.py
        │   ├── scheduling_cosine_dpmsolver_multistep.py
        │   ├── scheduling_ddim.py
        │   ├── scheduling_ddim_cogvideox.py
        │   ├── scheduling_ddim_flax.py
        │   ├── scheduling_ddim_inverse.py
        │   ├── scheduling_ddim_parallel.py
        │   ├── scheduling_ddpm.py
        │   ├── scheduling_ddpm_flax.py
        │   ├── scheduling_ddpm_parallel.py
        │   ├── scheduling_ddpm_wuerstchen.py
        │   ├── scheduling_deis_multistep.py
        │   ├── scheduling_dpm_cogvideox.py
        │   ├── scheduling_dpmsolver_multistep.py
        │   ├── scheduling_dpmsolver_multistep_flax.py
        │   ├── scheduling_dpmsolver_multistep_inverse.py
        │   ├── scheduling_dpmsolver_sde.py
        │   ├── scheduling_dpmsolver_singlestep.py
        │   ├── scheduling_edm_dpmsolver_multistep.py
        │   ├── scheduling_edm_euler.py
        │   ├── scheduling_euler_ancestral_discrete.py
        │   ├── scheduling_euler_discrete.py
        │   ├── scheduling_euler_discrete_flax.py
        │   ├── scheduling_flow_match_euler_discrete.py
        │   ├── scheduling_flow_match_heun_discrete.py
        │   ├── scheduling_heun_discrete.py
        │   ├── scheduling_ipndm.py
        │   ├── scheduling_k_dpm_2_ancestral_discrete.py
        │   ├── scheduling_k_dpm_2_discrete.py
        │   ├── scheduling_karras_ve_flax.py
        │   ├── scheduling_lcm.py
        │   ├── scheduling_lms_discrete.py
        │   ├── scheduling_lms_discrete_flax.py
        │   ├── scheduling_pndm.py
        │   ├── scheduling_pndm_flax.py
        │   ├── scheduling_repaint.py
        │   ├── scheduling_sasolver.py
        │   ├── scheduling_sde_ve.py
        │   ├── scheduling_sde_ve_flax.py
        │   ├── scheduling_tcd.py
        │   ├── scheduling_unclip.py
        │   ├── scheduling_unipc_multistep.py
        │   ├── scheduling_utils.py
        │   ├── scheduling_utils_flax.py
        │   └── scheduling_vq_diffusion.py
        ├── training_utils.py
        ├── utils/
        │   ├── __init__.py
        │   ├── accelerate_utils.py
        │   ├── constants.py
        │   ├── deprecation_utils.py
        │   ├── doc_utils.py
        │   ├── dummy_flax_and_transformers_objects.py
        │   ├── dummy_flax_objects.py
        │   ├── dummy_note_seq_objects.py
        │   ├── dummy_onnx_objects.py
        │   ├── dummy_pt_objects.py
        │   ├── dummy_torch_and_librosa_objects.py
        │   ├── dummy_torch_and_scipy_objects.py
        │   ├── dummy_torch_and_torchsde_objects.py
        │   ├── dummy_torch_and_transformers_and_k_diffusion_objects.py
        │   ├── dummy_torch_and_transformers_and_onnx_objects.py
        │   ├── dummy_torch_and_transformers_and_sentencepiece_objects.py
        │   ├── dummy_torch_and_transformers_objects.py
        │   ├── dummy_transformers_and_torch_and_note_seq_objects.py
        │   ├── dynamic_modules_utils.py
        │   ├── export_utils.py
        │   ├── hub_utils.py
        │   ├── import_utils.py
        │   ├── loading_utils.py
        │   ├── logging.py
        │   ├── model_card_template.md
        │   ├── outputs.py
        │   ├── peft_utils.py
        │   ├── pil_utils.py
        │   ├── state_dict_utils.py
        │   ├── testing_utils.py
        │   ├── torch_utils.py
        │   └── versions.py
        └── video_processor.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Initially taken from GitHub's Python gitignore file

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# tests and logs
tests/fixtures/cached_*_text.txt
logs/
lightning_logs/
lang_code_data/

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a Python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# vscode
.vs
.vscode

# Pycharm
.idea

# TF code
tensorflow_code

# Models
proc_data

# examples
runs
/runs_old
/wandb
/examples/runs
/examples/**/*.args
/examples/rag/sweep

# data
/data
serialization_dir

# emacs
*.*~
debug.env

# vim
.*.swp

# ctags
tags

# pre-commit
.pre-commit*

# .lock
*.lock

# DS_Store (MacOS)
.DS_Store

# RL pipelines may produce mp4 outputs
*.mp4

# dependencies
/transformers

# ruff
.ruff_cache

# wandb
wandb

# Projest stuff
outputs/

================================================
FILE: LICENSE
================================================
Copyright (c) 2025 Snap Inc.
Copyright (c) 2025 The Hebrew University of Jerusalem
Copyright (c) 2025 Tel Aviv University
Copyright (c) 2025 Reichman University

This sample code is made available for non-commercial, research purposes only. 

Non-commercial means not primarily intended for or directed towards commercial advantage or monetary compensation. Research purposes mean solely for study, instruction, or non-commercial research, testing or validation. 

Furthermore, this sample code incorporates the FLUX.1 [dev] model licensed under the FLUX.1 [dev] Non-Commercial License by Black Forest Labs copied below. Please note the further use restrictions outlined in Section 4.

No commercial license, whether implied or otherwise, is granted in or to this code, unless you have entered into separate agreements with the authors and/or Black Forest Labs for such rights. 

This sample code is provided as-is, without warranty of any kind, express or implied, including any warranties of merchantability, title, fitness for a particular purpose, non-infringement, or that the code is free of defects, errors or viruses. In no event will the authors be liable for any damages or losses of any kind arising from this sample code or your use thereof.

Any redistribution of this sample code, including in binary form, must retain or reproduce the above copyright notice, conditions and disclaimer, as well as the FLUX.1 [dev] Non-Commercial license text copied below. 

—

FLUX.1 [dev] Model - Non-Commercial License 


Black Forest Labs, Inc. (“we” or “our” or “Company”) is pleased to make available the weights, parameters and inference code for the FLUX.1 [dev] Model (as defined below) freely available for your non-commercial and non-production use as set forth in this FLUX.1 [dev] Non-Commercial License (“License”).  The “FLUX.1 [dev] Model” means the FLUX.1 [dev] AI models, including FLUX.1 [dev], FLUX.1 Fill [dev], FLUX.1 Depth [dev], FLUX.1 Canny [dev], FLUX.1 Redux [dev], FLUX.1 Canny [dev] LoRA and FLUX.1 Depth [dev] LoRA, and their elements which includes algorithms, software, checkpoints, parameters, source code (inference code, evaluation code, and if applicable, fine-tuning code) and any other materials associated with the FLUX.1 [dev] AI models made available by Company under this License, including if any, the technical documentation, manuals and instructions for the use and operation thereof (collectively, “FLUX.1 [dev] Model”).


By downloading, accessing, use, Distributing (as defined below), or creating a Derivative (as defined below) of the FLUX.1 [dev] Model, you agree to the terms of this License. If you do not agree to this License, then you do not have any rights to access, use, Distribute or create a Derivative of the FLUX.1 [dev] Model and you must immediately cease using the FLUX.1 [dev] Model. If you are agreeing to be bound by the terms of this License on behalf of your employer or other entity, you represent and warrant to us that you have full legal authority to bind your employer or such entity to this License. If you do not have the requisite authority, you may not accept the License or access the FLUX.1 [dev] Model on behalf of your employer or other entity.


    1. Definitions. 

Capitalized terms used in this License but not defined herein have the following meanings:
        a. “Derivative”  means any (i) modified version of the FLUX.1 [dev] Model (including but not limited to any customized or fine-tuned version thereof), (ii) work based on the FLUX.1 [dev] Model, or (iii) any other derivative work thereof. For the avoidance of doubt, Outputs are not considered Derivatives under this License. 
        b. “Distribution” or “Distribute” or “Distributing” means providing or making available, by any means, a copy of the FLUX.1 [dev] Models and/or the Derivatives as the case may be. 
        c. “Non-Commercial Purpose” means any of the following uses, but only so far as you do not receive any direct or indirect payment arising from the use of the model or its output: (i) personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, or otherwise not directly or indirectly connected to any commercial activities, business operations, or employment responsibilities; (ii) use by commercial or for-profit entities for testing, evaluation, or non-commercial research and development in a non-production environment, (iii) use by any charitable organization for charitable purposes, or for testing or evaluation. For clarity, use for revenue-generating activity or direct interactions with or impacts on end users, or use to train, fine tune or distill other models for commercial use is not a Non-Commercial purpose.
        d. “Outputs” means any content generated by the operation of the FLUX.1 [dev] Models or the Derivatives from a prompt (i.e., text instructions) provided by users. For the avoidance of doubt, Outputs do not include any components of a FLUX.1 [dev] Models, such as any fine-tuned versions of the FLUX.1 [dev] Models, the weights, or parameters. 
        e.   “you” or “your” means the individual or entity entering into this License with Company.


    2. License Grant.


        a. License. Subject to your compliance with this License, Company grants you a non-exclusive, worldwide, non-transferable, non-sublicensable, revocable, royalty free and limited license to access, use, create Derivatives of, and Distribute the FLUX.1 [dev] Models solely for your Non-Commercial Purposes. The foregoing license is personal to you, and you may not assign or sublicense this License or any other rights or obligations under this License without Company’s prior written consent; any such assignment or sublicense will be void and will automatically and immediately terminate this License.  Any restrictions set forth herein in regarding the FLUX.1 [dev] Model also applies to any Derivative you create or that are created on your behalf.
        b. Non-Commercial Use Only.  You may only access, use, Distribute, or creative Derivatives of or the FLUX.1 [dev] Model or Derivatives for Non-Commercial Purposes.  If You want to use a FLUX.1 [dev] Model a Derivative for any purpose that is not expressly authorized under this License, such as for a commercial activity, you must request a license from Company, which Company may grant to you in Company’s sole discretion and which additional use may be subject to a fee, royalty or other revenue share. Please contact Company at the following e-mail address if you want to discuss such a license: info@blackforestlabs.ai. 
        c. Reserved Rights. The grant of rights expressly set forth in this License are the complete grant of rights to you in the FLUX.1 [dev] Model, and no other licenses are granted, whether by waiver, estoppel, implication, equity or otherwise. Company and its licensors reserve all rights not expressly granted by this License. 
        d. Outputs. We claim no ownership rights in and to the Outputs. You are solely responsible for the Outputs you generate and their subsequent uses in accordance with this License.  You may use Output for any purpose (including for commercial purposes), except as expressly prohibited herein.  You may not use the Output to train, fine-tune or distill a model that is competitive with the FLUX.1 [dev] Model.


    3. Distribution. 

Subject to this License, you may Distribute copies of the FLUX.1 [dev] Model and/or Derivatives made by you, under the following conditions: 
        a. you must make available a copy of this License to third-party recipients of the FLUX.1 [dev] Models and/or Derivatives you Distribute, and specify that any rights to use the FLUX.1 [dev] Models and/or Derivatives shall be directly granted by Company to said third-party recipients pursuant to this License; 
        b. you must make prominently display the following notice alongside the Distribution of the FLUX.1 [dev] Model or Derivative (such as via a “Notice” text file distributed as part of such FLUX.1 [dev] Model or Derivative) (the “Attribution Notice”): 
“The FLUX.1 [dev] Model is licensed by Black Forest Labs. Inc. under the FLUX.1 [dev] Non-Commercial License. Copyright Black Forest Labs. Inc. 
IN NO EVENT SHALL BLACK FOREST LABS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH USE OF THIS MODEL.”
        c. in the case of Distribution of Derivatives made by you, you must also include in the Attribution Notice a statement that you have modified the applicable FLUX.1 [dev] Model; and
        d. in the case of Distribution of Derivatives made by you, any terms and conditions you impose on any third-party recipients relating to Derivatives made by or for you shall neither limit such third-party recipients’ use of the FLUX.1 [dev] Model or any Derivatives made by or for Company in accordance with this License nor conflict with any of its terms and conditions. 
        e. In the case of Distribution of Derivatives made by you, you must not misrepresent or imply, through any means, that the Derivatives made by or for you and/or any modified version of the FLUX.1 [dev] Model you Distribute under your name and responsibility is an official product of the Company or has been endorsed, approved or validated by the Company, unless you are authorized by Company to do so in writing.


    4. Restrictions.  

You will not, and will not permit, assist or cause any third party to 
        a. use, modify, copy, reproduce, create Derivatives of, or Distribute the FLUX.1 [dev] Model (or any Derivative thereof, or any data produced by the FLUX.1 [dev] Model), in whole or in part, for (i) any commercial or production purposes, (ii) military purposes, (iii) purposes of surveillance, including any research or development relating to surveillance, (iv) biometric processing, (v) in any manner that infringes, misappropriates, or otherwise violates any third-party rights, or (vi) in any manner that violates any applicable law and violating any privacy or security laws, rules, regulations, directives, or governmental requirements (including the General Data Privacy Regulation (Regulation (EU) 2016/679), the California Consumer Privacy Act, and any and all laws governing the processing of biometric information), as well as all amendments and successor laws to any of the foregoing;
        b. alter or remove copyright and other proprietary notices which appear on or in any portion of the FLUX.1 [dev] Model;
        c. utilize any equipment, device, software, or other means to circumvent or remove any security or protection used by Company in connection with the FLUX.1 [dev] Model, or to circumvent or remove any usage restrictions, or to enable functionality disabled by FLUX.1 [dev] Model; or
        d. offer or impose any terms on the FLUX.1 [dev] Model that alter, restrict, or are inconsistent with the terms of this License.
        e. violate any applicable U.S. and non-U.S. export control and trade sanctions laws (“Export Laws”) in connection with your use or Distribution of any FLUX.1 [dev] Model;
        f. directly or indirectly Distribute, export, or otherwise transfer FLUX.1 [dev] Model  (a) to any individual, entity, or country prohibited by Export Laws; (b) to anyone on U.S. or non-U.S. government restricted parties lists; or (c) for any purpose prohibited by Export Laws, including nuclear, chemical or biological weapons, or missile technology applications; 3) use or download FLUX.1 [dev] Model if you or they are  (a) located in a comprehensively sanctioned jurisdiction, (b) currently listed on any U.S. or non-U.S. restricted parties list, or (c) for any purpose prohibited by Export Laws; and (4) will not disguise your location through IP proxying or other methods.


    5. DISCLAIMERS.  

THE FLUX.1 [dev] MODEL IS PROVIDED “AS IS” AND “WITH ALL FAULTS” WITH NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. COMPANY EXPRESSLY DISCLAIMS ALL REPRESENTATIONS AND WARRANTIES, EXPRESS OR IMPLIED, WHETHER BY STATUTE, CUSTOM, USAGE OR OTHERWISE AS TO ANY MATTERS RELATED TO THE FLUX.1 [dev] MODEL, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, SATISFACTORY QUALITY, OR NON-INFRINGEMENT. COMPANY MAKES NO WARRANTIES OR REPRESENTATIONS THAT THE FLUX.1 [dev] MODEL WILL BE ERROR FREE OR FREE OF VIRUSES OR OTHER HARMFUL COMPONENTS, OR PRODUCE ANY PARTICULAR RESULTS.


    6. LIMITATION OF LIABILITY.  

TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT WILL COMPANY BE LIABLE TO YOU OR YOUR EMPLOYEES, AFFILIATES, USERS, OFFICERS OR DIRECTORS (A) UNDER ANY THEORY OF LIABILITY, WHETHER BASED IN CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY, WARRANTY, OR OTHERWISE UNDER THIS LICENSE, OR (B) FOR ANY INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, PUNITIVE OR SPECIAL DAMAGES OR LOST PROFITS, EVEN IF COMPANY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE FLUX.1 [dev] MODEL, ITS CONSTITUENT COMPONENTS, AND ANY OUTPUT (COLLECTIVELY, “MODEL MATERIALS”) ARE NOT DESIGNED OR INTENDED FOR USE IN ANY APPLICATION OR SITUATION WHERE FAILURE OR FAULT OF THE MODEL MATERIALS COULD REASONABLY BE ANTICIPATED TO LEAD TO SERIOUS INJURY OF ANY PERSON, INCLUDING POTENTIAL DISCRIMINATION OR VIOLATION OF AN INDIVIDUAL’S PRIVACY RIGHTS, OR TO SEVERE PHYSICAL, PROPERTY, OR ENVIRONMENTAL DAMAGE (EACH, A “HIGH-RISK USE”). IF YOU ELECT TO USE ANY OF THE MODEL MATERIALS FOR A HIGH-RISK USE, YOU DO SO AT YOUR OWN RISK. YOU AGREE TO DESIGN AND IMPLEMENT APPROPRIATE DECISION-MAKING AND RISK-MITIGATION PROCEDURES AND POLICIES IN CONNECTION WITH A HIGH-RISK USE SUCH THAT EVEN IF THERE IS A FAILURE OR FAULT IN ANY OF THE MODEL MATERIALS, THE SAFETY OF PERSONS OR PROPERTY AFFECTED BY THE ACTIVITY STAYS AT A LEVEL THAT IS REASONABLE, APPROPRIATE, AND LAWFUL FOR THE FIELD OF THE HIGH-RISK USE.


    7. INDEMNIFICATION

You will indemnify, defend and hold harmless Company and our subsidiaries and affiliates, and each of our respective shareholders, directors, officers, employees, agents, successors, and assigns (collectively, the “Company Parties”) from and against any losses, liabilities, damages, fines, penalties, and expenses (including reasonable attorneys’ fees) incurred by any Company Party in connection with any claim, demand, allegation, lawsuit, proceeding, or investigation (collectively, “Claims”) arising out of or related to  (a) your access to or use of the FLUX.1 [dev] Model (as well as any Output, results or data generated from such access or use), including any High-Risk Use (defined below); (b) your violation of this License; or (c) your violation, misappropriation or infringement of any rights of another (including intellectual property or other proprietary rights and privacy rights). You will promptly notify the Company Parties of any such Claims, and cooperate with Company Parties in defending such Claims. You will also grant the Company Parties sole control of the defense or settlement, at Company’s sole option, of any Claims. This indemnity is in addition to, and not in lieu of, any other indemnities or remedies set forth in a written agreement between you and Company or the other Company Parties.


    8. Termination; Survival.


        a. This License will automatically terminate upon any breach by you of the terms of this License.
        b. We may terminate this License, in whole or in part, at any time upon notice (including electronic) to you.
        c. If You initiate any legal action or proceedings against Company or any other entity (including a cross-claim or counterclaim in a lawsuit), alleging that the FLUX.1 [dev] Model or any Derivative, or any part thereof, infringe upon intellectual property or other rights owned or licensable by you, then any licenses granted to you under this License will immediately terminate as of the date such legal action or claim is filed or initiated.
        d. Upon termination of this License, you must cease all use, access or Distribution of the FLUX.1 [dev] Model and any Derivatives.  The following sections survive termination of this License  2(c), 2(d), 4-11.  


    9. Third Party Materials. 

The FLUX.1 [dev] Model may contain third-party software or other components (including free and open source software) (all of the foregoing, “Third Party Materials”), which are subject to the license terms of the respective third-party licensors. Your dealings or correspondence with third parties and your use of or interaction with any Third Party Materials are solely between you and the third party. Company does not control or endorse, and makes no representations or warranties regarding, any Third Party Materials, and your access to and use of such Third Party Materials are at your own risk.


    10. Trademarks. 

You have not been granted any trademark license as part of this License and may not use any name or mark associated with Company without the prior written permission of Company, except to the extent necessary to make the reference required in the Attribution Notice as specified above or as is reasonably necessary in describing the FLUX.1 [dev] Model and its creators.  


    11. General. 

This License will be governed and construed under the laws of the State of Delaware without regard to conflicts of law provisions. If any provision or part of a provision of this License is unlawful, void or unenforceable, that provision or part of the provision is deemed severed from this License, and will not affect the validity and enforceability of any remaining provisions. The failure of Company to exercise or enforce any right or provision of this License will not operate as a waiver of such right or provision. This License does not confer any third-party beneficiary rights upon any other person or entity. This License, together with the Documentation, contains the entire understanding between you and Company regarding the subject matter of this License, and supersedes all other written or oral agreements and understandings between you and Company regarding such subject matter. No change or addition to any provision of this License will be binding unless it is in writing and signed by an authorized representative of both you and Company.

================================================
FILE: README.md
================================================
# Stable Flow: Vital Layers for Training-Free Image Editing [CVPR 2025]
<a href="https://omriavrahami.com/stable-flow/"><img src="https://img.shields.io/static/v1?label=Project&message=Website&color=blue"></a>
<a href="https://www.youtube.com/watch?v=_xYhppJj2a0"><img src="https://img.shields.io/static/v1?label=YouTube&message=Video&color=orange"></a>
<a href="https://arxiv.org/abs/2411.14430"><img src="https://img.shields.io/badge/arXiv-2411.14430-b31b1b.svg"></a>
<a href="https://pytorch.org/"><img src="https://img.shields.io/badge/PyTorch->=2.4.1-Red?logo=pytorch"></a>

> <a href="https://omriavrahami.com/stable-flow/">**Stable Flow: Vital Layers for Training-Free Image Editing**</a>
>
> Omri Avrahami, Or Patashnik, Ohad Fried, Egor Nemchinov, Kfir Aberman, Dani Lischinski, Daniel Cohen-Or
>
> Abstract: Diffusion models have revolutionized the field of content synthesis and editing. Recent models have replaced the traditional UNet architecture with the Diffusion Transformer (DiT), and employed flow-matching for improved training and sampling. However, they exhibit limited generation diversity. In this work, we leverage this limitation to perform consistent image edits via selective injection of attention features. The main challenge is that, unlike the UNet-based models, DiT lacks a coarse-to-fine synthesis structure, making it unclear in which layers to perform the injection. Therefore, we propose an automatic method to identify "vital layers" within DiT, crucial for image formation, and demonstrate how these layers facilitate a range of controlled stable edits, from non-rigid modifications to object addition, using the same mechanism. Next, to enable real-image editing, we introduce an improved image inversion method for flow models. Finally, we evaluate our approach through qualitative and quantitative comparisons, along with a user study, and demonstrate its effectiveness across multiple applications.

<p>
    <img src="docs/teaser.jpg" width="800px"/>  
    <br/>
    A training-free editing method that is able to perform various types of image editing operations, including non-rigid editing, object addition, object removal, and global scene editing. These different edits are done using the same mechanism.
</p>

# Applications

## Incremental Editing 
<img src="docs/incremental_editing.jpg" width="800px"/>

## Consistent Style
<img src="docs/consistent_style.jpg" width="800px"/>

## Text Editing
<img src="docs/text_editing.jpg" width="800px"/>

# Installation
Install the conda virtual environment:
```bash
conda env create -f environment.yml
conda activate stable-flow
```
You may need to update to your own `pytorch-cuda` version.

# Usage

## Generated Images Editing

You need to provide a list of prompts, where the first prompt describes the original scene, and the rest of the prompts describe the edited scene. For example:

```python
[
    "A photo of a dog in standing the street",
    "A photo of a dog sitting in the street",
    "A photo of a dog in standing and wearing a straw hat the street",
    "A photo of a mink",
]
```

Then, you can generate a batch of the image and its edited versions using:
```bash
python run_stable_flow.py \
--hf_token YOUR_PERSONAL_HUGGINGFACE_TOKEN \
--prompts "A photo of a dog in standing the street" \
"A photo of a dog sitting in the street" \
"A photo of a dog in standing and wearing a straw hat the street" \
"A photo of a mink"
```
where `YOUR_PERSONAL_HUGGINGFACE_TOKEN` is your [personal HuggingFace user access token](https://huggingface.co/docs/hub/en/security-tokens).

Then, the results will be saved to `outputs/result.jpg`, or any other path you specify under `--output_path`.

### Low GPU VRAM Usage
All the experiments in our paper were conducted using a single NVIDIA V100 GPU of 80GB VRAM. If you are using a GPU with smaller VRAM and getting `CUDA out of memory` errors, you can use [CPU offloading](https://huggingface.co/docs/diffusers/en/optimization/memory) by adding the `--cpu_offload` flag. It will reduce memory consumption but it will increase the inference time significantly.

## Real Images Editing (Optional)

If you want to edit a real image, you still need to provide a list of prompts, where the first prompt describes the input image and the rest of the prompts describe the edited scene. For example:

```bash
python run_stable_flow.py \
--hf_token YOUR_PERSONAL_HUGGINGFACE_TOKEN \
--input_img_path inputs/bottle.jpg \
--prompts "A photo of a bottle" \
"A photo of a bottle next to an apple"
```
where `YOUR_PERSONAL_HUGGINGFACE_TOKEN` is your [personal HuggingFace user access token](https://huggingface.co/docs/hub/en/security-tokens), and `--input_img_path` is the path to the input image. 

Then, the results will be saved to `outputs/result.jpg`, or any other path you specify under `--output_path`.


## Citation
If you find this useful for your research, please cite the following:
```bibtex
@InProceedings{Avrahami_2025_CVPR,
    author    = {Avrahami, Omri and Patashnik, Or and Fried, Ohad and Nemchinov, Egor and Aberman, Kfir and Lischinski, Dani and Cohen-Or, Daniel},
    title     = {Stable Flow: Vital Layers for Training-Free Image Editing},
    booktitle = {Proceedings of the Computer Vision and Pattern Recognition Conference (CVPR)},
    month     = {June},
    year      = {2025},
    pages     = {7877-7888}
}
```

================================================
FILE: environment.yml
================================================
name: stable-flow
channels:
  - pytorch
  - nvidia
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - blas=1.0=mkl
  - brotli-python=1.0.9=py311h6a678d5_8
  - bzip2=1.0.8=h5eee18b_6
  - ca-certificates=2024.7.2=h06a4308_0
  - certifi=2024.8.30=py311h06a4308_0
  - charset-normalizer=3.3.2=pyhd3eb1b0_0
  - cuda-cudart=12.1.105=0
  - cuda-cupti=12.1.105=0
  - cuda-libraries=12.1.0=0
  - cuda-nvrtc=12.1.105=0
  - cuda-nvtx=12.1.105=0
  - cuda-opencl=12.6.68=0
  - cuda-runtime=12.1.0=0
  - cuda-version=12.6=3
  - ffmpeg=4.3=hf484d3e_0
  - filelock=3.13.1=py311h06a4308_0
  - freetype=2.12.1=h4a9f257_0
  - gmp=6.2.1=h295c915_3
  - gmpy2=2.1.2=py311hc9b5ff0_0
  - gnutls=3.6.15=he1e5248_0
  - idna=3.7=py311h06a4308_0
  - intel-openmp=2023.1.0=hdb19cb5_46306
  - jinja2=3.1.4=py311h06a4308_0
  - jpeg=9e=h5eee18b_3
  - lame=3.100=h7b6447c_0
  - lcms2=2.12=h3be6417_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - lerc=3.0=h295c915_0
  - libcublas=12.1.0.26=0
  - libcufft=11.0.2.4=0
  - libcufile=1.11.1.6=0
  - libcurand=10.3.7.68=0
  - libcusolver=11.4.4.55=0
  - libcusparse=12.0.2.55=0
  - libdeflate=1.17=h5eee18b_1
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libiconv=1.16=h5eee18b_3
  - libidn2=2.3.4=h5eee18b_0
  - libjpeg-turbo=2.0.0=h9bf148f_0
  - libnpp=12.0.2.50=0
  - libnvjitlink=12.1.105=0
  - libnvjpeg=12.1.1.14=0
  - libpng=1.6.39=h5eee18b_0
  - libstdcxx-ng=11.2.0=h1234567_1
  - libtasn1=4.19.0=h5eee18b_0
  - libtiff=4.5.1=h6a678d5_0
  - libunistring=0.9.10=h27cfd23_0
  - libuuid=1.41.5=h5eee18b_0
  - libwebp-base=1.3.2=h5eee18b_0
  - llvm-openmp=14.0.6=h9e868ea_0
  - lz4-c=1.9.4=h6a678d5_1
  - markupsafe=2.1.3=py311h5eee18b_0
  - mkl=2023.1.0=h213fc3f_46344
  - mkl-service=2.4.0=py311h5eee18b_1
  - mkl_fft=1.3.10=py311h5eee18b_0
  - mkl_random=1.2.7=py311ha02d727_0
  - mpc=1.1.0=h10f8cd9_1
  - mpfr=4.0.2=hb69a4c5_1
  - mpmath=1.3.0=py311h06a4308_0
  - ncurses=6.4=h6a678d5_0
  - nettle=3.7.3=hbbd107a_1
  - networkx=3.2.1=py311h06a4308_0
  - numpy=2.0.1=py311h08b1b3b_1
  - numpy-base=2.0.1=py311hf175353_1
  - openh264=2.1.1=h4ff587b_0
  - openjpeg=2.5.2=he7f1fd0_0
  - openssl=3.0.15=h5eee18b_0
  - pillow=10.4.0=py311h5eee18b_0
  - pip=24.2=py311h06a4308_0
  - pysocks=1.7.1=py311h06a4308_0
  - python=3.11.9=h955ad1f_0
  - pytorch=2.4.1=py3.11_cuda12.1_cudnn9.1.0_0
  - pytorch-cuda=12.1=ha16c6d3_5
  - pytorch-mutex=1.0=cuda
  - pyyaml=6.0.1=py311h5eee18b_0
  - readline=8.2=h5eee18b_0
  - requests=2.32.3=py311h06a4308_0
  - setuptools=75.1.0=py311h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - sympy=1.13.2=py311h06a4308_0
  - tbb=2021.8.0=hdb19cb5_0
  - tk=8.6.14=h39e8969_0
  - torchtriton=3.0.0=py311
  - torchvision=0.19.1=py311_cu121
  - typing_extensions=4.11.0=py311h06a4308_0
  - urllib3=2.2.2=py311h06a4308_0
  - wheel=0.44.0=py311h06a4308_0
  - xz=5.4.6=h5eee18b_1
  - yaml=0.2.5=h7b6447c_0
  - zlib=1.2.13=h5eee18b_1
  - zstd=1.5.5=hc292b87_2
  - pip:
      - accelerate==0.34.2
      - contourpy==1.3.0
      - cycler==0.12.1
      - fonttools==4.54.1
      - fsspec==2024.9.0
      - huggingface-hub==0.25.1
      - imageio==2.36.0
      - importlib-metadata==8.5.0
      - joblib==1.4.2
      - kiwisolver==1.4.7
      - lazy-loader==0.4
      - lpips==0.1.4
      - matplotlib==3.9.2
      - opencv-python==4.10.0.84
      - packaging==24.1
      - pandas==2.2.3
      - protobuf==5.28.2
      - psutil==6.0.0
      - pyparsing==3.1.4
      - python-dateutil==2.9.0.post0
      - pytz==2024.2
      - regex==2024.9.11
      - safetensors==0.4.5
      - scikit-image==0.24.0
      - scikit-learn==1.5.2
      - scipy==1.14.1
      - sentencepiece==0.2.0
      - six==1.16.0
      - threadpoolctl==3.5.0
      - tifffile==2024.9.20
      - tokenizers==0.20.0
      - tqdm==4.66.5
      - transformers==4.45.1
      - tzdata==2024.2
      - zipp==3.20.2
      - -e .


================================================
FILE: run_stable_flow.py
================================================
import argparse
import os

import torch
from diffusers import FluxPipeline
import numpy as np
from PIL import Image

class StableFlow:
    MULTIMODAL_VITAL_LAYERS = [0, 1, 17, 18]
    SINGLE_MODAL_VITAL_LAYERS = list(np.array([28, 53, 54, 56, 25]) - 19) 

    def __init__(self):
        self._parse_args()
        self._load_pipeline()

    def _parse_args(self):
        parser = argparse.ArgumentParser()
        
        parser.add_argument("--model_path", type=str, default="black-forest-labs/FLUX.1-dev")
        parser.add_argument("--hf_token", type=str, required=True)
        parser.add_argument("--prompts", type=str, nargs="+", required=True)
        parser.add_argument("--output_path", type=str, default="outputs/result.jpg")
        parser.add_argument("--input_img_path", type=str, default=None)
        parser.add_argument("--seed", type=int, default=42)
        parser.add_argument("--cpu_offload", action="store_true")
        parser.add_argument("--device", type=str, default="cuda")

        self.args = parser.parse_args()
        os.makedirs(os.path.dirname(self.args.output_path), exist_ok=True)

    def _load_pipeline(self):
        self.pipe = FluxPipeline.from_pretrained(
            self.args.model_path, 
            torch_dtype=torch.float16,
            visualize_attention=False,
            token=self.args.hf_token
        )

        if self.args.cpu_offload:
            self.pipe.enable_sequential_cpu_offload()
        else:
            self.pipe.to(self.args.device)

    @torch.no_grad()
    def infer_and_save(self, prompts):
        latents = torch.randn(
            (4096, 64), 
            generator=torch.Generator(0).manual_seed(self.args.seed), 
            device=self.args.device, 
            dtype=torch.float16
        ).tile(len(prompts), 1, 1)
        images = self.pipe(
            prompts,
            height=1024,
            width=1024,
            guidance_scale=3.5,
            output_type="pil",
            num_inference_steps=15,
            max_sequence_length=512,
            latents=latents,
            mm_copy_blocks=StableFlow.MULTIMODAL_VITAL_LAYERS,
            single_copy_blocks=StableFlow.SINGLE_MODAL_VITAL_LAYERS,
        ).images
        images = [np.array(img) for img in images]
        res = Image.fromarray(np.hstack((images)))
        res.save(self.args.output_path)

    @torch.no_grad()
    def image2latent(self, image, latent_nudging_scalar = 1.15):
        image = self.pipe.image_processor.preprocess(image).type(self.pipe.vae.dtype).to("cuda")
        latents = self.pipe.vae.encode(image)["latent_dist"].mean
        latents = (latents - self.pipe.vae.config.shift_factor) * self.pipe.vae.config.scaling_factor
        latents = latents * latent_nudging_scalar
        latents = self.pipe._pack_latents(
            latents=latents,
            batch_size=1,
            num_channels_latents=16,
            height=128,
            width=128
        )

        return latents


    @torch.no_grad()
    def invert_and_save(self, prompts):
        inversion_prompt = prompts[0:1]
        # Invert
        inverted_latent_list = self.pipe(
            inversion_prompt,
            height=1024,
            width=1024,
            guidance_scale=1,
            output_type="pil",
            num_inference_steps=50,
            max_sequence_length=512,
            latents=self.image2latent(Image.open(self.args.input_img_path)),
            invert_image=True
        )

        # Edit
        images = self.pipe(
            prompts,
            height=1024,
            width=1024,
            guidance_scale=[1] + [3] * (len(prompts) - 1),
            output_type="pil",
            num_inference_steps=50,
            max_sequence_length=512,
            latents=inverted_latent_list[-1].tile(len(prompts), 1, 1),
            inverted_latent_list=inverted_latent_list,
            mm_copy_blocks=StableFlow.MULTIMODAL_VITAL_LAYERS,
            single_copy_blocks=StableFlow.SINGLE_MODAL_VITAL_LAYERS,
        ).images
        images = [np.array(img) for img in images]
        res = Image.fromarray(np.hstack((images)))
        res.save(self.args.output_path)

if __name__ == "__main__":
    stable_flow = StableFlow()
    if stable_flow.args.input_img_path is None:
        stable_flow.infer_and_save(prompts=stable_flow.args.prompts)
    else:
        stable_flow.invert_and_save(prompts=stable_flow.args.prompts)


================================================
FILE: setup.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/main/setup.py

To create the package for PyPI.

1. Run `make pre-release` (or `make pre-patch` for a patch release) then run `make fix-copies` to fix the index of the
   documentation.

   If releasing on a special branch, copy the updated README.md on the main branch for the commit you will make
   for the post-release and run `make fix-copies` on the main branch as well.

2. Unpin specific versions from setup.py that use a git install.

3. Checkout the release branch (v<RELEASE>-release, for example v4.19-release), and commit these changes with the
   message: "Release: <RELEASE>" and push.

4. Manually trigger the "Nightly and release tests on main/release branch" workflow from the release branch. Wait for
   the tests to complete. We can safely ignore the known test failures.

5. Wait for the tests on main to be completed and be green (otherwise revert and fix bugs).

6. Add a tag in git to mark the release: "git tag v<RELEASE> -m 'Adds tag v<RELEASE> for PyPI'"
   Push the tag to git: git push --tags origin v<RELEASE>-release

7. Build both the sources and the wheel. Do not change anything in setup.py between
   creating the wheel and the source distribution (obviously).

   For the wheel, run: "python setup.py bdist_wheel" in the top level directory
   (This will build a wheel for the Python version you use to build it).

   For the sources, run: "python setup.py sdist"
   You should now have a /dist directory with both .whl and .tar.gz source versions.

   Long story cut short, you need to run both before you can upload the distribution to the
   test PyPI and the actual PyPI servers:

   python setup.py bdist_wheel && python setup.py sdist

8. Check that everything looks correct by uploading the package to the PyPI test server:

   twine upload dist/* -r pypitest
   (pypi suggests using twine as other methods upload files via plaintext.)
   You may have to specify the repository url, use the following command then:
   twine upload dist/* -r pypitest --repository-url=https://test.pypi.org/legacy/

   Check that you can install it in a virtualenv by running:
   pip install -i https://testpypi.python.org/pypi diffusers

   If you are testing from a Colab Notebook, for instance, then do:
   pip install diffusers && pip uninstall diffusers
   pip install -i https://testpypi.python.org/pypi diffusers

   Check you can run the following commands:
   python -c "from diffusers import __version__; print(__version__)"
   python -c "from diffusers import DiffusionPipeline; pipe = DiffusionPipeline.from_pretrained('fusing/unet-ldm-dummy-update'); pipe()"
   python -c "from diffusers import DiffusionPipeline; pipe = DiffusionPipeline.from_pretrained('hf-internal-testing/tiny-stable-diffusion-pipe', safety_checker=None); pipe('ah suh du')"
   python -c "from diffusers import *"

9. Upload the final version to the actual PyPI:
   twine upload dist/* -r pypi

10. Prepare the release notes and publish them on GitHub once everything is looking hunky-dory. You can use the following
    Space to fetch all the commits applicable for the release: https://huggingface.co/spaces/lysandre/github-release. Repo should
    be `huggingface/diffusers`. `tag` should be the previous release tag (v0.26.1, for example), and `branch` should be
    the latest release branch (v0.27.0-release, for example). It denotes all commits that have happened on branch
    v0.27.0-release after the tag v0.26.1 was created.

11. Run `make post-release` (or, for a patch release, `make post-patch`). If you were on a branch for the release,
    you need to go back to main before executing this.
"""

import os
import re
import sys

from setuptools import Command, find_packages, setup


# IMPORTANT:
# 1. all dependencies should be listed here with their version requirements if any
# 2. once modified, run: `make deps_table_update` to update src/diffusers/dependency_versions_table.py
_deps = [
    "Pillow",  # keep the PIL.Image.Resampling deprecation away
    "accelerate>=0.31.0",
    "compel==0.1.8",
    "datasets",
    "filelock",
    "flax>=0.4.1",
    "hf-doc-builder>=0.3.0",
    "huggingface-hub>=0.23.2",
    "requests-mock==1.10.0",
    "importlib_metadata",
    "invisible-watermark>=0.2.0",
    "isort>=5.5.4",
    "jax>=0.4.1",
    "jaxlib>=0.4.1",
    "Jinja2",
    "k-diffusion>=0.0.12",
    "torchsde",
    "note_seq",
    "librosa",
    "numpy",
    "parameterized",
    "peft>=0.6.0",
    "protobuf>=3.20.3,<4",
    "pytest",
    "pytest-timeout",
    "pytest-xdist",
    "python>=3.8.0",
    "ruff==0.1.5",
    "safetensors>=0.3.1",
    "sentencepiece>=0.1.91,!=0.1.92",
    "GitPython<3.1.19",
    "scipy",
    "onnx",
    "regex!=2019.12.17",
    "requests",
    "tensorboard",
    "torch>=1.4",
    "torchvision",
    "transformers>=4.41.2",
    "urllib3<=2.0.0",
    "black",
]

# this is a lookup table with items like:
#
# tokenizers: "huggingface-hub==0.8.0"
# packaging: "packaging"
#
# some of the values are versioned whereas others aren't.
deps = {b: a for a, b in (re.findall(r"^(([^!=<>~]+)(?:[!=<>~].*)?$)", x)[0] for x in _deps)}

# since we save this data in src/diffusers/dependency_versions_table.py it can be easily accessed from
# anywhere. If you need to quickly access the data from this table in a shell, you can do so easily with:
#
# python -c 'import sys; from diffusers.dependency_versions_table import deps; \
# print(" ".join([deps[x] for x in sys.argv[1:]]))' tokenizers datasets
#
# Just pass the desired package names to that script as it's shown with 2 packages above.
#
# If diffusers is not yet installed and the work is done from the cloned repo remember to add `PYTHONPATH=src` to the script above
#
# You can then feed this for example to `pip`:
#
# pip install -U $(python -c 'import sys; from diffusers.dependency_versions_table import deps; \
# print(" ".join([deps[x] for x in sys.argv[1:]]))' tokenizers datasets)
#


def deps_list(*pkgs):
    return [deps[pkg] for pkg in pkgs]


class DepsTableUpdateCommand(Command):
    """
    A custom command that updates the dependency table.
    usage: python setup.py deps_table_update
    """

    description = "build runtime dependency table"
    user_options = [
        # format: (long option, short option, description).
        (
            "dep-table-update",
            None,
            "updates src/diffusers/dependency_versions_table.py",
        ),
    ]

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        entries = "\n".join([f'    "{k}": "{v}",' for k, v in deps.items()])
        content = [
            "# THIS FILE HAS BEEN AUTOGENERATED. To update:",
            "# 1. modify the `_deps` dict in setup.py",
            "# 2. run `make deps_table_update`",
            "deps = {",
            entries,
            "}",
            "",
        ]
        target = "src/diffusers/dependency_versions_table.py"
        print(f"updating {target}")
        with open(target, "w", encoding="utf-8", newline="\n") as f:
            f.write("\n".join(content))


extras = {}
extras["quality"] = deps_list("urllib3", "isort", "ruff", "hf-doc-builder")
extras["docs"] = deps_list("hf-doc-builder")
extras["training"] = deps_list("accelerate", "datasets", "protobuf", "tensorboard", "Jinja2", "peft")
extras["test"] = deps_list(
    "compel",
    "GitPython",
    "datasets",
    "Jinja2",
    "invisible-watermark",
    "k-diffusion",
    "librosa",
    "parameterized",
    "pytest",
    "pytest-timeout",
    "pytest-xdist",
    "requests-mock",
    "safetensors",
    "sentencepiece",
    "scipy",
    "torchvision",
    "transformers",
)
extras["torch"] = deps_list("torch", "accelerate")

if os.name == "nt":  # windows
    extras["flax"] = []  # jax is not supported on windows
else:
    extras["flax"] = deps_list("jax", "jaxlib", "flax")

extras["dev"] = (
    extras["quality"] + extras["test"] + extras["training"] + extras["docs"] + extras["torch"] + extras["flax"]
)

install_requires = [
    deps["importlib_metadata"],
    deps["filelock"],
    deps["huggingface-hub"],
    deps["numpy"],
    deps["regex"],
    deps["requests"],
    deps["safetensors"],
    deps["Pillow"],
]

version_range_max = max(sys.version_info[1], 10) + 1

setup(
    name="diffusers",
    version="0.30.0",  # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots)
    description="State-of-the-art diffusion in PyTorch and JAX.",
    long_description=open("README.md", "r", encoding="utf-8").read(),
    long_description_content_type="text/markdown",
    keywords="deep learning diffusion jax pytorch stable diffusion audioldm",
    license="Apache 2.0 License",
    author="The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/diffusers/graphs/contributors)",
    author_email="diffusers@huggingface.co",
    url="https://github.com/huggingface/diffusers",
    package_dir={"": "src"},
    packages=find_packages("src"),
    package_data={"diffusers": ["py.typed"]},
    include_package_data=True,
    python_requires=">=3.8.0",
    install_requires=list(install_requires),
    extras_require=extras,
    entry_points={"console_scripts": ["diffusers-cli=diffusers.commands.diffusers_cli:main"]},
    classifiers=[
        "Development Status :: 5 - Production/Stable",
        "Intended Audience :: Developers",
        "Intended Audience :: Education",
        "Intended Audience :: Science/Research",
        "License :: OSI Approved :: Apache Software License",
        "Operating System :: OS Independent",
        "Topic :: Scientific/Engineering :: Artificial Intelligence",
        "Programming Language :: Python :: 3",
    ]
    + [f"Programming Language :: Python :: 3.{i}" for i in range(8, version_range_max)],
    cmdclass={"deps_table_update": DepsTableUpdateCommand},
)


================================================
FILE: src/diffusers/__init__.py
================================================
__version__ = "0.30.0"

from typing import TYPE_CHECKING

from .utils import (
    DIFFUSERS_SLOW_IMPORT,
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_k_diffusion_available,
    is_librosa_available,
    is_note_seq_available,
    is_onnx_available,
    is_scipy_available,
    is_sentencepiece_available,
    is_torch_available,
    is_torchsde_available,
    is_transformers_available,
)


# Lazy Import based on
# https://github.com/huggingface/transformers/blob/main/src/transformers/__init__.py

# When adding a new object to this init, please add it to `_import_structure`. The `_import_structure` is a dictionary submodule to list of object names,
# and is used to defer the actual importing for when the objects are requested.
# This way `import diffusers` provides the names in the namespace without actually importing anything (and especially none of the backends).

_import_structure = {
    "configuration_utils": ["ConfigMixin"],
    "loaders": ["FromOriginalModelMixin"],
    "models": [],
    "pipelines": [],
    "schedulers": [],
    "utils": [
        "OptionalDependencyNotAvailable",
        "is_flax_available",
        "is_inflect_available",
        "is_invisible_watermark_available",
        "is_k_diffusion_available",
        "is_k_diffusion_version",
        "is_librosa_available",
        "is_note_seq_available",
        "is_onnx_available",
        "is_scipy_available",
        "is_torch_available",
        "is_torchsde_available",
        "is_transformers_available",
        "is_transformers_version",
        "is_unidecode_available",
        "logging",
    ],
}

try:
    if not is_onnx_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_onnx_objects  # noqa F403

    _import_structure["utils.dummy_onnx_objects"] = [
        name for name in dir(dummy_onnx_objects) if not name.startswith("_")
    ]

else:
    _import_structure["pipelines"].extend(["OnnxRuntimeModel"])

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_pt_objects  # noqa F403

    _import_structure["utils.dummy_pt_objects"] = [name for name in dir(dummy_pt_objects) if not name.startswith("_")]

else:
    _import_structure["models"].extend(
        [
            "AsymmetricAutoencoderKL",
            "AuraFlowTransformer2DModel",
            "AutoencoderKL",
            "AutoencoderKLCogVideoX",
            "AutoencoderKLTemporalDecoder",
            "AutoencoderOobleck",
            "AutoencoderTiny",
            "CogVideoXTransformer3DModel",
            "ConsistencyDecoderVAE",
            "ControlNetModel",
            "ControlNetXSAdapter",
            "DiTTransformer2DModel",
            "FluxTransformer2DModel",
            "HunyuanDiT2DControlNetModel",
            "HunyuanDiT2DModel",
            "HunyuanDiT2DMultiControlNetModel",
            "I2VGenXLUNet",
            "Kandinsky3UNet",
            "LatteTransformer3DModel",
            "LuminaNextDiT2DModel",
            "ModelMixin",
            "MotionAdapter",
            "MultiAdapter",
            "PixArtTransformer2DModel",
            "PriorTransformer",
            "SD3ControlNetModel",
            "SD3MultiControlNetModel",
            "SD3Transformer2DModel",
            "SparseControlNetModel",
            "StableAudioDiTModel",
            "StableCascadeUNet",
            "T2IAdapter",
            "T5FilmDecoder",
            "Transformer2DModel",
            "UNet1DModel",
            "UNet2DConditionModel",
            "UNet2DModel",
            "UNet3DConditionModel",
            "UNetControlNetXSModel",
            "UNetMotionModel",
            "UNetSpatioTemporalConditionModel",
            "UVit2DModel",
            "VQModel",
        ]
    )

    _import_structure["optimization"] = [
        "get_constant_schedule",
        "get_constant_schedule_with_warmup",
        "get_cosine_schedule_with_warmup",
        "get_cosine_with_hard_restarts_schedule_with_warmup",
        "get_linear_schedule_with_warmup",
        "get_polynomial_decay_schedule_with_warmup",
        "get_scheduler",
    ]
    _import_structure["pipelines"].extend(
        [
            "AudioPipelineOutput",
            "AutoPipelineForImage2Image",
            "AutoPipelineForInpainting",
            "AutoPipelineForText2Image",
            "ConsistencyModelPipeline",
            "DanceDiffusionPipeline",
            "DDIMPipeline",
            "DDPMPipeline",
            "DiffusionPipeline",
            "DiTPipeline",
            "ImagePipelineOutput",
            "KarrasVePipeline",
            "LDMPipeline",
            "LDMSuperResolutionPipeline",
            "PNDMPipeline",
            "RePaintPipeline",
            "ScoreSdeVePipeline",
            "StableDiffusionMixin",
        ]
    )
    _import_structure["schedulers"].extend(
        [
            "AmusedScheduler",
            "CMStochasticIterativeScheduler",
            "CogVideoXDDIMScheduler",
            "CogVideoXDPMScheduler",
            "DDIMInverseScheduler",
            "DDIMParallelScheduler",
            "DDIMScheduler",
            "DDPMParallelScheduler",
            "DDPMScheduler",
            "DDPMWuerstchenScheduler",
            "DEISMultistepScheduler",
            "DPMSolverMultistepInverseScheduler",
            "DPMSolverMultistepScheduler",
            "DPMSolverSinglestepScheduler",
            "EDMDPMSolverMultistepScheduler",
            "EDMEulerScheduler",
            "EulerAncestralDiscreteScheduler",
            "EulerDiscreteScheduler",
            "FlowMatchEulerDiscreteScheduler",
            "FlowMatchHeunDiscreteScheduler",
            "HeunDiscreteScheduler",
            "IPNDMScheduler",
            "KarrasVeScheduler",
            "KDPM2AncestralDiscreteScheduler",
            "KDPM2DiscreteScheduler",
            "LCMScheduler",
            "PNDMScheduler",
            "RePaintScheduler",
            "SASolverScheduler",
            "SchedulerMixin",
            "ScoreSdeVeScheduler",
            "TCDScheduler",
            "UnCLIPScheduler",
            "UniPCMultistepScheduler",
            "VQDiffusionScheduler",
        ]
    )
    _import_structure["training_utils"] = ["EMAModel"]

try:
    if not (is_torch_available() and is_scipy_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_torch_and_scipy_objects  # noqa F403

    _import_structure["utils.dummy_torch_and_scipy_objects"] = [
        name for name in dir(dummy_torch_and_scipy_objects) if not name.startswith("_")
    ]

else:
    _import_structure["schedulers"].extend(["LMSDiscreteScheduler"])

try:
    if not (is_torch_available() and is_torchsde_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_torch_and_torchsde_objects  # noqa F403

    _import_structure["utils.dummy_torch_and_torchsde_objects"] = [
        name for name in dir(dummy_torch_and_torchsde_objects) if not name.startswith("_")
    ]

else:
    _import_structure["schedulers"].extend(["CosineDPMSolverMultistepScheduler", "DPMSolverSDEScheduler"])

try:
    if not (is_torch_available() and is_transformers_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_torch_and_transformers_objects  # noqa F403

    _import_structure["utils.dummy_torch_and_transformers_objects"] = [
        name for name in dir(dummy_torch_and_transformers_objects) if not name.startswith("_")
    ]

else:
    _import_structure["pipelines"].extend(
        [
            "AltDiffusionImg2ImgPipeline",
            "AltDiffusionPipeline",
            "AmusedImg2ImgPipeline",
            "AmusedInpaintPipeline",
            "AmusedPipeline",
            "AnimateDiffControlNetPipeline",
            "AnimateDiffPAGPipeline",
            "AnimateDiffPipeline",
            "AnimateDiffSDXLPipeline",
            "AnimateDiffSparseControlNetPipeline",
            "AnimateDiffVideoToVideoPipeline",
            "AudioLDM2Pipeline",
            "AudioLDM2ProjectionModel",
            "AudioLDM2UNet2DConditionModel",
            "AudioLDMPipeline",
            "AuraFlowPipeline",
            "BlipDiffusionControlNetPipeline",
            "BlipDiffusionPipeline",
            "CLIPImageProjection",
            "CogVideoXPipeline",
            "CycleDiffusionPipeline",
            "FluxPipeline",
            "HunyuanDiTControlNetPipeline",
            "HunyuanDiTPAGPipeline",
            "HunyuanDiTPipeline",
            "I2VGenXLPipeline",
            "IFImg2ImgPipeline",
            "IFImg2ImgSuperResolutionPipeline",
            "IFInpaintingPipeline",
            "IFInpaintingSuperResolutionPipeline",
            "IFPipeline",
            "IFSuperResolutionPipeline",
            "ImageTextPipelineOutput",
            "Kandinsky3Img2ImgPipeline",
            "Kandinsky3Pipeline",
            "KandinskyCombinedPipeline",
            "KandinskyImg2ImgCombinedPipeline",
            "KandinskyImg2ImgPipeline",
            "KandinskyInpaintCombinedPipeline",
            "KandinskyInpaintPipeline",
            "KandinskyPipeline",
            "KandinskyPriorPipeline",
            "KandinskyV22CombinedPipeline",
            "KandinskyV22ControlnetImg2ImgPipeline",
            "KandinskyV22ControlnetPipeline",
            "KandinskyV22Img2ImgCombinedPipeline",
            "KandinskyV22Img2ImgPipeline",
            "KandinskyV22InpaintCombinedPipeline",
            "KandinskyV22InpaintPipeline",
            "KandinskyV22Pipeline",
            "KandinskyV22PriorEmb2EmbPipeline",
            "KandinskyV22PriorPipeline",
            "LatentConsistencyModelImg2ImgPipeline",
            "LatentConsistencyModelPipeline",
            "LattePipeline",
            "LDMTextToImagePipeline",
            "LEditsPPPipelineStableDiffusion",
            "LEditsPPPipelineStableDiffusionXL",
            "LuminaText2ImgPipeline",
            "MarigoldDepthPipeline",
            "MarigoldNormalsPipeline",
            "MusicLDMPipeline",
            "PaintByExamplePipeline",
            "PIAPipeline",
            "PixArtAlphaPipeline",
            "PixArtSigmaPAGPipeline",
            "PixArtSigmaPipeline",
            "SemanticStableDiffusionPipeline",
            "ShapEImg2ImgPipeline",
            "ShapEPipeline",
            "StableAudioPipeline",
            "StableAudioProjectionModel",
            "StableCascadeCombinedPipeline",
            "StableCascadeDecoderPipeline",
            "StableCascadePriorPipeline",
            "StableDiffusion3ControlNetPipeline",
            "StableDiffusion3Img2ImgPipeline",
            "StableDiffusion3InpaintPipeline",
            "StableDiffusion3PAGPipeline",
            "StableDiffusion3Pipeline",
            "StableDiffusionAdapterPipeline",
            "StableDiffusionAttendAndExcitePipeline",
            "StableDiffusionControlNetImg2ImgPipeline",
            "StableDiffusionControlNetInpaintPipeline",
            "StableDiffusionControlNetPAGPipeline",
            "StableDiffusionControlNetPipeline",
            "StableDiffusionControlNetXSPipeline",
            "StableDiffusionDepth2ImgPipeline",
            "StableDiffusionDiffEditPipeline",
            "StableDiffusionGLIGENPipeline",
            "StableDiffusionGLIGENTextImagePipeline",
            "StableDiffusionImageVariationPipeline",
            "StableDiffusionImg2ImgPipeline",
            "StableDiffusionInpaintPipeline",
            "StableDiffusionInpaintPipelineLegacy",
            "StableDiffusionInstructPix2PixPipeline",
            "StableDiffusionLatentUpscalePipeline",
            "StableDiffusionLDM3DPipeline",
            "StableDiffusionModelEditingPipeline",
            "StableDiffusionPAGPipeline",
            "StableDiffusionPanoramaPipeline",
            "StableDiffusionParadigmsPipeline",
            "StableDiffusionPipeline",
            "StableDiffusionPipelineSafe",
            "StableDiffusionPix2PixZeroPipeline",
            "StableDiffusionSAGPipeline",
            "StableDiffusionUpscalePipeline",
            "StableDiffusionXLAdapterPipeline",
            "StableDiffusionXLControlNetImg2ImgPipeline",
            "StableDiffusionXLControlNetInpaintPipeline",
            "StableDiffusionXLControlNetPAGPipeline",
            "StableDiffusionXLControlNetPipeline",
            "StableDiffusionXLControlNetXSPipeline",
            "StableDiffusionXLImg2ImgPipeline",
            "StableDiffusionXLInpaintPipeline",
            "StableDiffusionXLInstructPix2PixPipeline",
            "StableDiffusionXLPAGImg2ImgPipeline",
            "StableDiffusionXLPAGInpaintPipeline",
            "StableDiffusionXLPAGPipeline",
            "StableDiffusionXLPipeline",
            "StableUnCLIPImg2ImgPipeline",
            "StableUnCLIPPipeline",
            "StableVideoDiffusionPipeline",
            "TextToVideoSDPipeline",
            "TextToVideoZeroPipeline",
            "TextToVideoZeroSDXLPipeline",
            "UnCLIPImageVariationPipeline",
            "UnCLIPPipeline",
            "UniDiffuserModel",
            "UniDiffuserPipeline",
            "UniDiffuserTextDecoder",
            "VersatileDiffusionDualGuidedPipeline",
            "VersatileDiffusionImageVariationPipeline",
            "VersatileDiffusionPipeline",
            "VersatileDiffusionTextToImagePipeline",
            "VideoToVideoSDPipeline",
            "VQDiffusionPipeline",
            "WuerstchenCombinedPipeline",
            "WuerstchenDecoderPipeline",
            "WuerstchenPriorPipeline",
        ]
    )

try:
    if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_torch_and_transformers_and_k_diffusion_objects  # noqa F403

    _import_structure["utils.dummy_torch_and_transformers_and_k_diffusion_objects"] = [
        name for name in dir(dummy_torch_and_transformers_and_k_diffusion_objects) if not name.startswith("_")
    ]

else:
    _import_structure["pipelines"].extend(["StableDiffusionKDiffusionPipeline", "StableDiffusionXLKDiffusionPipeline"])

try:
    if not (is_torch_available() and is_transformers_available() and is_sentencepiece_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_torch_and_transformers_and_sentencepiece_objects  # noqa F403

    _import_structure["utils.dummy_torch_and_transformers_and_sentencepiece_objects"] = [
        name for name in dir(dummy_torch_and_transformers_and_sentencepiece_objects) if not name.startswith("_")
    ]

else:
    _import_structure["pipelines"].extend(["KolorsImg2ImgPipeline", "KolorsPAGPipeline", "KolorsPipeline"])

try:
    if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_torch_and_transformers_and_onnx_objects  # noqa F403

    _import_structure["utils.dummy_torch_and_transformers_and_onnx_objects"] = [
        name for name in dir(dummy_torch_and_transformers_and_onnx_objects) if not name.startswith("_")
    ]

else:
    _import_structure["pipelines"].extend(
        [
            "OnnxStableDiffusionImg2ImgPipeline",
            "OnnxStableDiffusionInpaintPipeline",
            "OnnxStableDiffusionInpaintPipelineLegacy",
            "OnnxStableDiffusionPipeline",
            "OnnxStableDiffusionUpscalePipeline",
            "StableDiffusionOnnxPipeline",
        ]
    )

try:
    if not (is_torch_available() and is_librosa_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_torch_and_librosa_objects  # noqa F403

    _import_structure["utils.dummy_torch_and_librosa_objects"] = [
        name for name in dir(dummy_torch_and_librosa_objects) if not name.startswith("_")
    ]

else:
    _import_structure["pipelines"].extend(["AudioDiffusionPipeline", "Mel"])

try:
    if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_transformers_and_torch_and_note_seq_objects  # noqa F403

    _import_structure["utils.dummy_transformers_and_torch_and_note_seq_objects"] = [
        name for name in dir(dummy_transformers_and_torch_and_note_seq_objects) if not name.startswith("_")
    ]


else:
    _import_structure["pipelines"].extend(["SpectrogramDiffusionPipeline"])

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_flax_objects  # noqa F403

    _import_structure["utils.dummy_flax_objects"] = [
        name for name in dir(dummy_flax_objects) if not name.startswith("_")
    ]


else:
    _import_structure["models.controlnet_flax"] = ["FlaxControlNetModel"]
    _import_structure["models.modeling_flax_utils"] = ["FlaxModelMixin"]
    _import_structure["models.unets.unet_2d_condition_flax"] = ["FlaxUNet2DConditionModel"]
    _import_structure["models.vae_flax"] = ["FlaxAutoencoderKL"]
    _import_structure["pipelines"].extend(["FlaxDiffusionPipeline"])
    _import_structure["schedulers"].extend(
        [
            "FlaxDDIMScheduler",
            "FlaxDDPMScheduler",
            "FlaxDPMSolverMultistepScheduler",
            "FlaxEulerDiscreteScheduler",
            "FlaxKarrasVeScheduler",
            "FlaxLMSDiscreteScheduler",
            "FlaxPNDMScheduler",
            "FlaxSchedulerMixin",
            "FlaxScoreSdeVeScheduler",
        ]
    )


try:
    if not (is_flax_available() and is_transformers_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_flax_and_transformers_objects  # noqa F403

    _import_structure["utils.dummy_flax_and_transformers_objects"] = [
        name for name in dir(dummy_flax_and_transformers_objects) if not name.startswith("_")
    ]


else:
    _import_structure["pipelines"].extend(
        [
            "FlaxStableDiffusionControlNetPipeline",
            "FlaxStableDiffusionImg2ImgPipeline",
            "FlaxStableDiffusionInpaintPipeline",
            "FlaxStableDiffusionPipeline",
            "FlaxStableDiffusionXLPipeline",
        ]
    )

try:
    if not (is_note_seq_available()):
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    from .utils import dummy_note_seq_objects  # noqa F403

    _import_structure["utils.dummy_note_seq_objects"] = [
        name for name in dir(dummy_note_seq_objects) if not name.startswith("_")
    ]


else:
    _import_structure["pipelines"].extend(["MidiProcessor"])

if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
    from .configuration_utils import ConfigMixin

    try:
        if not is_onnx_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_onnx_objects import *  # noqa F403
    else:
        from .pipelines import OnnxRuntimeModel

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_pt_objects import *  # noqa F403
    else:
        from .models import (
            AsymmetricAutoencoderKL,
            AuraFlowTransformer2DModel,
            AutoencoderKL,
            AutoencoderKLCogVideoX,
            AutoencoderKLTemporalDecoder,
            AutoencoderOobleck,
            AutoencoderTiny,
            CogVideoXTransformer3DModel,
            ConsistencyDecoderVAE,
            ControlNetModel,
            ControlNetXSAdapter,
            DiTTransformer2DModel,
            FluxTransformer2DModel,
            HunyuanDiT2DControlNetModel,
            HunyuanDiT2DModel,
            HunyuanDiT2DMultiControlNetModel,
            I2VGenXLUNet,
            Kandinsky3UNet,
            LatteTransformer3DModel,
            LuminaNextDiT2DModel,
            ModelMixin,
            MotionAdapter,
            MultiAdapter,
            PixArtTransformer2DModel,
            PriorTransformer,
            SD3ControlNetModel,
            SD3MultiControlNetModel,
            SD3Transformer2DModel,
            SparseControlNetModel,
            StableAudioDiTModel,
            T2IAdapter,
            T5FilmDecoder,
            Transformer2DModel,
            UNet1DModel,
            UNet2DConditionModel,
            UNet2DModel,
            UNet3DConditionModel,
            UNetControlNetXSModel,
            UNetMotionModel,
            UNetSpatioTemporalConditionModel,
            UVit2DModel,
            VQModel,
        )
        from .optimization import (
            get_constant_schedule,
            get_constant_schedule_with_warmup,
            get_cosine_schedule_with_warmup,
            get_cosine_with_hard_restarts_schedule_with_warmup,
            get_linear_schedule_with_warmup,
            get_polynomial_decay_schedule_with_warmup,
            get_scheduler,
        )
        from .pipelines import (
            AudioPipelineOutput,
            AutoPipelineForImage2Image,
            AutoPipelineForInpainting,
            AutoPipelineForText2Image,
            BlipDiffusionControlNetPipeline,
            BlipDiffusionPipeline,
            CLIPImageProjection,
            ConsistencyModelPipeline,
            DanceDiffusionPipeline,
            DDIMPipeline,
            DDPMPipeline,
            DiffusionPipeline,
            DiTPipeline,
            ImagePipelineOutput,
            KarrasVePipeline,
            LDMPipeline,
            LDMSuperResolutionPipeline,
            PNDMPipeline,
            RePaintPipeline,
            ScoreSdeVePipeline,
            StableDiffusionMixin,
        )
        from .schedulers import (
            AmusedScheduler,
            CMStochasticIterativeScheduler,
            CogVideoXDDIMScheduler,
            CogVideoXDPMScheduler,
            DDIMInverseScheduler,
            DDIMParallelScheduler,
            DDIMScheduler,
            DDPMParallelScheduler,
            DDPMScheduler,
            DDPMWuerstchenScheduler,
            DEISMultistepScheduler,
            DPMSolverMultistepInverseScheduler,
            DPMSolverMultistepScheduler,
            DPMSolverSinglestepScheduler,
            EDMDPMSolverMultistepScheduler,
            EDMEulerScheduler,
            EulerAncestralDiscreteScheduler,
            EulerDiscreteScheduler,
            FlowMatchEulerDiscreteScheduler,
            FlowMatchHeunDiscreteScheduler,
            HeunDiscreteScheduler,
            IPNDMScheduler,
            KarrasVeScheduler,
            KDPM2AncestralDiscreteScheduler,
            KDPM2DiscreteScheduler,
            LCMScheduler,
            PNDMScheduler,
            RePaintScheduler,
            SASolverScheduler,
            SchedulerMixin,
            ScoreSdeVeScheduler,
            TCDScheduler,
            UnCLIPScheduler,
            UniPCMultistepScheduler,
            VQDiffusionScheduler,
        )
        from .training_utils import EMAModel

    try:
        if not (is_torch_available() and is_scipy_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_torch_and_scipy_objects import *  # noqa F403
    else:
        from .schedulers import LMSDiscreteScheduler

    try:
        if not (is_torch_available() and is_torchsde_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_torch_and_torchsde_objects import *  # noqa F403
    else:
        from .schedulers import CosineDPMSolverMultistepScheduler, DPMSolverSDEScheduler

    try:
        if not (is_torch_available() and is_transformers_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_torch_and_transformers_objects import *  # noqa F403
    else:
        from .pipelines import (
            AltDiffusionImg2ImgPipeline,
            AltDiffusionPipeline,
            AmusedImg2ImgPipeline,
            AmusedInpaintPipeline,
            AmusedPipeline,
            AnimateDiffControlNetPipeline,
            AnimateDiffPAGPipeline,
            AnimateDiffPipeline,
            AnimateDiffSDXLPipeline,
            AnimateDiffSparseControlNetPipeline,
            AnimateDiffVideoToVideoPipeline,
            AudioLDM2Pipeline,
            AudioLDM2ProjectionModel,
            AudioLDM2UNet2DConditionModel,
            AudioLDMPipeline,
            AuraFlowPipeline,
            CLIPImageProjection,
            CogVideoXPipeline,
            CycleDiffusionPipeline,
            FluxPipeline,
            HunyuanDiTControlNetPipeline,
            HunyuanDiTPAGPipeline,
            HunyuanDiTPipeline,
            I2VGenXLPipeline,
            IFImg2ImgPipeline,
            IFImg2ImgSuperResolutionPipeline,
            IFInpaintingPipeline,
            IFInpaintingSuperResolutionPipeline,
            IFPipeline,
            IFSuperResolutionPipeline,
            ImageTextPipelineOutput,
            Kandinsky3Img2ImgPipeline,
            Kandinsky3Pipeline,
            KandinskyCombinedPipeline,
            KandinskyImg2ImgCombinedPipeline,
            KandinskyImg2ImgPipeline,
            KandinskyInpaintCombinedPipeline,
            KandinskyInpaintPipeline,
            KandinskyPipeline,
            KandinskyPriorPipeline,
            KandinskyV22CombinedPipeline,
            KandinskyV22ControlnetImg2ImgPipeline,
            KandinskyV22ControlnetPipeline,
            KandinskyV22Img2ImgCombinedPipeline,
            KandinskyV22Img2ImgPipeline,
            KandinskyV22InpaintCombinedPipeline,
            KandinskyV22InpaintPipeline,
            KandinskyV22Pipeline,
            KandinskyV22PriorEmb2EmbPipeline,
            KandinskyV22PriorPipeline,
            LatentConsistencyModelImg2ImgPipeline,
            LatentConsistencyModelPipeline,
            LattePipeline,
            LDMTextToImagePipeline,
            LEditsPPPipelineStableDiffusion,
            LEditsPPPipelineStableDiffusionXL,
            LuminaText2ImgPipeline,
            MarigoldDepthPipeline,
            MarigoldNormalsPipeline,
            MusicLDMPipeline,
            PaintByExamplePipeline,
            PIAPipeline,
            PixArtAlphaPipeline,
            PixArtSigmaPAGPipeline,
            PixArtSigmaPipeline,
            SemanticStableDiffusionPipeline,
            ShapEImg2ImgPipeline,
            ShapEPipeline,
            StableAudioPipeline,
            StableAudioProjectionModel,
            StableCascadeCombinedPipeline,
            StableCascadeDecoderPipeline,
            StableCascadePriorPipeline,
            StableDiffusion3ControlNetPipeline,
            StableDiffusion3Img2ImgPipeline,
            StableDiffusion3InpaintPipeline,
            StableDiffusion3PAGPipeline,
            StableDiffusion3Pipeline,
            StableDiffusionAdapterPipeline,
            StableDiffusionAttendAndExcitePipeline,
            StableDiffusionControlNetImg2ImgPipeline,
            StableDiffusionControlNetInpaintPipeline,
            StableDiffusionControlNetPAGPipeline,
            StableDiffusionControlNetPipeline,
            StableDiffusionControlNetXSPipeline,
            StableDiffusionDepth2ImgPipeline,
            StableDiffusionDiffEditPipeline,
            StableDiffusionGLIGENPipeline,
            StableDiffusionGLIGENTextImagePipeline,
            StableDiffusionImageVariationPipeline,
            StableDiffusionImg2ImgPipeline,
            StableDiffusionInpaintPipeline,
            StableDiffusionInpaintPipelineLegacy,
            StableDiffusionInstructPix2PixPipeline,
            StableDiffusionLatentUpscalePipeline,
            StableDiffusionLDM3DPipeline,
            StableDiffusionModelEditingPipeline,
            StableDiffusionPAGPipeline,
            StableDiffusionPanoramaPipeline,
            StableDiffusionParadigmsPipeline,
            StableDiffusionPipeline,
            StableDiffusionPipelineSafe,
            StableDiffusionPix2PixZeroPipeline,
            StableDiffusionSAGPipeline,
            StableDiffusionUpscalePipeline,
            StableDiffusionXLAdapterPipeline,
            StableDiffusionXLControlNetImg2ImgPipeline,
            StableDiffusionXLControlNetInpaintPipeline,
            StableDiffusionXLControlNetPAGPipeline,
            StableDiffusionXLControlNetPipeline,
            StableDiffusionXLControlNetXSPipeline,
            StableDiffusionXLImg2ImgPipeline,
            StableDiffusionXLInpaintPipeline,
            StableDiffusionXLInstructPix2PixPipeline,
            StableDiffusionXLPAGImg2ImgPipeline,
            StableDiffusionXLPAGInpaintPipeline,
            StableDiffusionXLPAGPipeline,
            StableDiffusionXLPipeline,
            StableUnCLIPImg2ImgPipeline,
            StableUnCLIPPipeline,
            StableVideoDiffusionPipeline,
            TextToVideoSDPipeline,
            TextToVideoZeroPipeline,
            TextToVideoZeroSDXLPipeline,
            UnCLIPImageVariationPipeline,
            UnCLIPPipeline,
            UniDiffuserModel,
            UniDiffuserPipeline,
            UniDiffuserTextDecoder,
            VersatileDiffusionDualGuidedPipeline,
            VersatileDiffusionImageVariationPipeline,
            VersatileDiffusionPipeline,
            VersatileDiffusionTextToImagePipeline,
            VideoToVideoSDPipeline,
            VQDiffusionPipeline,
            WuerstchenCombinedPipeline,
            WuerstchenDecoderPipeline,
            WuerstchenPriorPipeline,
        )

    try:
        if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_torch_and_transformers_and_k_diffusion_objects import *  # noqa F403
    else:
        from .pipelines import StableDiffusionKDiffusionPipeline, StableDiffusionXLKDiffusionPipeline

    try:
        if not (is_torch_available() and is_transformers_available() and is_sentencepiece_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_torch_and_transformers_and_sentencepiece_objects import *  # noqa F403
    else:
        from .pipelines import KolorsImg2ImgPipeline, KolorsPAGPipeline, KolorsPipeline
    try:
        if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_torch_and_transformers_and_onnx_objects import *  # noqa F403
    else:
        from .pipelines import (
            OnnxStableDiffusionImg2ImgPipeline,
            OnnxStableDiffusionInpaintPipeline,
            OnnxStableDiffusionInpaintPipelineLegacy,
            OnnxStableDiffusionPipeline,
            OnnxStableDiffusionUpscalePipeline,
            StableDiffusionOnnxPipeline,
        )

    try:
        if not (is_torch_available() and is_librosa_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_torch_and_librosa_objects import *  # noqa F403
    else:
        from .pipelines import AudioDiffusionPipeline, Mel

    try:
        if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_transformers_and_torch_and_note_seq_objects import *  # noqa F403
    else:
        from .pipelines import SpectrogramDiffusionPipeline

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_flax_objects import *  # noqa F403
    else:
        from .models.controlnet_flax import FlaxControlNetModel
        from .models.modeling_flax_utils import FlaxModelMixin
        from .models.unets.unet_2d_condition_flax import FlaxUNet2DConditionModel
        from .models.vae_flax import FlaxAutoencoderKL
        from .pipelines import FlaxDiffusionPipeline
        from .schedulers import (
            FlaxDDIMScheduler,
            FlaxDDPMScheduler,
            FlaxDPMSolverMultistepScheduler,
            FlaxEulerDiscreteScheduler,
            FlaxKarrasVeScheduler,
            FlaxLMSDiscreteScheduler,
            FlaxPNDMScheduler,
            FlaxSchedulerMixin,
            FlaxScoreSdeVeScheduler,
        )

    try:
        if not (is_flax_available() and is_transformers_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_flax_and_transformers_objects import *  # noqa F403
    else:
        from .pipelines import (
            FlaxStableDiffusionControlNetPipeline,
            FlaxStableDiffusionImg2ImgPipeline,
            FlaxStableDiffusionInpaintPipeline,
            FlaxStableDiffusionPipeline,
            FlaxStableDiffusionXLPipeline,
        )

    try:
        if not (is_note_seq_available()):
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        from .utils.dummy_note_seq_objects import *  # noqa F403
    else:
        from .pipelines import MidiProcessor

else:
    import sys

    sys.modules[__name__] = _LazyModule(
        __name__,
        globals()["__file__"],
        _import_structure,
        module_spec=__spec__,
        extra_objects={"__version__": __version__},
    )


================================================
FILE: src/diffusers/callbacks.py
================================================
from typing import Any, Dict, List

from .configuration_utils import ConfigMixin, register_to_config
from .utils import CONFIG_NAME


class PipelineCallback(ConfigMixin):
    """
    Base class for all the official callbacks used in a pipeline. This class provides a structure for implementing
    custom callbacks and ensures that all callbacks have a consistent interface.

    Please implement the following:
        `tensor_inputs`: This should return a list of tensor inputs specific to your callback. You will only be able to
        include
            variables listed in the `._callback_tensor_inputs` attribute of your pipeline class.
        `callback_fn`: This method defines the core functionality of your callback.
    """

    config_name = CONFIG_NAME

    @register_to_config
    def __init__(self, cutoff_step_ratio=1.0, cutoff_step_index=None):
        super().__init__()

        if (cutoff_step_ratio is None and cutoff_step_index is None) or (
            cutoff_step_ratio is not None and cutoff_step_index is not None
        ):
            raise ValueError("Either cutoff_step_ratio or cutoff_step_index should be provided, not both or none.")

        if cutoff_step_ratio is not None and (
            not isinstance(cutoff_step_ratio, float) or not (0.0 <= cutoff_step_ratio <= 1.0)
        ):
            raise ValueError("cutoff_step_ratio must be a float between 0.0 and 1.0.")

    @property
    def tensor_inputs(self) -> List[str]:
        raise NotImplementedError(f"You need to set the attribute `tensor_inputs` for {self.__class__}")

    def callback_fn(self, pipeline, step_index, timesteps, callback_kwargs) -> Dict[str, Any]:
        raise NotImplementedError(f"You need to implement the method `callback_fn` for {self.__class__}")

    def __call__(self, pipeline, step_index, timestep, callback_kwargs) -> Dict[str, Any]:
        return self.callback_fn(pipeline, step_index, timestep, callback_kwargs)


class MultiPipelineCallbacks:
    """
    This class is designed to handle multiple pipeline callbacks. It accepts a list of PipelineCallback objects and
    provides a unified interface for calling all of them.
    """

    def __init__(self, callbacks: List[PipelineCallback]):
        self.callbacks = callbacks

    @property
    def tensor_inputs(self) -> List[str]:
        return [input for callback in self.callbacks for input in callback.tensor_inputs]

    def __call__(self, pipeline, step_index, timestep, callback_kwargs) -> Dict[str, Any]:
        """
        Calls all the callbacks in order with the given arguments and returns the final callback_kwargs.
        """
        for callback in self.callbacks:
            callback_kwargs = callback(pipeline, step_index, timestep, callback_kwargs)

        return callback_kwargs


class SDCFGCutoffCallback(PipelineCallback):
    """
    Callback function for Stable Diffusion Pipelines. After certain number of steps (set by `cutoff_step_ratio` or
    `cutoff_step_index`), this callback will disable the CFG.

    Note: This callback mutates the pipeline by changing the `_guidance_scale` attribute to 0.0 after the cutoff step.
    """

    tensor_inputs = ["prompt_embeds"]

    def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> Dict[str, Any]:
        cutoff_step_ratio = self.config.cutoff_step_ratio
        cutoff_step_index = self.config.cutoff_step_index

        # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
        cutoff_step = (
            cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
        )

        if step_index == cutoff_step:
            prompt_embeds = callback_kwargs[self.tensor_inputs[0]]
            prompt_embeds = prompt_embeds[-1:]  # "-1" denotes the embeddings for conditional text tokens.

            pipeline._guidance_scale = 0.0

            callback_kwargs[self.tensor_inputs[0]] = prompt_embeds
        return callback_kwargs


class SDXLCFGCutoffCallback(PipelineCallback):
    """
    Callback function for Stable Diffusion XL Pipelines. After certain number of steps (set by `cutoff_step_ratio` or
    `cutoff_step_index`), this callback will disable the CFG.

    Note: This callback mutates the pipeline by changing the `_guidance_scale` attribute to 0.0 after the cutoff step.
    """

    tensor_inputs = ["prompt_embeds", "add_text_embeds", "add_time_ids"]

    def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> Dict[str, Any]:
        cutoff_step_ratio = self.config.cutoff_step_ratio
        cutoff_step_index = self.config.cutoff_step_index

        # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
        cutoff_step = (
            cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
        )

        if step_index == cutoff_step:
            prompt_embeds = callback_kwargs[self.tensor_inputs[0]]
            prompt_embeds = prompt_embeds[-1:]  # "-1" denotes the embeddings for conditional text tokens.

            add_text_embeds = callback_kwargs[self.tensor_inputs[1]]
            add_text_embeds = add_text_embeds[-1:]  # "-1" denotes the embeddings for conditional pooled text tokens

            add_time_ids = callback_kwargs[self.tensor_inputs[2]]
            add_time_ids = add_time_ids[-1:]  # "-1" denotes the embeddings for conditional added time vector

            pipeline._guidance_scale = 0.0

            callback_kwargs[self.tensor_inputs[0]] = prompt_embeds
            callback_kwargs[self.tensor_inputs[1]] = add_text_embeds
            callback_kwargs[self.tensor_inputs[2]] = add_time_ids
        return callback_kwargs


class IPAdapterScaleCutoffCallback(PipelineCallback):
    """
    Callback function for any pipeline that inherits `IPAdapterMixin`. After certain number of steps (set by
    `cutoff_step_ratio` or `cutoff_step_index`), this callback will set the IP Adapter scale to `0.0`.

    Note: This callback mutates the IP Adapter attention processors by setting the scale to 0.0 after the cutoff step.
    """

    tensor_inputs = []

    def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> Dict[str, Any]:
        cutoff_step_ratio = self.config.cutoff_step_ratio
        cutoff_step_index = self.config.cutoff_step_index

        # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
        cutoff_step = (
            cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
        )

        if step_index == cutoff_step:
            pipeline.set_ip_adapter_scale(0.0)
        return callback_kwargs


================================================
FILE: src/diffusers/commands/__init__.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from abc import ABC, abstractmethod
from argparse import ArgumentParser


class BaseDiffusersCLICommand(ABC):
    @staticmethod
    @abstractmethod
    def register_subcommand(parser: ArgumentParser):
        raise NotImplementedError()

    @abstractmethod
    def run(self):
        raise NotImplementedError()


================================================
FILE: src/diffusers/commands/diffusers_cli.py
================================================
#!/usr/bin/env python
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from argparse import ArgumentParser

from .env import EnvironmentCommand
from .fp16_safetensors import FP16SafetensorsCommand


def main():
    parser = ArgumentParser("Diffusers CLI tool", usage="diffusers-cli <command> [<args>]")
    commands_parser = parser.add_subparsers(help="diffusers-cli command helpers")

    # Register commands
    EnvironmentCommand.register_subcommand(commands_parser)
    FP16SafetensorsCommand.register_subcommand(commands_parser)

    # Let's go
    args = parser.parse_args()

    if not hasattr(args, "func"):
        parser.print_help()
        exit(1)

    # Run
    service = args.func(args)
    service.run()


if __name__ == "__main__":
    main()


================================================
FILE: src/diffusers/commands/env.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import platform
import subprocess
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import (
    is_accelerate_available,
    is_bitsandbytes_available,
    is_flax_available,
    is_google_colab,
    is_peft_available,
    is_safetensors_available,
    is_torch_available,
    is_transformers_available,
    is_xformers_available,
)
from . import BaseDiffusersCLICommand


def info_command_factory(_):
    return EnvironmentCommand()


class EnvironmentCommand(BaseDiffusersCLICommand):
    @staticmethod
    def register_subcommand(parser: ArgumentParser) -> None:
        download_parser = parser.add_parser("env")
        download_parser.set_defaults(func=info_command_factory)

    def run(self) -> dict:
        hub_version = huggingface_hub.__version__

        safetensors_version = "not installed"
        if is_safetensors_available():
            import safetensors

            safetensors_version = safetensors.__version__

        pt_version = "not installed"
        pt_cuda_available = "NA"
        if is_torch_available():
            import torch

            pt_version = torch.__version__
            pt_cuda_available = torch.cuda.is_available()

        flax_version = "not installed"
        jax_version = "not installed"
        jaxlib_version = "not installed"
        jax_backend = "NA"
        if is_flax_available():
            import flax
            import jax
            import jaxlib

            flax_version = flax.__version__
            jax_version = jax.__version__
            jaxlib_version = jaxlib.__version__
            jax_backend = jax.lib.xla_bridge.get_backend().platform

        transformers_version = "not installed"
        if is_transformers_available():
            import transformers

            transformers_version = transformers.__version__

        accelerate_version = "not installed"
        if is_accelerate_available():
            import accelerate

            accelerate_version = accelerate.__version__

        peft_version = "not installed"
        if is_peft_available():
            import peft

            peft_version = peft.__version__

        bitsandbytes_version = "not installed"
        if is_bitsandbytes_available():
            import bitsandbytes

            bitsandbytes_version = bitsandbytes.__version__

        xformers_version = "not installed"
        if is_xformers_available():
            import xformers

            xformers_version = xformers.__version__

        platform_info = platform.platform()

        is_google_colab_str = "Yes" if is_google_colab() else "No"

        accelerator = "NA"
        if platform.system() in {"Linux", "Windows"}:
            try:
                sp = subprocess.Popen(
                    ["nvidia-smi", "--query-gpu=gpu_name,memory.total", "--format=csv,noheader"],
                    stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE,
                )
                out_str, _ = sp.communicate()
                out_str = out_str.decode("utf-8")

                if len(out_str) > 0:
                    accelerator = out_str.strip()
            except FileNotFoundError:
                pass
        elif platform.system() == "Darwin":  # Mac OS
            try:
                sp = subprocess.Popen(
                    ["system_profiler", "SPDisplaysDataType"],
                    stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE,
                )
                out_str, _ = sp.communicate()
                out_str = out_str.decode("utf-8")

                start = out_str.find("Chipset Model:")
                if start != -1:
                    start += len("Chipset Model:")
                    end = out_str.find("\n", start)
                    accelerator = out_str[start:end].strip()

                    start = out_str.find("VRAM (Total):")
                    if start != -1:
                        start += len("VRAM (Total):")
                        end = out_str.find("\n", start)
                        accelerator += " VRAM: " + out_str[start:end].strip()
            except FileNotFoundError:
                pass
        else:
            print("It seems you are running an unusual OS. Could you fill in the accelerator manually?")

        info = {
            "🤗 Diffusers version": version,
            "Platform": platform_info,
            "Running on Google Colab?": is_google_colab_str,
            "Python version": platform.python_version(),
            "PyTorch version (GPU?)": f"{pt_version} ({pt_cuda_available})",
            "Flax version (CPU?/GPU?/TPU?)": f"{flax_version} ({jax_backend})",
            "Jax version": jax_version,
            "JaxLib version": jaxlib_version,
            "Huggingface_hub version": hub_version,
            "Transformers version": transformers_version,
            "Accelerate version": accelerate_version,
            "PEFT version": peft_version,
            "Bitsandbytes version": bitsandbytes_version,
            "Safetensors version": safetensors_version,
            "xFormers version": xformers_version,
            "Accelerator": accelerator,
            "Using GPU in script?": "<fill in>",
            "Using distributed or parallel set-up in script?": "<fill in>",
        }

        print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n")
        print(self.format_dict(info))

        return info

    @staticmethod
    def format_dict(d: dict) -> str:
        return "\n".join([f"- {prop}: {val}" for prop, val in d.items()]) + "\n"


================================================
FILE: src/diffusers/commands/fp16_safetensors.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Usage example:
    diffusers-cli fp16_safetensors --ckpt_id=openai/shap-e --fp16 --use_safetensors
"""

import glob
import json
import warnings
from argparse import ArgumentParser, Namespace
from importlib import import_module

import huggingface_hub
import torch
from huggingface_hub import hf_hub_download
from packaging import version

from ..utils import logging
from . import BaseDiffusersCLICommand


def conversion_command_factory(args: Namespace):
    if args.use_auth_token:
        warnings.warn(
            "The `--use_auth_token` flag is deprecated and will be removed in a future version. Authentication is now"
            " handled automatically if user is logged in."
        )
    return FP16SafetensorsCommand(args.ckpt_id, args.fp16, args.use_safetensors)


class FP16SafetensorsCommand(BaseDiffusersCLICommand):
    @staticmethod
    def register_subcommand(parser: ArgumentParser):
        conversion_parser = parser.add_parser("fp16_safetensors")
        conversion_parser.add_argument(
            "--ckpt_id",
            type=str,
            help="Repo id of the checkpoints on which to run the conversion. Example: 'openai/shap-e'.",
        )
        conversion_parser.add_argument(
            "--fp16", action="store_true", help="If serializing the variables in FP16 precision."
        )
        conversion_parser.add_argument(
            "--use_safetensors", action="store_true", help="If serializing in the safetensors format."
        )
        conversion_parser.add_argument(
            "--use_auth_token",
            action="store_true",
            help="When working with checkpoints having private visibility. When used `huggingface-cli login` needs to be run beforehand.",
        )
        conversion_parser.set_defaults(func=conversion_command_factory)

    def __init__(self, ckpt_id: str, fp16: bool, use_safetensors: bool):
        self.logger = logging.get_logger("diffusers-cli/fp16_safetensors")
        self.ckpt_id = ckpt_id
        self.local_ckpt_dir = f"/tmp/{ckpt_id}"
        self.fp16 = fp16

        self.use_safetensors = use_safetensors

        if not self.use_safetensors and not self.fp16:
            raise NotImplementedError(
                "When `use_safetensors` and `fp16` both are False, then this command is of no use."
            )

    def run(self):
        if version.parse(huggingface_hub.__version__) < version.parse("0.9.0"):
            raise ImportError(
                "The huggingface_hub version must be >= 0.9.0 to use this command. Please update your huggingface_hub"
                " installation."
            )
        else:
            from huggingface_hub import create_commit
            from huggingface_hub._commit_api import CommitOperationAdd

        model_index = hf_hub_download(repo_id=self.ckpt_id, filename="model_index.json")
        with open(model_index, "r") as f:
            pipeline_class_name = json.load(f)["_class_name"]
        pipeline_class = getattr(import_module("diffusers"), pipeline_class_name)
        self.logger.info(f"Pipeline class imported: {pipeline_class_name}.")

        # Load the appropriate pipeline. We could have use `DiffusionPipeline`
        # here, but just to avoid any rough edge cases.
        pipeline = pipeline_class.from_pretrained(
            self.ckpt_id, torch_dtype=torch.float16 if self.fp16 else torch.float32
        )
        pipeline.save_pretrained(
            self.local_ckpt_dir,
            safe_serialization=True if self.use_safetensors else False,
            variant="fp16" if self.fp16 else None,
        )
        self.logger.info(f"Pipeline locally saved to {self.local_ckpt_dir}.")

        # Fetch all the paths.
        if self.fp16:
            modified_paths = glob.glob(f"{self.local_ckpt_dir}/*/*.fp16.*")
        elif self.use_safetensors:
            modified_paths = glob.glob(f"{self.local_ckpt_dir}/*/*.safetensors")

        # Prepare for the PR.
        commit_message = f"Serialize variables with FP16: {self.fp16} and safetensors: {self.use_safetensors}."
        operations = []
        for path in modified_paths:
            operations.append(CommitOperationAdd(path_in_repo="/".join(path.split("/")[4:]), path_or_fileobj=path))

        # Open the PR.
        commit_description = (
            "Variables converted by the [`diffusers`' `fp16_safetensors`"
            " CLI](https://github.com/huggingface/diffusers/blob/main/src/diffusers/commands/fp16_safetensors.py)."
        )
        hub_pr_url = create_commit(
            repo_id=self.ckpt_id,
            operations=operations,
            commit_message=commit_message,
            commit_description=commit_description,
            repo_type="model",
            create_pr=True,
        ).pr_url
        self.logger.info(f"PR created here: {hub_pr_url}.")


================================================
FILE: src/diffusers/configuration_utils.py
================================================
# coding=utf-8
# Copyright 2024 The HuggingFace Inc. team.
# Copyright (c) 2022, NVIDIA CORPORATION.  All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""ConfigMixin base class and utilities."""

import dataclasses
import functools
import importlib
import inspect
import json
import os
import re
from collections import OrderedDict
from pathlib import Path
from typing import Any, Dict, Tuple, Union

import numpy as np
from huggingface_hub import create_repo, hf_hub_download
from huggingface_hub.utils import (
    EntryNotFoundError,
    RepositoryNotFoundError,
    RevisionNotFoundError,
    validate_hf_hub_args,
)
from requests import HTTPError

from . import __version__
from .utils import (
    HUGGINGFACE_CO_RESOLVE_ENDPOINT,
    DummyObject,
    deprecate,
    extract_commit_hash,
    http_user_agent,
    logging,
)


logger = logging.get_logger(__name__)

_re_configuration_file = re.compile(r"config\.(.*)\.json")


class FrozenDict(OrderedDict):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        for key, value in self.items():
            setattr(self, key, value)

        self.__frozen = True

    def __delitem__(self, *args, **kwargs):
        raise Exception(f"You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.")

    def setdefault(self, *args, **kwargs):
        raise Exception(f"You cannot use ``setdefault`` on a {self.__class__.__name__} instance.")

    def pop(self, *args, **kwargs):
        raise Exception(f"You cannot use ``pop`` on a {self.__class__.__name__} instance.")

    def update(self, *args, **kwargs):
        raise Exception(f"You cannot use ``update`` on a {self.__class__.__name__} instance.")

    def __setattr__(self, name, value):
        if hasattr(self, "__frozen") and self.__frozen:
            raise Exception(f"You cannot use ``__setattr__`` on a {self.__class__.__name__} instance.")
        super().__setattr__(name, value)

    def __setitem__(self, name, value):
        if hasattr(self, "__frozen") and self.__frozen:
            raise Exception(f"You cannot use ``__setattr__`` on a {self.__class__.__name__} instance.")
        super().__setitem__(name, value)


class ConfigMixin:
    r"""
    Base class for all configuration classes. All configuration parameters are stored under `self.config`. Also
    provides the [`~ConfigMixin.from_config`] and [`~ConfigMixin.save_config`] methods for loading, downloading, and
    saving classes that inherit from [`ConfigMixin`].

    Class attributes:
        - **config_name** (`str`) -- A filename under which the config should stored when calling
          [`~ConfigMixin.save_config`] (should be overridden by parent class).
        - **ignore_for_config** (`List[str]`) -- A list of attributes that should not be saved in the config (should be
          overridden by subclass).
        - **has_compatibles** (`bool`) -- Whether the class has compatible classes (should be overridden by subclass).
        - **_deprecated_kwargs** (`List[str]`) -- Keyword arguments that are deprecated. Note that the `init` function
          should only have a `kwargs` argument if at least one argument is deprecated (should be overridden by
          subclass).
    """

    config_name = None
    ignore_for_config = []
    has_compatibles = False

    _deprecated_kwargs = []

    def register_to_config(self, **kwargs):
        if self.config_name is None:
            raise NotImplementedError(f"Make sure that {self.__class__} has defined a class name `config_name`")
        # Special case for `kwargs` used in deprecation warning added to schedulers
        # TODO: remove this when we remove the deprecation warning, and the `kwargs` argument,
        # or solve in a more general way.
        kwargs.pop("kwargs", None)

        if not hasattr(self, "_internal_dict"):
            internal_dict = kwargs
        else:
            previous_dict = dict(self._internal_dict)
            internal_dict = {**self._internal_dict, **kwargs}
            logger.debug(f"Updating config from {previous_dict} to {internal_dict}")

        self._internal_dict = FrozenDict(internal_dict)

    def __getattr__(self, name: str) -> Any:
        """The only reason we overwrite `getattr` here is to gracefully deprecate accessing
        config attributes directly. See https://github.com/huggingface/diffusers/pull/3129

        This function is mostly copied from PyTorch's __getattr__ overwrite:
        https://pytorch.org/docs/stable/_modules/torch/nn/modules/module.html#Module
        """

        is_in_config = "_internal_dict" in self.__dict__ and hasattr(self.__dict__["_internal_dict"], name)
        is_attribute = name in self.__dict__

        if is_in_config and not is_attribute:
            deprecation_message = f"Accessing config attribute `{name}` directly via '{type(self).__name__}' object attribute is deprecated. Please access '{name}' over '{type(self).__name__}'s config object instead, e.g. 'scheduler.config.{name}'."
            deprecate("direct config name access", "1.0.0", deprecation_message, standard_warn=False)
            return self._internal_dict[name]

        raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")

    def save_config(self, save_directory: Union[str, os.PathLike], push_to_hub: bool = False, **kwargs):
        """
        Save a configuration object to the directory specified in `save_directory` so that it can be reloaded using the
        [`~ConfigMixin.from_config`] class method.

        Args:
            save_directory (`str` or `os.PathLike`):
                Directory where the configuration JSON file is saved (will be created if it does not exist).
            push_to_hub (`bool`, *optional*, defaults to `False`):
                Whether or not to push your model to the Hugging Face Hub after saving it. You can specify the
                repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
                namespace).
            kwargs (`Dict[str, Any]`, *optional*):
                Additional keyword arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
        """
        if os.path.isfile(save_directory):
            raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file")

        os.makedirs(save_directory, exist_ok=True)

        # If we save using the predefined names, we can load using `from_config`
        output_config_file = os.path.join(save_directory, self.config_name)

        self.to_json_file(output_config_file)
        logger.info(f"Configuration saved in {output_config_file}")

        if push_to_hub:
            commit_message = kwargs.pop("commit_message", None)
            private = kwargs.pop("private", False)
            create_pr = kwargs.pop("create_pr", False)
            token = kwargs.pop("token", None)
            repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1])
            repo_id = create_repo(repo_id, exist_ok=True, private=private, token=token).repo_id

            self._upload_folder(
                save_directory,
                repo_id,
                token=token,
                commit_message=commit_message,
                create_pr=create_pr,
            )

    @classmethod
    def from_config(cls, config: Union[FrozenDict, Dict[str, Any]] = None, return_unused_kwargs=False, **kwargs):
        r"""
        Instantiate a Python class from a config dictionary.

        Parameters:
            config (`Dict[str, Any]`):
                A config dictionary from which the Python class is instantiated. Make sure to only load configuration
                files of compatible classes.
            return_unused_kwargs (`bool`, *optional*, defaults to `False`):
                Whether kwargs that are not consumed by the Python class should be returned or not.
            kwargs (remaining dictionary of keyword arguments, *optional*):
                Can be used to update the configuration object (after it is loaded) and initiate the Python class.
                `**kwargs` are passed directly to the underlying scheduler/model's `__init__` method and eventually
                overwrite the same named arguments in `config`.

        Returns:
            [`ModelMixin`] or [`SchedulerMixin`]:
                A model or scheduler object instantiated from a config dictionary.

        Examples:

        ```python
        >>> from diffusers import DDPMScheduler, DDIMScheduler, PNDMScheduler

        >>> # Download scheduler from huggingface.co and cache.
        >>> scheduler = DDPMScheduler.from_pretrained("google/ddpm-cifar10-32")

        >>> # Instantiate DDIM scheduler class with same config as DDPM
        >>> scheduler = DDIMScheduler.from_config(scheduler.config)

        >>> # Instantiate PNDM scheduler class with same config as DDPM
        >>> scheduler = PNDMScheduler.from_config(scheduler.config)
        ```
        """
        # <===== TO BE REMOVED WITH DEPRECATION
        # TODO(Patrick) - make sure to remove the following lines when config=="model_path" is deprecated
        if "pretrained_model_name_or_path" in kwargs:
            config = kwargs.pop("pretrained_model_name_or_path")

        if config is None:
            raise ValueError("Please make sure to provide a config as the first positional argument.")
        # ======>

        if not isinstance(config, dict):
            deprecation_message = "It is deprecated to pass a pretrained model name or path to `from_config`."
            if "Scheduler" in cls.__name__:
                deprecation_message += (
                    f"If you were trying to load a scheduler, please use {cls}.from_pretrained(...) instead."
                    " Otherwise, please make sure to pass a configuration dictionary instead. This functionality will"
                    " be removed in v1.0.0."
                )
            elif "Model" in cls.__name__:
                deprecation_message += (
                    f"If you were trying to load a model, please use {cls}.load_config(...) followed by"
                    f" {cls}.from_config(...) instead. Otherwise, please make sure to pass a configuration dictionary"
                    " instead. This functionality will be removed in v1.0.0."
                )
            deprecate("config-passed-as-path", "1.0.0", deprecation_message, standard_warn=False)
            config, kwargs = cls.load_config(pretrained_model_name_or_path=config, return_unused_kwargs=True, **kwargs)

        init_dict, unused_kwargs, hidden_dict = cls.extract_init_dict(config, **kwargs)

        # Allow dtype to be specified on initialization
        if "dtype" in unused_kwargs:
            init_dict["dtype"] = unused_kwargs.pop("dtype")

        # add possible deprecated kwargs
        for deprecated_kwarg in cls._deprecated_kwargs:
            if deprecated_kwarg in unused_kwargs:
                init_dict[deprecated_kwarg] = unused_kwargs.pop(deprecated_kwarg)

        # Return model and optionally state and/or unused_kwargs
        model = cls(**init_dict)

        # make sure to also save config parameters that might be used for compatible classes
        # update _class_name
        if "_class_name" in hidden_dict:
            hidden_dict["_class_name"] = cls.__name__

        model.register_to_config(**hidden_dict)

        # add hidden kwargs of compatible classes to unused_kwargs
        unused_kwargs = {**unused_kwargs, **hidden_dict}

        if return_unused_kwargs:
            return (model, unused_kwargs)
        else:
            return model

    @classmethod
    def get_config_dict(cls, *args, **kwargs):
        deprecation_message = (
            f" The function get_config_dict is deprecated. Please use {cls}.load_config instead. This function will be"
            " removed in version v1.0.0"
        )
        deprecate("get_config_dict", "1.0.0", deprecation_message, standard_warn=False)
        return cls.load_config(*args, **kwargs)

    @classmethod
    @validate_hf_hub_args
    def load_config(
        cls,
        pretrained_model_name_or_path: Union[str, os.PathLike],
        return_unused_kwargs=False,
        return_commit_hash=False,
        **kwargs,
    ) -> Tuple[Dict[str, Any], Dict[str, Any]]:
        r"""
        Load a model or scheduler configuration.

        Parameters:
            pretrained_model_name_or_path (`str` or `os.PathLike`, *optional*):
                Can be either:

                    - A string, the *model id* (for example `google/ddpm-celebahq-256`) of a pretrained model hosted on
                      the Hub.
                    - A path to a *directory* (for example `./my_model_directory`) containing model weights saved with
                      [`~ConfigMixin.save_config`].

            cache_dir (`Union[str, os.PathLike]`, *optional*):
                Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
                is not used.
            force_download (`bool`, *optional*, defaults to `False`):
                Whether or not to force the (re-)download of the model weights and configuration files, overriding the
                cached versions if they exist.
            proxies (`Dict[str, str]`, *optional*):
                A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
                'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
            output_loading_info(`bool`, *optional*, defaults to `False`):
                Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.
            local_files_only (`bool`, *optional*, defaults to `False`):
                Whether to only load local model weights and configuration files or not. If set to `True`, the model
                won't be downloaded from the Hub.
            token (`str` or *bool*, *optional*):
                The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
                `diffusers-cli login` (stored in `~/.huggingface`) is used.
            revision (`str`, *optional*, defaults to `"main"`):
                The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
                allowed by Git.
            subfolder (`str`, *optional*, defaults to `""`):
                The subfolder location of a model file within a larger model repository on the Hub or locally.
            return_unused_kwargs (`bool`, *optional*, defaults to `False):
                Whether unused keyword arguments of the config are returned.
            return_commit_hash (`bool`, *optional*, defaults to `False):
                Whether the `commit_hash` of the loaded configuration are returned.

        Returns:
            `dict`:
                A dictionary of all the parameters stored in a JSON configuration file.

        """
        cache_dir = kwargs.pop("cache_dir", None)
        local_dir = kwargs.pop("local_dir", None)
        local_dir_use_symlinks = kwargs.pop("local_dir_use_symlinks", "auto")
        force_download = kwargs.pop("force_download", False)
        proxies = kwargs.pop("proxies", None)
        token = kwargs.pop("token", None)
        local_files_only = kwargs.pop("local_files_only", False)
        revision = kwargs.pop("revision", None)
        _ = kwargs.pop("mirror", None)
        subfolder = kwargs.pop("subfolder", None)
        user_agent = kwargs.pop("user_agent", {})

        user_agent = {**user_agent, "file_type": "config"}
        user_agent = http_user_agent(user_agent)

        pretrained_model_name_or_path = str(pretrained_model_name_or_path)

        if cls.config_name is None:
            raise ValueError(
                "`self.config_name` is not defined. Note that one should not load a config from "
                "`ConfigMixin`. Please make sure to define `config_name` in a class inheriting from `ConfigMixin`"
            )

        if os.path.isfile(pretrained_model_name_or_path):
            config_file = pretrained_model_name_or_path
        elif os.path.isdir(pretrained_model_name_or_path):
            if subfolder is not None and os.path.isfile(
                os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
            ):
                config_file = os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
            elif os.path.isfile(os.path.join(pretrained_model_name_or_path, cls.config_name)):
                # Load from a PyTorch checkpoint
                config_file = os.path.join(pretrained_model_name_or_path, cls.config_name)
            else:
                raise EnvironmentError(
                    f"Error no file named {cls.config_name} found in directory {pretrained_model_name_or_path}."
                )
        else:
            try:
                # Load from URL or cache if already cached
                config_file = hf_hub_download(
                    pretrained_model_name_or_path,
                    filename=cls.config_name,
                    cache_dir=cache_dir,
                    force_download=force_download,
                    proxies=proxies,
                    local_files_only=local_files_only,
                    token=token,
                    user_agent=user_agent,
                    subfolder=subfolder,
                    revision=revision,
                    local_dir=local_dir,
                    local_dir_use_symlinks=local_dir_use_symlinks,
                )
            except RepositoryNotFoundError:
                raise EnvironmentError(
                    f"{pretrained_model_name_or_path} is not a local folder and is not a valid model identifier"
                    " listed on 'https://huggingface.co/models'\nIf this is a private repository, make sure to pass a"
                    " token having permission to this repo with `token` or log in with `huggingface-cli login`."
                )
            except RevisionNotFoundError:
                raise EnvironmentError(
                    f"{revision} is not a valid git identifier (branch name, tag name or commit id) that exists for"
                    " this model name. Check the model page at"
                    f" 'https://huggingface.co/{pretrained_model_name_or_path}' for available revisions."
                )
            except EntryNotFoundError:
                raise EnvironmentError(
                    f"{pretrained_model_name_or_path} does not appear to have a file named {cls.config_name}."
                )
            except HTTPError as err:
                raise EnvironmentError(
                    "There was a specific connection error when trying to load"
                    f" {pretrained_model_name_or_path}:\n{err}"
                )
            except ValueError:
                raise EnvironmentError(
                    f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load this model, couldn't find it"
                    f" in the cached files and it looks like {pretrained_model_name_or_path} is not the path to a"
                    f" directory containing a {cls.config_name} file.\nCheckout your internet connection or see how to"
                    " run the library in offline mode at"
                    " 'https://huggingface.co/docs/diffusers/installation#offline-mode'."
                )
            except EnvironmentError:
                raise EnvironmentError(
                    f"Can't load config for '{pretrained_model_name_or_path}'. If you were trying to load it from "
                    "'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
                    f"Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory "
                    f"containing a {cls.config_name} file"
                )

        try:
            # Load config dict
            config_dict = cls._dict_from_json_file(config_file)

            commit_hash = extract_commit_hash(config_file)
        except (json.JSONDecodeError, UnicodeDecodeError):
            raise EnvironmentError(f"It looks like the config file at '{config_file}' is not a valid JSON file.")

        if not (return_unused_kwargs or return_commit_hash):
            return config_dict

        outputs = (config_dict,)

        if return_unused_kwargs:
            outputs += (kwargs,)

        if return_commit_hash:
            outputs += (commit_hash,)

        return outputs

    @staticmethod
    def _get_init_keys(input_class):
        return set(dict(inspect.signature(input_class.__init__).parameters).keys())

    @classmethod
    def extract_init_dict(cls, config_dict, **kwargs):
        # Skip keys that were not present in the original config, so default __init__ values were used
        used_defaults = config_dict.get("_use_default_values", [])
        config_dict = {k: v for k, v in config_dict.items() if k not in used_defaults and k != "_use_default_values"}

        # 0. Copy origin config dict
        original_dict = dict(config_dict.items())

        # 1. Retrieve expected config attributes from __init__ signature
        expected_keys = cls._get_init_keys(cls)
        expected_keys.remove("self")
        # remove general kwargs if present in dict
        if "kwargs" in expected_keys:
            expected_keys.remove("kwargs")
        # remove flax internal keys
        if hasattr(cls, "_flax_internal_args"):
            for arg in cls._flax_internal_args:
                expected_keys.remove(arg)

        # 2. Remove attributes that cannot be expected from expected config attributes
        # remove keys to be ignored
        if len(cls.ignore_for_config) > 0:
            expected_keys = expected_keys - set(cls.ignore_for_config)

        # load diffusers library to import compatible and original scheduler
        diffusers_library = importlib.import_module(__name__.split(".")[0])

        if cls.has_compatibles:
            compatible_classes = [c for c in cls._get_compatibles() if not isinstance(c, DummyObject)]
        else:
            compatible_classes = []

        expected_keys_comp_cls = set()
        for c in compatible_classes:
            expected_keys_c = cls._get_init_keys(c)
            expected_keys_comp_cls = expected_keys_comp_cls.union(expected_keys_c)
        expected_keys_comp_cls = expected_keys_comp_cls - cls._get_init_keys(cls)
        config_dict = {k: v for k, v in config_dict.items() if k not in expected_keys_comp_cls}

        # remove attributes from orig class that cannot be expected
        orig_cls_name = config_dict.pop("_class_name", cls.__name__)
        if (
            isinstance(orig_cls_name, str)
            and orig_cls_name != cls.__name__
            and hasattr(diffusers_library, orig_cls_name)
        ):
            orig_cls = getattr(diffusers_library, orig_cls_name)
            unexpected_keys_from_orig = cls._get_init_keys(orig_cls) - expected_keys
            config_dict = {k: v for k, v in config_dict.items() if k not in unexpected_keys_from_orig}
        elif not isinstance(orig_cls_name, str) and not isinstance(orig_cls_name, (list, tuple)):
            raise ValueError(
                "Make sure that the `_class_name` is of type string or list of string (for custom pipelines)."
            )

        # remove private attributes
        config_dict = {k: v for k, v in config_dict.items() if not k.startswith("_")}

        # 3. Create keyword arguments that will be passed to __init__ from expected keyword arguments
        init_dict = {}
        for key in expected_keys:
            # if config param is passed to kwarg and is present in config dict
            # it should overwrite existing config dict key
            if key in kwargs and key in config_dict:
                config_dict[key] = kwargs.pop(key)

            if key in kwargs:
                # overwrite key
                init_dict[key] = kwargs.pop(key)
            elif key in config_dict:
                # use value from config dict
                init_dict[key] = config_dict.pop(key)

        # 4. Give nice warning if unexpected values have been passed
        if len(config_dict) > 0:
            logger.warning(
                f"The config attributes {config_dict} were passed to {cls.__name__}, "
                "but are not expected and will be ignored. Please verify your "
                f"{cls.config_name} configuration file."
            )

        # 5. Give nice info if config attributes are initialized to default because they have not been passed
        passed_keys = set(init_dict.keys())
        if len(expected_keys - passed_keys) > 0:
            logger.info(
                f"{expected_keys - passed_keys} was not found in config. Values will be initialized to default values."
            )

        # 6. Define unused keyword arguments
        unused_kwargs = {**config_dict, **kwargs}

        # 7. Define "hidden" config parameters that were saved for compatible classes
        hidden_config_dict = {k: v for k, v in original_dict.items() if k not in init_dict}

        return init_dict, unused_kwargs, hidden_config_dict

    @classmethod
    def _dict_from_json_file(cls, json_file: Union[str, os.PathLike]):
        with open(json_file, "r", encoding="utf-8") as reader:
            text = reader.read()
        return json.loads(text)

    def __repr__(self):
        return f"{self.__class__.__name__} {self.to_json_string()}"

    @property
    def config(self) -> Dict[str, Any]:
        """
        Returns the config of the class as a frozen dictionary

        Returns:
            `Dict[str, Any]`: Config of the class.
        """
        return self._internal_dict

    def to_json_string(self) -> str:
        """
        Serializes the configuration instance to a JSON string.

        Returns:
            `str`:
                String containing all the attributes that make up the configuration instance in JSON format.
        """
        config_dict = self._internal_dict if hasattr(self, "_internal_dict") else {}
        config_dict["_class_name"] = self.__class__.__name__
        config_dict["_diffusers_version"] = __version__

        def to_json_saveable(value):
            if isinstance(value, np.ndarray):
                value = value.tolist()
            elif isinstance(value, Path):
                value = value.as_posix()
            return value

        config_dict = {k: to_json_saveable(v) for k, v in config_dict.items()}
        # Don't save "_ignore_files" or "_use_default_values"
        config_dict.pop("_ignore_files", None)
        config_dict.pop("_use_default_values", None)

        return json.dumps(config_dict, indent=2, sort_keys=True) + "\n"

    def to_json_file(self, json_file_path: Union[str, os.PathLike]):
        """
        Save the configuration instance's parameters to a JSON file.

        Args:
            json_file_path (`str` or `os.PathLike`):
                Path to the JSON file to save a configuration instance's parameters.
        """
        with open(json_file_path, "w", encoding="utf-8") as writer:
            writer.write(self.to_json_string())


def register_to_config(init):
    r"""
    Decorator to apply on the init of classes inheriting from [`ConfigMixin`] so that all the arguments are
    automatically sent to `self.register_for_config`. To ignore a specific argument accepted by the init but that
    shouldn't be registered in the config, use the `ignore_for_config` class variable

    Warning: Once decorated, all private arguments (beginning with an underscore) are trashed and not sent to the init!
    """

    @functools.wraps(init)
    def inner_init(self, *args, **kwargs):
        # Ignore private kwargs in the init.
        init_kwargs = {k: v for k, v in kwargs.items() if not k.startswith("_")}
        config_init_kwargs = {k: v for k, v in kwargs.items() if k.startswith("_")}
        if not isinstance(self, ConfigMixin):
            raise RuntimeError(
                f"`@register_for_config` was applied to {self.__class__.__name__} init method, but this class does "
                "not inherit from `ConfigMixin`."
            )

        ignore = getattr(self, "ignore_for_config", [])
        # Get positional arguments aligned with kwargs
        new_kwargs = {}
        signature = inspect.signature(init)
        parameters = {
            name: p.default for i, (name, p) in enumerate(signature.parameters.items()) if i > 0 and name not in ignore
        }
        for arg, name in zip(args, parameters.keys()):
            new_kwargs[name] = arg

        # Then add all kwargs
        new_kwargs.update(
            {
                k: init_kwargs.get(k, default)
                for k, default in parameters.items()
                if k not in ignore and k not in new_kwargs
            }
        )

        # Take note of the parameters that were not present in the loaded config
        if len(set(new_kwargs.keys()) - set(init_kwargs)) > 0:
            new_kwargs["_use_default_values"] = list(set(new_kwargs.keys()) - set(init_kwargs))

        new_kwargs = {**config_init_kwargs, **new_kwargs}
        getattr(self, "register_to_config")(**new_kwargs)
        init(self, *args, **init_kwargs)

    return inner_init


def flax_register_to_config(cls):
    original_init = cls.__init__

    @functools.wraps(original_init)
    def init(self, *args, **kwargs):
        if not isinstance(self, ConfigMixin):
            raise RuntimeError(
                f"`@register_for_config` was applied to {self.__class__.__name__} init method, but this class does "
                "not inherit from `ConfigMixin`."
            )

        # Ignore private kwargs in the init. Retrieve all passed attributes
        init_kwargs = dict(kwargs.items())

        # Retrieve default values
        fields = dataclasses.fields(self)
        default_kwargs = {}
        for field in fields:
            # ignore flax specific attributes
            if field.name in self._flax_internal_args:
                continue
            if type(field.default) == dataclasses._MISSING_TYPE:
                default_kwargs[field.name] = None
            else:
                default_kwargs[field.name] = getattr(self, field.name)

        # Make sure init_kwargs override default kwargs
        new_kwargs = {**default_kwargs, **init_kwargs}
        # dtype should be part of `init_kwargs`, but not `new_kwargs`
        if "dtype" in new_kwargs:
            new_kwargs.pop("dtype")

        # Get positional arguments aligned with kwargs
        for i, arg in enumerate(args):
            name = fields[i].name
            new_kwargs[name] = arg

        # Take note of the parameters that were not present in the loaded config
        if len(set(new_kwargs.keys()) - set(init_kwargs)) > 0:
            new_kwargs["_use_default_values"] = list(set(new_kwargs.keys()) - set(init_kwargs))

        getattr(self, "register_to_config")(**new_kwargs)
        original_init(self, *args, **kwargs)

    cls.__init__ = init
    return cls


class LegacyConfigMixin(ConfigMixin):
    r"""
    A subclass of `ConfigMixin` to resolve class mapping from legacy classes (like `Transformer2DModel`) to more
    pipeline-specific classes (like `DiTTransformer2DModel`).
    """

    @classmethod
    def from_config(cls, config: Union[FrozenDict, Dict[str, Any]] = None, return_unused_kwargs=False, **kwargs):
        # To prevent dependency import problem.
        from .models.model_loading_utils import _fetch_remapped_cls_from_config

        # resolve remapping
        remapped_class = _fetch_remapped_cls_from_config(config, cls)

        return remapped_class.from_config(config, return_unused_kwargs, **kwargs)


================================================
FILE: src/diffusers/dependency_versions_check.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

pkgs_to_check_at_runtime = "python requests filelock numpy".split()
for pkg in pkgs_to_check_at_runtime:
    if pkg in deps:
        require_version_core(deps[pkg])
    else:
        raise ValueError(f"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py")


def dep_version_check(pkg, hint=None):
    require_version(deps[pkg], hint)


================================================
FILE: src/diffusers/dependency_versions_table.py
================================================
# THIS FILE HAS BEEN AUTOGENERATED. To update:
# 1. modify the `_deps` dict in setup.py
# 2. run `make deps_table_update`
deps = {
    "Pillow": "Pillow",
    "accelerate": "accelerate>=0.31.0",
    "compel": "compel==0.1.8",
    "datasets": "datasets",
    "filelock": "filelock",
    "flax": "flax>=0.4.1",
    "hf-doc-builder": "hf-doc-builder>=0.3.0",
    "huggingface-hub": "huggingface-hub>=0.23.2",
    "requests-mock": "requests-mock==1.10.0",
    "importlib_metadata": "importlib_metadata",
    "invisible-watermark": "invisible-watermark>=0.2.0",
    "isort": "isort>=5.5.4",
    "jax": "jax>=0.4.1",
    "jaxlib": "jaxlib>=0.4.1",
    "Jinja2": "Jinja2",
    "k-diffusion": "k-diffusion>=0.0.12",
    "torchsde": "torchsde",
    "note_seq": "note_seq",
    "librosa": "librosa",
    "numpy": "numpy",
    "parameterized": "parameterized",
    "peft": "peft>=0.6.0",
    "protobuf": "protobuf>=3.20.3,<4",
    "pytest": "pytest",
    "pytest-timeout": "pytest-timeout",
    "pytest-xdist": "pytest-xdist",
    "python": "python>=3.8.0",
    "ruff": "ruff==0.1.5",
    "safetensors": "safetensors>=0.3.1",
    "sentencepiece": "sentencepiece>=0.1.91,!=0.1.92",
    "GitPython": "GitPython<3.1.19",
    "scipy": "scipy",
    "onnx": "onnx",
    "regex": "regex!=2019.12.17",
    "requests": "requests",
    "tensorboard": "tensorboard",
    "torch": "torch>=1.4",
    "torchvision": "torchvision",
    "transformers": "transformers>=4.41.2",
    "urllib3": "urllib3<=2.0.0",
    "black": "black",
}


================================================
FILE: src/diffusers/experimental/README.md
================================================
# 🧨 Diffusers Experimental

We are adding experimental code to support novel applications and usages of the Diffusers library.
Currently, the following experiments are supported:
* Reinforcement learning via an implementation of the [Diffuser](https://arxiv.org/abs/2205.09991) model.

================================================
FILE: src/diffusers/experimental/__init__.py
================================================
from .rl import ValueGuidedRLPipeline


================================================
FILE: src/diffusers/experimental/rl/__init__.py
================================================
from .value_guided_sampling import ValueGuidedRLPipeline


================================================
FILE: src/diffusers/experimental/rl/value_guided_sampling.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import numpy as np
import torch
import tqdm

from ...models.unets.unet_1d import UNet1DModel
from ...pipelines import DiffusionPipeline
from ...utils.dummy_pt_objects import DDPMScheduler
from ...utils.torch_utils import randn_tensor


class ValueGuidedRLPipeline(DiffusionPipeline):
    r"""
    Pipeline for value-guided sampling from a diffusion model trained to predict sequences of states.

    This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
    implemented for all pipelines (downloading, saving, running on a particular device, etc.).

    Parameters:
        value_function ([`UNet1DModel`]):
            A specialized UNet for fine-tuning trajectories base on reward.
        unet ([`UNet1DModel`]):
            UNet architecture to denoise the encoded trajectories.
        scheduler ([`SchedulerMixin`]):
            A scheduler to be used in combination with `unet` to denoise the encoded trajectories. Default for this
            application is [`DDPMScheduler`].
        env ():
            An environment following the OpenAI gym API to act in. For now only Hopper has pretrained models.
    """

    def __init__(
        self,
        value_function: UNet1DModel,
        unet: UNet1DModel,
        scheduler: DDPMScheduler,
        env,
    ):
        super().__init__()

        self.register_modules(value_function=value_function, unet=unet, scheduler=scheduler, env=env)

        self.data = env.get_dataset()
        self.means = {}
        for key in self.data.keys():
            try:
                self.means[key] = self.data[key].mean()
            except:  # noqa: E722
                pass
        self.stds = {}
        for key in self.data.keys():
            try:
                self.stds[key] = self.data[key].std()
            except:  # noqa: E722
                pass
        self.state_dim = env.observation_space.shape[0]
        self.action_dim = env.action_space.shape[0]

    def normalize(self, x_in, key):
        return (x_in - self.means[key]) / self.stds[key]

    def de_normalize(self, x_in, key):
        return x_in * self.stds[key] + self.means[key]

    def to_torch(self, x_in):
        if isinstance(x_in, dict):
            return {k: self.to_torch(v) for k, v in x_in.items()}
        elif torch.is_tensor(x_in):
            return x_in.to(self.unet.device)
        return torch.tensor(x_in, device=self.unet.device)

    def reset_x0(self, x_in, cond, act_dim):
        for key, val in cond.items():
            x_in[:, key, act_dim:] = val.clone()
        return x_in

    def run_diffusion(self, x, conditions, n_guide_steps, scale):
        batch_size = x.shape[0]
        y = None
        for i in tqdm.tqdm(self.scheduler.timesteps):
            # create batch of timesteps to pass into model
            timesteps = torch.full((batch_size,), i, device=self.unet.device, dtype=torch.long)
            for _ in range(n_guide_steps):
                with torch.enable_grad():
                    x.requires_grad_()

                    # permute to match dimension for pre-trained models
                    y = self.value_function(x.permute(0, 2, 1), timesteps).sample
                    grad = torch.autograd.grad([y.sum()], [x])[0]

                    posterior_variance = self.scheduler._get_variance(i)
                    model_std = torch.exp(0.5 * posterior_variance)
                    grad = model_std * grad

                grad[timesteps < 2] = 0
                x = x.detach()
                x = x + scale * grad
                x = self.reset_x0(x, conditions, self.action_dim)

            prev_x = self.unet(x.permute(0, 2, 1), timesteps).sample.permute(0, 2, 1)

            # TODO: verify deprecation of this kwarg
            x = self.scheduler.step(prev_x, i, x)["prev_sample"]

            # apply conditions to the trajectory (set the initial state)
            x = self.reset_x0(x, conditions, self.action_dim)
            x = self.to_torch(x)
        return x, y

    def __call__(self, obs, batch_size=64, planning_horizon=32, n_guide_steps=2, scale=0.1):
        # normalize the observations and create  batch dimension
        obs = self.normalize(obs, "observations")
        obs = obs[None].repeat(batch_size, axis=0)

        conditions = {0: self.to_torch(obs)}
        shape = (batch_size, planning_horizon, self.state_dim + self.action_dim)

        # generate initial noise and apply our conditions (to make the trajectories start at current state)
        x1 = randn_tensor(shape, device=self.unet.device)
        x = self.reset_x0(x1, conditions, self.action_dim)
        x = self.to_torch(x)

        # run the diffusion process
        x, y = self.run_diffusion(x, conditions, n_guide_steps, scale)

        # sort output trajectories by value
        sorted_idx = y.argsort(0, descending=True).squeeze()
        sorted_values = x[sorted_idx]
        actions = sorted_values[:, :, : self.action_dim]
        actions = actions.detach().cpu().numpy()
        denorm_actions = self.de_normalize(actions, key="actions")

        # select the action with the highest value
        if y is not None:
            selected_index = 0
        else:
            # if we didn't run value guiding, select a random action
            selected_index = np.random.randint(0, batch_size)

        denorm_actions = denorm_actions[selected_index, 0]
        return denorm_actions


================================================
FILE: src/diffusers/image_processor.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import math
import warnings
from typing import List, Optional, Tuple, Union

import numpy as np
import PIL.Image
import torch
import torch.nn.functional as F
from PIL import Image, ImageFilter, ImageOps

from .configuration_utils import ConfigMixin, register_to_config
from .utils import CONFIG_NAME, PIL_INTERPOLATION, deprecate


PipelineImageInput = Union[
    PIL.Image.Image,
    np.ndarray,
    torch.Tensor,
    List[PIL.Image.Image],
    List[np.ndarray],
    List[torch.Tensor],
]

PipelineDepthInput = PipelineImageInput


def is_valid_image(image):
    return isinstance(image, PIL.Image.Image) or isinstance(image, (np.ndarray, torch.Tensor)) and image.ndim in (2, 3)


def is_valid_image_imagelist(images):
    # check if the image input is one of the supported formats for image and image list:
    # it can be either one of below 3
    # (1) a 4d pytorch tensor or numpy array,
    # (2) a valid image: PIL.Image.Image, 2-d np.ndarray or torch.Tensor (grayscale image), 3-d np.ndarray or torch.Tensor
    # (3) a list of valid image
    if isinstance(images, (np.ndarray, torch.Tensor)) and images.ndim == 4:
        return True
    elif is_valid_image(images):
        return True
    elif isinstance(images, list):
        return all(is_valid_image(image) for image in images)
    return False


class VaeImageProcessor(ConfigMixin):
    """
    Image processor for VAE.

    Args:
        do_resize (`bool`, *optional*, defaults to `True`):
            Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`. Can accept
            `height` and `width` arguments from [`image_processor.VaeImageProcessor.preprocess`] method.
        vae_scale_factor (`int`, *optional*, defaults to `8`):
            VAE scale factor. If `do_resize` is `True`, the image is automatically resized to multiples of this factor.
        resample (`str`, *optional*, defaults to `lanczos`):
            Resampling filter to use when resizing the image.
        do_normalize (`bool`, *optional*, defaults to `True`):
            Whether to normalize the image to [-1,1].
        do_binarize (`bool`, *optional*, defaults to `False`):
            Whether to binarize the image to 0/1.
        do_convert_rgb (`bool`, *optional*, defaults to be `False`):
            Whether to convert the images to RGB format.
        do_convert_grayscale (`bool`, *optional*, defaults to be `False`):
            Whether to convert the images to grayscale format.
    """

    config_name = CONFIG_NAME

    @register_to_config
    def __init__(
        self,
        do_resize: bool = True,
        vae_scale_factor: int = 8,
        vae_latent_channels: int = 4,
        resample: str = "lanczos",
        do_normalize: bool = True,
        do_binarize: bool = False,
        do_convert_rgb: bool = False,
        do_convert_grayscale: bool = False,
    ):
        super().__init__()
        if do_convert_rgb and do_convert_grayscale:
            raise ValueError(
                "`do_convert_rgb` and `do_convert_grayscale` can not both be set to `True`,"
                " if you intended to convert the image into RGB format, please set `do_convert_grayscale = False`.",
                " if you intended to convert the image into grayscale format, please set `do_convert_rgb = False`",
            )

    @staticmethod
    def numpy_to_pil(images: np.ndarray) -> List[PIL.Image.Image]:
        """
        Convert a numpy image or a batch of images to a PIL image.
        """
        if images.ndim == 3:
            images = images[None, ...]
        images = (images * 255).round().astype("uint8")
        if images.shape[-1] == 1:
            # special case for grayscale (single channel) images
            pil_images = [Image.fromarray(image.squeeze(), mode="L") for image in images]
        else:
            pil_images = [Image.fromarray(image) for image in images]

        return pil_images

    @staticmethod
    def pil_to_numpy(images: Union[List[PIL.Image.Image], PIL.Image.Image]) -> np.ndarray:
        """
        Convert a PIL image or a list of PIL images to NumPy arrays.
        """
        if not isinstance(images, list):
            images = [images]
        images = [np.array(image).astype(np.float32) / 255.0 for image in images]
        images = np.stack(images, axis=0)

        return images

    @staticmethod
    def numpy_to_pt(images: np.ndarray) -> torch.Tensor:
        """
        Convert a NumPy image to a PyTorch tensor.
        """
        if images.ndim == 3:
            images = images[..., None]

        images = torch.from_numpy(images.transpose(0, 3, 1, 2))
        return images

    @staticmethod
    def pt_to_numpy(images: torch.Tensor) -> np.ndarray:
        """
        Convert a PyTorch tensor to a NumPy image.
        """
        images = images.cpu().permute(0, 2, 3, 1).float().numpy()
        return images

    @staticmethod
    def normalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]:
        """
        Normalize an image array to [-1,1].
        """
        return 2.0 * images - 1.0

    @staticmethod
    def denormalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]:
        """
        Denormalize an image array to [0,1].
        """
        return (images / 2 + 0.5).clamp(0, 1)

    @staticmethod
    def convert_to_rgb(image: PIL.Image.Image) -> PIL.Image.Image:
        """
        Converts a PIL image to RGB format.
        """
        image = image.convert("RGB")

        return image

    @staticmethod
    def convert_to_grayscale(image: PIL.Image.Image) -> PIL.Image.Image:
        """
        Converts a PIL image to grayscale format.
        """
        image = image.convert("L")

        return image

    @staticmethod
    def blur(image: PIL.Image.Image, blur_factor: int = 4) -> PIL.Image.Image:
        """
        Applies Gaussian blur to an image.
        """
        image = image.filter(ImageFilter.GaussianBlur(blur_factor))

        return image

    @staticmethod
    def get_crop_region(mask_image: PIL.Image.Image, width: int, height: int, pad=0):
        """
        Finds a rectangular region that contains all masked ares in an image, and expands region to match the aspect
        ratio of the original image; for example, if user drew mask in a 128x32 region, and the dimensions for
        processing are 512x512, the region will be expanded to 128x128.

        Args:
            mask_image (PIL.Image.Image): Mask image.
            width (int): Width of the image to be processed.
            height (int): Height of the image to be processed.
            pad (int, optional): Padding to be added to the crop region. Defaults to 0.

        Returns:
            tuple: (x1, y1, x2, y2) represent a rectangular region that contains all masked ares in an image and
            matches the original aspect ratio.
        """

        mask_image = mask_image.convert("L")
        mask = np.array(mask_image)

        # 1. find a rectangular region that contains all masked ares in an image
        h, w = mask.shape
        crop_left = 0
        for i in range(w):
            if not (mask[:, i] == 0).all():
                break
            crop_left += 1

        crop_right = 0
        for i in reversed(range(w)):
            if not (mask[:, i] == 0).all():
                break
            crop_right += 1

        crop_top = 0
        for i in range(h):
            if not (mask[i] == 0).all():
                break
            crop_top += 1

        crop_bottom = 0
        for i in reversed(range(h)):
            if not (mask[i] == 0).all():
                break
            crop_bottom += 1

        # 2. add padding to the crop region
        x1, y1, x2, y2 = (
            int(max(crop_left - pad, 0)),
            int(max(crop_top - pad, 0)),
            int(min(w - crop_right + pad, w)),
            int(min(h - crop_bottom + pad, h)),
        )

        # 3. expands crop region to match the aspect ratio of the image to be processed
        ratio_crop_region = (x2 - x1) / (y2 - y1)
        ratio_processing = width / height

        if ratio_crop_region > ratio_processing:
            desired_height = (x2 - x1) / ratio_processing
            desired_height_diff = int(desired_height - (y2 - y1))
            y1 -= desired_height_diff // 2
            y2 += desired_height_diff - desired_height_diff // 2
            if y2 >= mask_image.height:
                diff = y2 - mask_image.height
                y2 -= diff
                y1 -= diff
            if y1 < 0:
                y2 -= y1
                y1 -= y1
            if y2 >= mask_image.height:
                y2 = mask_image.height
        else:
            desired_width = (y2 - y1) * ratio_processing
            desired_width_diff = int(desired_width - (x2 - x1))
            x1 -= desired_width_diff // 2
            x2 += desired_width_diff - desired_width_diff // 2
            if x2 >= mask_image.width:
                diff = x2 - mask_image.width
                x2 -= diff
                x1 -= diff
            if x1 < 0:
                x2 -= x1
                x1 -= x1
            if x2 >= mask_image.width:
                x2 = mask_image.width

        return x1, y1, x2, y2

    def _resize_and_fill(
        self,
        image: PIL.Image.Image,
        width: int,
        height: int,
    ) -> PIL.Image.Image:
        """
        Resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center
        the image within the dimensions, filling empty with data from image.

        Args:
            image: The image to resize.
            width: The width to resize the image to.
            height: The height to resize the image to.
        """

        ratio = width / height
        src_ratio = image.width / image.height

        src_w = width if ratio < src_ratio else image.width * height // image.height
        src_h = height if ratio >= src_ratio else image.height * width // image.width

        resized = image.resize((src_w, src_h), resample=PIL_INTERPOLATION["lanczos"])
        res = Image.new("RGB", (width, height))
        res.paste(resized, box=(width // 2 - src_w // 2, height // 2 - src_h // 2))

        if ratio < src_ratio:
            fill_height = height // 2 - src_h // 2
            if fill_height > 0:
                res.paste(resized.resize((width, fill_height), box=(0, 0, width, 0)), box=(0, 0))
                res.paste(
                    resized.resize((width, fill_height), box=(0, resized.height, width, resized.height)),
                    box=(0, fill_height + src_h),
                )
        elif ratio > src_ratio:
            fill_width = width // 2 - src_w // 2
            if fill_width > 0:
                res.paste(resized.resize((fill_width, height), box=(0, 0, 0, height)), box=(0, 0))
                res.paste(
                    resized.resize((fill_width, height), box=(resized.width, 0, resized.width, height)),
                    box=(fill_width + src_w, 0),
                )

        return res

    def _resize_and_crop(
        self,
        image: PIL.Image.Image,
        width: int,
        height: int,
    ) -> PIL.Image.Image:
        """
        Resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center
        the image within the dimensions, cropping the excess.

        Args:
            image: The image to resize.
            width: The width to resize the image to.
            height: The height to resize the image to.
        """
        ratio = width / height
        src_ratio = image.width / image.height

        src_w = width if ratio > src_ratio else image.width * height // image.height
        src_h = height if ratio <= src_ratio else image.height * width // image.width

        resized = image.resize((src_w, src_h), resample=PIL_INTERPOLATION["lanczos"])
        res = Image.new("RGB", (width, height))
        res.paste(resized, box=(width // 2 - src_w // 2, height // 2 - src_h // 2))
        return res

    def resize(
        self,
        image: Union[PIL.Image.Image, np.ndarray, torch.Tensor],
        height: int,
        width: int,
        resize_mode: str = "default",  # "default", "fill", "crop"
    ) -> Union[PIL.Image.Image, np.ndarray, torch.Tensor]:
        """
        Resize image.

        Args:
            image (`PIL.Image.Image`, `np.ndarray` or `torch.Tensor`):
                The image input, can be a PIL image, numpy array or pytorch tensor.
            height (`int`):
                The height to resize to.
            width (`int`):
                The width to resize to.
            resize_mode (`str`, *optional*, defaults to `default`):
                The resize mode to use, can be one of `default` or `fill`. If `default`, will resize the image to fit
                within the specified width and height, and it may not maintaining the original aspect ratio. If `fill`,
                will resize the image to fit within the specified width and height, maintaining the aspect ratio, and
                then center the image within the dimensions, filling empty with data from image. If `crop`, will resize
                the image to fit within the specified width and height, maintaining the aspect ratio, and then center
                the image within the dimensions, cropping the excess. Note that resize_mode `fill` and `crop` are only
                supported for PIL image input.

        Returns:
            `PIL.Image.Image`, `np.ndarray` or `torch.Tensor`:
                The resized image.
        """
        if resize_mode != "default" and not isinstance(image, PIL.Image.Image):
            raise ValueError(f"Only PIL image input is supported for resize_mode {resize_mode}")
        if isinstance(image, PIL.Image.Image):
            if resize_mode == "default":
                image = image.resize((width, height), resample=PIL_INTERPOLATION[self.config.resample])
            elif resize_mode == "fill":
                image = self._resize_and_fill(image, width, height)
            elif resize_mode == "crop":
                image = self._resize_and_crop(image, width, height)
            else:
                raise ValueError(f"resize_mode {resize_mode} is not supported")

        elif isinstance(image, torch.Tensor):
            image = torch.nn.functional.interpolate(
                image,
                size=(height, width),
            )
        elif isinstance(image, np.ndarray):
            image = self.numpy_to_pt(image)
            image = torch.nn.functional.interpolate(
                image,
                size=(height, width),
            )
            image = self.pt_to_numpy(image)
        return image

    def binarize(self, image: PIL.Image.Image) -> PIL.Image.Image:
        """
        Create a mask.

        Args:
            image (`PIL.Image.Image`):
                The image input, should be a PIL image.

        Returns:
            `PIL.Image.Image`:
                The binarized image. Values less than 0.5 are set to 0, values greater than 0.5 are set to 1.
        """
        image[image < 0.5] = 0
        image[image >= 0.5] = 1

        return image

    def get_default_height_width(
        self,
        image: Union[PIL.Image.Image, np.ndarray, torch.Tensor],
        height: Optional[int] = None,
        width: Optional[int] = None,
    ) -> Tuple[int, int]:
        """
        This function return the height and width that are downscaled to the next integer multiple of
        `vae_scale_factor`.

        Args:
            image(`PIL.Image.Image`, `np.ndarray` or `torch.Tensor`):
                The image input, can be a PIL image, numpy array or pytorch tensor. if it is a numpy array, should have
                shape `[batch, height, width]` or `[batch, height, width, channel]` if it is a pytorch tensor, should
                have shape `[batch, channel, height, width]`.
            height (`int`, *optional*, defaults to `None`):
                The height in preprocessed image. If `None`, will use the height of `image` input.
            width (`int`, *optional*`, defaults to `None`):
                The width in preprocessed. If `None`, will use the width of the `image` input.
        """

        if height is None:
            if isinstance(image, PIL.Image.Image):
                height = image.height
            elif isinstance(image, torch.Tensor):
                height = image.shape[2]
            else:
                height = image.shape[1]

        if width is None:
            if isinstance(image, PIL.Image.Image):
                width = image.width
            elif isinstance(image, torch.Tensor):
                width = image.shape[3]
            else:
                width = image.shape[2]

        width, height = (
            x - x % self.config.vae_scale_factor for x in (width, height)
        )  # resize to integer multiple of vae_scale_factor

        return height, width

    def preprocess(
        self,
        image: PipelineImageInput,
        height: Optional[int] = None,
        width: Optional[int] = None,
        resize_mode: str = "default",  # "default", "fill", "crop"
        crops_coords: Optional[Tuple[int, int, int, int]] = None,
    ) -> torch.Tensor:
        """
        Preprocess the image input.

        Args:
            image (`pipeline_image_input`):
                The image input, accepted formats are PIL images, NumPy arrays, PyTorch tensors; Also accept list of
                supported formats.
            height (`int`, *optional*, defaults to `None`):
                The height in preprocessed image. If `None`, will use the `get_default_height_width()` to get default
                height.
            width (`int`, *optional*`, defaults to `None`):
                The width in preprocessed. If `None`, will use get_default_height_width()` to get the default width.
            resize_mode (`str`, *optional*, defaults to `default`):
                The resize mode, can be one of `default` or `fill`. If `default`, will resize the image to fit within
                the specified width and height, and it may not maintaining the original aspect ratio. If `fill`, will
                resize the image to fit within the specified width and height, maintaining the aspect ratio, and then
                center the image within the dimensions, filling empty with data from image. If `crop`, will resize the
                image to fit within the specified width and height, maintaining the aspect ratio, and then center the
                image within the dimensions, cropping the excess. Note that resize_mode `fill` and `crop` are only
                supported for PIL image input.
            crops_coords (`List[Tuple[int, int, int, int]]`, *optional*, defaults to `None`):
                The crop coordinates for each image in the batch. If `None`, will not crop the image.
        """
        supported_formats = (PIL.Image.Image, np.ndarray, torch.Tensor)

        # Expand the missing dimension for 3-dimensional pytorch tensor or numpy array that represents grayscale image
        if self.config.do_convert_grayscale and isinstance(image, (torch.Tensor, np.ndarray)) and image.ndim == 3:
            if isinstance(image, torch.Tensor):
                # if image is a pytorch tensor could have 2 possible shapes:
                #    1. batch x height x width: we should insert the channel dimension at position 1
                #    2. channel x height x width: we should insert batch dimension at position 0,
                #       however, since both channel and batch dimension has same size 1, it is same to insert at position 1
                #    for simplicity, we insert a dimension of size 1 at position 1 for both cases
                image = image.unsqueeze(1)
            else:
                # if it is a numpy array, it could have 2 possible shapes:
                #   1. batch x height x width: insert channel dimension on last position
                #   2. height x width x channel: insert batch dimension on first position
                if image.shape[-1] == 1:
                    image = np.expand_dims(image, axis=0)
                else:
                    image = np.expand_dims(image, axis=-1)

        if isinstance(image, list) and isinstance(image[0], np.ndarray) and image[0].ndim == 4:
            warnings.warn(
                "Passing `image` as a list of 4d np.ndarray is deprecated."
                "Please concatenate the list along the batch dimension and pass it as a single 4d np.ndarray",
                FutureWarning,
            )
            image = np.concatenate(image, axis=0)
        if isinstance(image, list) and isinstance(image[0], torch.Tensor) and image[0].ndim == 4:
            warnings.warn(
                "Passing `image` as a list of 4d torch.Tensor is deprecated."
                "Please concatenate the list along the batch dimension and pass it as a single 4d torch.Tensor",
                FutureWarning,
            )
            image = torch.cat(image, axis=0)

        if not is_valid_image_imagelist(image):
            raise ValueError(
                f"Input is in incorrect format. Currently, we only support {', '.join(str(x) for x in supported_formats)}"
            )
        if not isinstance(image, list):
            image = [image]

        if isinstance(image[0], PIL.Image.Image):
            if crops_coords is not None:
                image = [i.crop(crops_coords) for i in image]
            if self.config.do_resize:
                height, width = self.get_default_height_width(image[0], height, width)
                image = [self.resize(i, height, width, resize_mode=resize_mode) for i in image]
            if self.config.do_convert_rgb:
                image = [self.convert_to_rgb(i) for i in image]
            elif self.config.do_convert_grayscale:
                image = [self.convert_to_grayscale(i) for i in image]
            image = self.pil_to_numpy(image)  # to np
            image = self.numpy_to_pt(image)  # to pt

        elif isinstance(image[0], np.ndarray):
            image = np.concatenate(image, axis=0) if image[0].ndim == 4 else np.stack(image, axis=0)

            image = self.numpy_to_pt(image)

            height, width = self.get_default_height_width(image, height, width)
            if self.config.do_resize:
                image = self.resize(image, height, width)

        elif isinstance(image[0], torch.Tensor):
            image = torch.cat(image, axis=0) if image[0].ndim == 4 else torch.stack(image, axis=0)

            if self.config.do_convert_grayscale and image.ndim == 3:
                image = image.unsqueeze(1)

            channel = image.shape[1]
            # don't need any preprocess if the image is latents
            if channel == self.vae_latent_channels:
                return image

            height, width = self.get_default_height_width(image, height, width)
            if self.config.do_resize:
                image = self.resize(image, height, width)

        # expected range [0,1], normalize to [-1,1]
        do_normalize = self.config.do_normalize
        if do_normalize and image.min() < 0:
            warnings.warn(
                "Passing `image` as torch tensor with value range in [-1,1] is deprecated. The expected value range for image tensor is [0,1] "
                f"when passing as pytorch tensor or numpy Array. You passed `image` with value range [{image.min()},{image.max()}]",
                FutureWarning,
            )
            do_normalize = False
        if do_normalize:
            image = self.normalize(image)

        if self.config.do_binarize:
            image = self.binarize(image)

        return image

    def postprocess(
        self,
        image: torch.Tensor,
        output_type: str = "pil",
        do_denormalize: Optional[List[bool]] = None,
    ) -> Union[PIL.Image.Image, np.ndarray, torch.Tensor]:
        """
        Postprocess the image output from tensor to `output_type`.

        Args:
            image (`torch.Tensor`):
                The image input, should be a pytorch tensor with shape `B x C x H x W`.
            output_type (`str`, *optional*, defaults to `pil`):
                The output type of the image, can be one of `pil`, `np`, `pt`, `latent`.
            do_denormalize (`List[bool]`, *optional*, defaults to `None`):
                Whether to denormalize the image to [0,1]. If `None`, will use the value of `do_normalize` in the
                `VaeImageProcessor` config.

        Returns:
            `PIL.Image.Image`, `np.ndarray` or `torch.Tensor`:
                The postprocessed image.
        """
        if not isinstance(image, torch.Tensor):
            raise ValueError(
                f"Input for postprocessing is in incorrect format: {type(image)}. We only support pytorch tensor"
            )
        if output_type not in ["latent", "pt", "np", "pil"]:
            deprecation_message = (
                f"the output_type {output_type} is outdated and has been set to `np`. Please make sure to set it to one of these instead: "
                "`pil`, `np`, `pt`, `latent`"
            )
            deprecate("Unsupported output_type", "1.0.0", deprecation_message, standard_warn=False)
            output_type = "np"

        if output_type == "latent":
            return image

        if do_denormalize is None:
            do_denormalize = [self.config.do_normalize] * image.shape[0]

        image = torch.stack(
            [self.denormalize(image[i]) if do_denormalize[i] else image[i] for i in range(image.shape[0])]
        )

        if output_type == "pt":
            return image

        image = self.pt_to_numpy(image)

        if output_type == "np":
            return image

        if output_type == "pil":
            return self.numpy_to_pil(image)

    def apply_overlay(
        self,
        mask: PIL.Image.Image,
        init_image: PIL.Image.Image,
        image: PIL.Image.Image,
        crop_coords: Optional[Tuple[int, int, int, int]] = None,
    ) -> PIL.Image.Image:
        """
        overlay the inpaint output to the original image
        """

        width, height = image.width, image.height

        init_image = self.resize(init_image, width=width, height=height)
        mask = self.resize(mask, width=width, height=height)

        init_image_masked = PIL.Image.new("RGBa", (width, height))
        init_image_masked.paste(init_image.convert("RGBA").convert("RGBa"), mask=ImageOps.invert(mask.convert("L")))
        init_image_masked = init_image_masked.convert("RGBA")

        if crop_coords is not None:
            x, y, x2, y2 = crop_coords
            w = x2 - x
            h = y2 - y
            base_image = PIL.Image.new("RGBA", (width, height))
            image = self.resize(image, height=h, width=w, resize_mode="crop")
            base_image.paste(image, (x, y))
            image = base_image.convert("RGB")

        image = image.convert("RGBA")
        image.alpha_composite(init_image_masked)
        image = image.convert("RGB")

        return image


class VaeImageProcessorLDM3D(VaeImageProcessor):
    """
    Image processor for VAE LDM3D.

    Args:
        do_resize (`bool`, *optional*, defaults to `True`):
            Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`.
        vae_scale_factor (`int`, *optional*, defaults to `8`):
            VAE scale factor. If `do_resize` is `True`, the image is automatically resized to multiples of this factor.
        resample (`str`, *optional*, defaults to `lanczos`):
            Resampling filter to use when resizing the image.
        do_normalize (`bool`, *optional*, defaults to `True`):
            Whether to normalize the image to [-1,1].
    """

    config_name = CONFIG_NAME

    @register_to_config
    def __init__(
        self,
        do_resize: bool = True,
        vae_scale_factor: int = 8,
        resample: str = "lanczos",
        do_normalize: bool = True,
    ):
        super().__init__()

    @staticmethod
    def numpy_to_pil(images: np.ndarray) -> List[PIL.Image.Image]:
        """
        Convert a NumPy image or a batch of images to a PIL image.
        """
        if images.ndim == 3:
            images = images[None, ...]
        images = (images * 255).round().astype("uint8")
        if images.shape[-1] == 1:
            # special case for grayscale (single channel) images
            pil_images = [Image.fromarray(image.squeeze(), mode="L") for image in images]
        else:
            pil_images = [Image.fromarray(image[:, :, :3]) for image in images]

        return pil_images

    @staticmethod
    def depth_pil_to_numpy(images: Union[List[PIL.Image.Image], PIL.Image.Image]) -> np.ndarray:
        """
        Convert a PIL image or a list of PIL images to NumPy arrays.
        """
        if not isinstance(images, list):
            images = [images]

        images = [np.array(image).astype(np.float32) / (2**16 - 1) for image in images]
        images = np.stack(images, axis=0)
        return images

    @staticmethod
    def rgblike_to_depthmap(image: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]:
        """
        Args:
            image: RGB-like depth image

        Returns: depth map

        """
        return image[:, :, 1] * 2**8 + image[:, :, 2]

    def numpy_to_depth(self, images: np.ndarray) -> List[PIL.Image.Image]:
        """
        Convert a NumPy depth image or a batch of images to a PIL image.
        """
        if images.ndim == 3:
            images = images[None, ...]
        images_depth = images[:, :, :, 3:]
        if images.shape[-1] == 6:
            images_depth = (images_depth * 255).round().astype("uint8")
            pil_images = [
                Image.fromarray(self.rgblike_to_depthmap(image_depth), mode="I;16") for image_depth in images_depth
            ]
        elif images.shape[-1] == 4:
            images_depth = (images_depth * 65535.0).astype(np.uint16)
            pil_images = [Image.fromarray(image_depth, mode="I;16") for image_depth in images_depth]
        else:
            raise Exception("Not supported")

        return pil_images

    def postprocess(
        self,
        image: torch.Tensor,
        output_type: str = "pil",
        do_denormalize: Optional[List[bool]] = None,
    ) -> Union[PIL.Image.Image, np.ndarray, torch.Tensor]:
        """
        Postprocess the image output from tensor to `output_type`.

        Args:
            image (`torch.Tensor`):
                The image input, should be a pytorch tensor with shape `B x C x H x W`.
            output_type (`str`, *optional*, defaults to `pil`):
                The output type of the image, can be one of `pil`, `np`, `pt`, `latent`.
            do_denormalize (`List[bool]`, *optional*, defaults to `None`):
                Whether to denormalize the image to [0,1]. If `None`, will use the value of `do_normalize` in the
                `VaeImageProcessor` config.

        Returns:
            `PIL.Image.Image`, `np.ndarray` or `torch.Tensor`:
                The postprocessed image.
        """
        if not isinstance(image, torch.Tensor):
            raise ValueError(
                f"Input for postprocessing is in incorrect format: {type(image)}. We only support pytorch tensor"
            )
        if output_type not in ["latent", "pt", "np", "pil"]:
            deprecation_message = (
                f"the output_type {output_type} is outdated and has been set to `np`. Please make sure to set it to one of these instead: "
                "`pil`, `np`, `pt`, `latent`"
            )
            deprecate("Unsupported output_type", "1.0.0", deprecation_message, standard_warn=False)
            output_type = "np"

        if do_denormalize is None:
            do_denormalize = [self.config.do_normalize] * image.shape[0]

        image = torch.stack(
            [self.denormalize(image[i]) if do_denormalize[i] else image[i] for i in range(image.shape[0])]
        )

        image = self.pt_to_numpy(image)

        if output_type == "np":
            if image.shape[-1] == 6:
                image_depth = np.stack([self.rgblike_to_depthmap(im[:, :, 3:]) for im in image], axis=0)
            else:
                image_depth = image[:, :, :, 3:]
            return image[:, :, :, :3], image_depth

        if output_type == "pil":
            return self.numpy_to_pil(image), self.numpy_to_depth(image)
        else:
            raise Exception(f"This type {output_type} is not supported")

    def preprocess(
        self,
        rgb: Union[torch.Tensor, PIL.Image.Image, np.ndarray],
        depth: Union[torch.Tensor, PIL.Image.Image, np.ndarray],
        height: Optional[int] = None,
        width: Optional[int] = None,
        target_res: Optional[int] = None,
    ) -> torch.Tensor:
        """
        Preprocess the image input. Accepted formats are PIL images, NumPy arrays or PyTorch tensors.
        """
        supported_formats = (PIL.Image.Image, np.ndarray, torch.Tensor)

        # Expand the missing dimension for 3-dimensional pytorch tensor or numpy array that represents grayscale image
        if self.config.do_convert_grayscale and isinstance(rgb, (torch.Tensor, np.ndarray)) and rgb.ndim == 3:
            raise Exception("This is not yet supported")

        if isinstance(rgb, supported_formats):
            rgb = [rgb]
            depth = [depth]
        elif not (isinstance(rgb, list) and all(isinstance(i, supported_formats) for i in rgb)):
            raise ValueError(
                f"Input is in incorrect format: {[type(i) for i in rgb]}. Currently, we only support {', '.join(supported_formats)}"
            )

        if isinstance(rgb[0], PIL.Image.Image):
            if self.config.do_convert_rgb:
                raise Exception("This is not yet supported")
                # rgb = [self.convert_to_rgb(i) for i in rgb]
                # depth = [self.convert_to_depth(i) for i in depth]  #TODO define convert_to_depth
            if self.config.do_resize or target_res:
                height, width = self.get_default_height_width(rgb[0], height, width) if not target_res else target_res
                rgb = [self.resize(i, height, width) for i in rgb]
                depth = [self.resize(i, height, width) for i in depth]
            rgb = self.pil_to_numpy(rgb)  # to np
            rgb = self.numpy_to_pt(rgb)  # to pt

            depth = self.depth_pil_to_numpy(depth)  # to np
            depth = self.numpy_to_pt(depth)  # to pt

        elif isinstance(rgb[0], np.ndarray):
            rgb = np.concatenate(rgb, axis=0) if rgb[0].ndim == 4 else np.stack(rgb, axis=0)
            rgb = self.numpy_to_pt(rgb)
            height, width = self.get_default_height_width(rgb, height, width)
            if self.config.do_resize:
                rgb = self.resize(rgb, height, width)

            depth = np.concatenate(depth, axis=0) if rgb[0].ndim == 4 else np.stack(depth, axis=0)
            depth = self.numpy_to_pt(depth)
            height, width = self.get_default_height_width(depth, height, width)
            if self.config.do_resize:
                depth = self.resize(depth, height, width)

        elif isinstance(rgb[0], torch.Tensor):
            raise Exception("This is not yet supported")
            # rgb = torch.cat(rgb, axis=0) if rgb[0].ndim == 4 else torch.stack(rgb, axis=0)

            # if self.config.do_convert_grayscale and rgb.ndim == 3:
            #     rgb = rgb.unsqueeze(1)

            # channel = rgb.shape[1]

            # height, width = self.get_default_height_width(rgb, height, width)
            # if self.config.do_resize:
            #     rgb = self.resize(rgb, height, width)

            # depth = torch.cat(depth, axis=0) if depth[0].ndim == 4 else torch.stack(depth, axis=0)

            # if self.config.do_convert_grayscale and depth.ndim == 3:
            #     depth = depth.unsqueeze(1)

            # channel = depth.shape[1]
            # # don't need any preprocess if the image is latents
            # if depth == 4:
            #     return rgb, depth

            # height, width = self.get_default_height_width(depth, height, width)
            # if self.config.do_resize:
            #     depth = self.resize(depth, height, width)
        # expected range [0,1], normalize to [-1,1]
        do_normalize = self.config.do_normalize
        if rgb.min() < 0 and do_normalize:
            warnings.warn(
                "Passing `image` as torch tensor with value range in [-1,1] is deprecated. The expected value range for image tensor is [0,1] "
                f"when passing as pytorch tensor or numpy Array. You passed `image` with value range [{rgb.min()},{rgb.max()}]",
                FutureWarning,
            )
            do_normalize = False

        if do_normalize:
            rgb = self.normalize(rgb)
            depth = self.normalize(depth)

        if self.config.do_binarize:
            rgb = self.binarize(rgb)
            depth = self.binarize(depth)

        return rgb, depth


class IPAdapterMaskProcessor(VaeImageProcessor):
    """
    Image processor for IP Adapter image masks.

    Args:
        do_resize (`bool`, *optional*, defaults to `True`):
            Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`.
        vae_scale_factor (`int`, *optional*, defaults to `8`):
            VAE scale factor. If `do_resize` is `True`, the image is automatically resized to multiples of this factor.
        resample (`str`, *optional*, defaults to `lanczos`):
            Resampling filter to use when resizing the image.
        do_normalize (`bool`, *optional*, defaults to `False`):
            Whether to normalize the image to [-1,1].
        do_binarize (`bool`, *optional*, defaults to `True`):
            Whether to binarize the image to 0/1.
        do_convert_grayscale (`bool`, *optional*, defaults to be `True`):
            Whether to convert the images to grayscale format.

    """

    config_name = CONFIG_NAME

    @register_to_config
    def __init__(
        self,
        do_resize: bool = True,
        vae_scale_factor: int = 8,
        resample: str = "lanczos",
        do_normalize: bool = False,
        do_binarize: bool = True,
        do_convert_grayscale: bool = True,
    ):
        super().__init__(
            do_resize=do_resize,
            vae_scale_factor=vae_scale_factor,
            resample=resample,
            do_normalize=do_normalize,
            do_binarize=do_binarize,
            do_convert_grayscale=do_convert_grayscale,
        )

    @staticmethod
    def downsample(mask: torch.Tensor, batch_size: int, num_queries: int, value_embed_dim: int):
        """
        Downsamples the provided mask tensor to match the expected dimensions for scaled dot-product attention. If the
        aspect ratio of the mask does not match the aspect ratio of the output image, a warning is issued.

        Args:
            mask (`torch.Tensor`):
                The input mask tensor generated with `IPAdapterMaskProcessor.preprocess()`.
            batch_size (`int`):
                The batch size.
            num_queries (`int`):
                The number of queries.
            value_embed_dim (`int`):
                The dimensionality of the value embeddings.

        Returns:
            `torch.Tensor`:
                The downsampled mask tensor.

        """
        o_h = mask.shape[1]
        o_w = mask.shape[2]
        ratio = o_w / o_h
        mask_h = int(math.sqrt(num_queries / ratio))
        mask_h = int(mask_h) + int((num_queries % int(mask_h)) != 0)
        mask_w = num_queries // mask_h

        mask_downsample = F.interpolate(mask.unsqueeze(0), size=(mask_h, mask_w), mode="bicubic").squeeze(0)

        # Repeat batch_size times
        if mask_downsample.shape[0] < batch_size:
            mask_downsample = mask_downsample.repeat(batch_size, 1, 1)

        mask_downsample = mask_downsample.view(mask_downsample.shape[0], -1)

        downsampled_area = mask_h * mask_w
        # If the output image and the mask do not have the same aspect ratio, tensor shapes will not match
        # Pad tensor if downsampled_mask.shape[1] is smaller than num_queries
        if downsampled_area < num_queries:
            warnings.warn(
                "The aspect ratio of the mask does not match the aspect ratio of the output image. "
                "Please update your masks or adjust the output size for optimal performance.",
                UserWarning,
            )
            mask_downsample = F.pad(mask_downsample, (0, num_queries - mask_downsample.shape[1]), value=0.0)
        # Discard last embeddings if downsampled_mask.shape[1] is bigger than num_queries
        if downsampled_area > num_queries:
            warnings.warn(
                "The aspect ratio of the mask does not match the aspect ratio of the output image. "
                "Please update your masks or adjust the output size for optimal performance.",
                UserWarning,
            )
            mask_downsample = mask_downsample[:, :num_queries]

        # Repeat last dimension to match SDPA output shape
        mask_downsample = mask_downsample.view(mask_downsample.shape[0], mask_downsample.shape[1], 1).repeat(
            1, 1, value_embed_dim
        )

        return mask_downsample


class PixArtImageProcessor(VaeImageProcessor):
    """
    Image processor for PixArt image resize and crop.

    Args:
        do_resize (`bool`, *optional*, defaults to `True`):
            Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`. Can accept
            `height` and `width` arguments from [`image_processor.VaeImageProcessor.preprocess`] method.
        vae_scale_factor (`int`, *optional*, defaults to `8`):
            VAE scale factor. If `do_resize` is `True`, the image is automatically resized to multiples of this factor.
        resample (`str`, *optional*, defaults to `lanczos`):
            Resampling filter to use when resizing the image.
        do_normalize (`bool`, *optional*, defaults to `True`):
            Whether to normalize the image to [-1,1].
        do_binarize (`bool`, *optional*, defaults to `False`):
            Whether to binarize the image to 0/1.
        do_convert_rgb (`bool`, *optional*, defaults to be `False`):
            Whether to convert the images to RGB format.
        do_convert_grayscale (`bool`, *optional*, defaults to be `False`):
            Whether to convert the images to grayscale format.
    """

    @register_to_config
    def __init__(
        self,
        do_resize: bool = True,
        vae_scale_factor: int = 8,
        resample: str = "lanczos",
        do_normalize: bool = True,
        do_binarize: bool = False,
        do_convert_grayscale: bool = False,
    ):
        super().__init__(
            do_resize=do_resize,
            vae_scale_factor=vae_scale_factor,
            resample=resample,
            do_normalize=do_normalize,
            do_binarize=do_binarize,
            do_convert_grayscale=do_convert_grayscale,
        )

    @staticmethod
    def classify_height_width_bin(height: int, width: int, ratios: dict) -> Tuple[int, int]:
        """Returns binned height and width."""
        ar = float(height / width)
        closest_ratio = min(ratios.keys(), key=lambda ratio: abs(float(ratio) - ar))
        default_hw = ratios[closest_ratio]
        return int(default_hw[0]), int(default_hw[1])

    @staticmethod
    def resize_and_crop_tensor(samples: torch.Tensor, new_width: int, new_height: int) -> torch.Tensor:
        orig_height, orig_width = samples.shape[2], samples.shape[3]

        # Check if resizing is needed
        if orig_height != new_height or orig_width != new_width:
            ratio = max(new_height / orig_height, new_width / orig_width)
            resized_width = int(orig_width * ratio)
            resized_height = int(orig_height * ratio)

            # Resize
            samples = F.interpolate(
                samples, size=(resized_height, resized_width), mode="bilinear", align_corners=False
            )

            # Center Crop
            start_x = (resized_width - new_width) // 2
            end_x = start_x + new_width
            start_y = (resized_height - new_height) // 2
            end_y = start_y + new_height
            samples = samples[:, :, start_y:end_y, start_x:end_x]

        return samples


================================================
FILE: src/diffusers/loaders/__init__.py
================================================
from typing import TYPE_CHECKING

from ..utils import DIFFUSERS_SLOW_IMPORT, _LazyModule, deprecate
from ..utils.import_utils import is_peft_available, is_torch_available, is_transformers_available


def text_encoder_lora_state_dict(text_encoder):
    deprecate(
        "text_encoder_load_state_dict in `models`",
        "0.27.0",
        "`text_encoder_lora_state_dict` is deprecated and will be removed in 0.27.0. Make sure to retrieve the weights using `get_peft_model`. See https://huggingface.co/docs/peft/v0.6.2/en/quicktour#peftmodel for more information.",
    )
    state_dict = {}

    for name, module in text_encoder_attn_modules(text_encoder):
        for k, v in module.q_proj.lora_linear_layer.state_dict().items():
            state_dict[f"{name}.q_proj.lora_linear_layer.{k}"] = v

        for k, v in module.k_proj.lora_linear_layer.state_dict().items():
            state_dict[f"{name}.k_proj.lora_linear_layer.{k}"] = v

        for k, v in module.v_proj.lora_linear_layer.state_dict().items():
            state_dict[f"{name}.v_proj.lora_linear_layer.{k}"] = v

        for k, v in module.out_proj.lora_linear_layer.state_dict().items():
            state_dict[f"{name}.out_proj.lora_linear_layer.{k}"] = v

    return state_dict


if is_transformers_available():

    def text_encoder_attn_modules(text_encoder):
        deprecate(
            "text_encoder_attn_modules in `models`",
            "0.27.0",
            "`text_encoder_lora_state_dict` is deprecated and will be removed in 0.27.0. Make sure to retrieve the weights using `get_peft_model`. See https://huggingface.co/docs/peft/v0.6.2/en/quicktour#peftmodel for more information.",
        )
        from transformers import CLIPTextModel, CLIPTextModelWithProjection

        attn_modules = []

        if isinstance(text_encoder, (CLIPTextModel, CLIPTextModelWithProjection)):
            for i, layer in enumerate(text_encoder.text_model.encoder.layers):
                name = f"text_model.encoder.layers.{i}.self_attn"
                mod = layer.self_attn
                attn_modules.append((name, mod))
        else:
            raise ValueError(f"do not know how to get attention modules for: {text_encoder.__class__.__name__}")

        return attn_modules


_import_structure = {}

if is_torch_available():
    _import_structure["single_file_model"] = ["FromOriginalModelMixin"]

    _import_structure["unet"] = ["UNet2DConditionLoadersMixin"]
    _import_structure["utils"] = ["AttnProcsLayers"]
    if is_transformers_available():
        _import_structure["single_file"] = ["FromSingleFileMixin"]
        _import_structure["lora_pipeline"] = [
            "AmusedLoraLoaderMixin",
            "StableDiffusionLoraLoaderMixin",
            "SD3LoraLoaderMixin",
            "StableDiffusionXLLoraLoaderMixin",
            "LoraLoaderMixin",
            "FluxLoraLoaderMixin",
        ]
        _import_structure["textual_inversion"] = ["TextualInversionLoaderMixin"]
        _import_structure["ip_adapter"] = ["IPAdapterMixin"]

_import_structure["peft"] = ["PeftAdapterMixin"]


if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
    if is_torch_available():
        from .single_file_model import FromOriginalModelMixin
        from .unet import UNet2DConditionLoadersMixin
        from .utils import AttnProcsLayers

        if is_transformers_available():
            from .ip_adapter import IPAdapterMixin
            from .lora_pipeline import (
                AmusedLoraLoaderMixin,
                FluxLoraLoaderMixin,
                LoraLoaderMixin,
                SD3LoraLoaderMixin,
                StableDiffusionLoraLoaderMixin,
                StableDiffusionXLLoraLoaderMixin,
            )
            from .single_file import FromSingleFileMixin
            from .textual_inversion import TextualInversionLoaderMixin

    from .peft import PeftAdapterMixin
else:
    import sys

    sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


================================================
FILE: src/diffusers/loaders/ip_adapter.py
================================================
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from pathlib import Path
from typing import Dict, List, Optional, Union

import torch
import torch.nn.functional as F
from huggingface_hub.utils import validate_hf_hub_args
from safetensors import safe_open

from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT, load_state_dict
from ..utils import (
    USE_PEFT_BACKEND,
    _get_model_file,
    is_accelerate_available,
    is_torch_version,
    is_transformers_available,
    logging,
)
from .unet_loader_utils import _maybe_expand_lora_scales


if is_transformers_available():
    from transformers import (
        CLIPImageProcessor,
        CLIPVisionModelWithProjection,
    )

    from ..models.attention_processor import (
        AttnProcessor,
        AttnProcessor2_0,
        IPAdapterAttnProcessor,
        IPAdapterAttnProcessor2_0,
    )

logger = logging.get_logger(__name__)


class IPAdapterMixin:
    """Mixin for handling IP Adapters."""

    @validate_hf_hub_args
    def load_ip_adapter(
        self,
        pretrained_model_name_or_path_or_dict: Union[str, List[str], Dict[str, torch.Tensor]],
        subfolder: Union[str, List[str]],
        weight_name: Union[str, List[str]],
        image_encoder_folder: Optional[str] = "image_encoder",
        **kwargs,
    ):
        """
        Parameters:
            pretrained_model_name_or_path_or_dict (`str` or `List[str]` or `os.PathLike` or `List[os.PathLike]` or `dict` or `List[dict]`):
                Can be either:

                    - A string, the *model id* (for example `google/ddpm-celebahq-256`) of a pretrained model hosted on
                      the Hub.
                    - A path to a *directory* (for example `./my_model_directory`) containing the model weights saved
                      with [`ModelMixin.save_pretrained`].
                    - A [torch state
                      dict](https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict).
            subfolder (`str` or `List[str]`):
                The subfolder location of a model file within a larger model repository on the Hub or locally. If a
                list is passed, it should have the same length as `weight_name`.
            weight_name (`str` or `List[str]`):
                The name of the weight file to load. If a list is passed, it should have the same length as
                `weight_name`.
            image_encoder_folder (`str`, *optional*, defaults to `image_encoder`):
                The subfolder location of the image encoder within a larger model repository on the Hub or locally.
                Pass `None` to not load the image encoder. If the image encoder is located in a folder inside
                `subfolder`, you only need to pass the name of the folder that contains image encoder weights, e.g.
                `image_encoder_folder="image_encoder"`. If the image encoder is located in a folder other than
                `subfolder`, you should pass the path to the folder that contains image encoder weights, for example,
                `image_encoder_folder="different_subfolder/image_encoder"`.
            cache_dir (`Union[str, os.PathLike]`, *optional*):
                Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
                is not used.
            force_download (`bool`, *optional*, defaults to `False`):
                Whether or not to force the (re-)download of the model weights and configuration files, overriding the
                cached versions if they exist.

            proxies (`Dict[str, str]`, *optional*):
                A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
                'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
            local_files_only (`bool`, *optional*, defaults to `False`):
                Whether to only load local model weights and configuration files or not. If set to `True`, the model
                won't be downloaded from the Hub.
            token (`str` or *bool*, *optional*):
                The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
                `diffusers-cli login` (stored in `~/.huggingface`) is used.
            revision (`str`, *optional*, defaults to `"main"`):
                The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
                allowed by Git.
            low_cpu_mem_usage (`bool`, *optional*, defaults to `True` if torch version >= 1.9.0 else `False`):
                Speed up model loading only loading the pretrained weights and not initializing the weights. This also
                tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model.
                Only supported for PyTorch >= 1.9.0. If you are using an older version of PyTorch, setting this
                argument to `True` will raise an error.
        """

        # handle the list inputs for multiple IP Adapters
        if not isinstance(weight_name, list):
            weight_name = [weight_name]

        if not isinstance(pretrained_model_name_or_path_or_dict, list):
            pretrained_model_name_or_path_or_dict = [pretrained_model_name_or_path_or_dict]
        if len(pretrained_model_name_or_path_or_dict) == 1:
            pretrained_model_name_or_path_or_dict = pretrained_model_name_or_path_or_dict * len(weight_name)

        if not isinstance(subfolder, list):
            subfolder = [subfolder]
        if len(subfolder) == 1:
            subfolder = subfolder * len(weight_name)

        if len(weight_name) != len(pretrained_model_name_or_path_or_dict):
            raise ValueError("`weight_name` and `pretrained_model_name_or_path_or_dict` must have the same length.")

        if len(weight_name) != len(subfolder):
            raise ValueError("`weight_name` and `subfolder` must have the same length.")

        # Load the main state dict first.
        cache_dir = kwargs.pop("cache_dir", None)
        force_download = kwargs.pop("fo
Download .txt
gitextract_693itit8/

├── .gitignore
├── LICENSE
├── README.md
├── environment.yml
├── run_stable_flow.py
├── setup.py
└── src/
    └── diffusers/
        ├── __init__.py
        ├── callbacks.py
        ├── commands/
        │   ├── __init__.py
        │   ├── diffusers_cli.py
        │   ├── env.py
        │   └── fp16_safetensors.py
        ├── configuration_utils.py
        ├── dependency_versions_check.py
        ├── dependency_versions_table.py
        ├── experimental/
        │   ├── README.md
        │   ├── __init__.py
        │   └── rl/
        │       ├── __init__.py
        │       └── value_guided_sampling.py
        ├── image_processor.py
        ├── loaders/
        │   ├── __init__.py
        │   ├── ip_adapter.py
        │   ├── lora_base.py
        │   ├── lora_conversion_utils.py
        │   ├── lora_pipeline.py
        │   ├── peft.py
        │   ├── single_file.py
        │   ├── single_file_model.py
        │   ├── single_file_utils.py
        │   ├── textual_inversion.py
        │   ├── unet.py
        │   ├── unet_loader_utils.py
        │   └── utils.py
        ├── models/
        │   ├── README.md
        │   ├── __init__.py
        │   ├── activations.py
        │   ├── adapter.py
        │   ├── attention.py
        │   ├── attention_flax.py
        │   ├── attention_processor.py
        │   ├── autoencoders/
        │   │   ├── __init__.py
        │   │   ├── autoencoder_asym_kl.py
        │   │   ├── autoencoder_kl.py
        │   │   ├── autoencoder_kl_cogvideox.py
        │   │   ├── autoencoder_kl_temporal_decoder.py
        │   │   ├── autoencoder_oobleck.py
        │   │   ├── autoencoder_tiny.py
        │   │   ├── consistency_decoder_vae.py
        │   │   ├── vae.py
        │   │   └── vq_model.py
        │   ├── controlnet.py
        │   ├── controlnet_flax.py
        │   ├── controlnet_hunyuan.py
        │   ├── controlnet_sd3.py
        │   ├── controlnet_sparsectrl.py
        │   ├── controlnet_xs.py
        │   ├── downsampling.py
        │   ├── embeddings.py
        │   ├── embeddings_flax.py
        │   ├── lora.py
        │   ├── model_loading_utils.py
        │   ├── modeling_flax_pytorch_utils.py
        │   ├── modeling_flax_utils.py
        │   ├── modeling_outputs.py
        │   ├── modeling_pytorch_flax_utils.py
        │   ├── modeling_utils.py
        │   ├── normalization.py
        │   ├── resnet.py
        │   ├── resnet_flax.py
        │   ├── transformers/
        │   │   ├── __init__.py
        │   │   ├── auraflow_transformer_2d.py
        │   │   ├── cogvideox_transformer_3d.py
        │   │   ├── dit_transformer_2d.py
        │   │   ├── dual_transformer_2d.py
        │   │   ├── hunyuan_transformer_2d.py
        │   │   ├── latte_transformer_3d.py
        │   │   ├── lumina_nextdit2d.py
        │   │   ├── pixart_transformer_2d.py
        │   │   ├── prior_transformer.py
        │   │   ├── stable_audio_transformer.py
        │   │   ├── t5_film_transformer.py
        │   │   ├── transformer_2d.py
        │   │   ├── transformer_flux.py
        │   │   ├── transformer_sd3.py
        │   │   └── transformer_temporal.py
        │   ├── unets/
        │   │   ├── __init__.py
        │   │   ├── unet_1d.py
        │   │   ├── unet_1d_blocks.py
        │   │   ├── unet_2d.py
        │   │   ├── unet_2d_blocks.py
        │   │   ├── unet_2d_blocks_flax.py
        │   │   ├── unet_2d_condition.py
        │   │   ├── unet_2d_condition_flax.py
        │   │   ├── unet_3d_blocks.py
        │   │   ├── unet_3d_condition.py
        │   │   ├── unet_i2vgen_xl.py
        │   │   ├── unet_kandinsky3.py
        │   │   ├── unet_motion_model.py
        │   │   ├── unet_spatio_temporal_condition.py
        │   │   ├── unet_stable_cascade.py
        │   │   └── uvit_2d.py
        │   ├── upsampling.py
        │   ├── vae_flax.py
        │   └── vq_model.py
        ├── optimization.py
        ├── pipelines/
        │   ├── README.md
        │   ├── __init__.py
        │   ├── amused/
        │   │   ├── __init__.py
        │   │   ├── pipeline_amused.py
        │   │   ├── pipeline_amused_img2img.py
        │   │   └── pipeline_amused_inpaint.py
        │   ├── animatediff/
        │   │   ├── __init__.py
        │   │   ├── pipeline_animatediff.py
        │   │   ├── pipeline_animatediff_controlnet.py
        │   │   ├── pipeline_animatediff_sdxl.py
        │   │   ├── pipeline_animatediff_sparsectrl.py
        │   │   ├── pipeline_animatediff_video2video.py
        │   │   └── pipeline_output.py
        │   ├── audioldm/
        │   │   ├── __init__.py
        │   │   └── pipeline_audioldm.py
        │   ├── audioldm2/
        │   │   ├── __init__.py
        │   │   ├── modeling_audioldm2.py
        │   │   └── pipeline_audioldm2.py
        │   ├── aura_flow/
        │   │   ├── __init__.py
        │   │   └── pipeline_aura_flow.py
        │   ├── auto_pipeline.py
        │   ├── blip_diffusion/
        │   │   ├── __init__.py
        │   │   ├── blip_image_processing.py
        │   │   ├── modeling_blip2.py
        │   │   ├── modeling_ctx_clip.py
        │   │   └── pipeline_blip_diffusion.py
        │   ├── cogvideo/
        │   │   ├── __init__.py
        │   │   └── pipeline_cogvideox.py
        │   ├── consistency_models/
        │   │   ├── __init__.py
        │   │   └── pipeline_consistency_models.py
        │   ├── controlnet/
        │   │   ├── __init__.py
        │   │   ├── multicontrolnet.py
        │   │   ├── pipeline_controlnet.py
        │   │   ├── pipeline_controlnet_blip_diffusion.py
        │   │   ├── pipeline_controlnet_img2img.py
        │   │   ├── pipeline_controlnet_inpaint.py
        │   │   ├── pipeline_controlnet_inpaint_sd_xl.py
        │   │   ├── pipeline_controlnet_sd_xl.py
        │   │   ├── pipeline_controlnet_sd_xl_img2img.py
        │   │   └── pipeline_flax_controlnet.py
        │   ├── controlnet_hunyuandit/
        │   │   ├── __init__.py
        │   │   └── pipeline_hunyuandit_controlnet.py
        │   ├── controlnet_sd3/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_3_controlnet.py
        │   ├── controlnet_xs/
        │   │   ├── __init__.py
        │   │   ├── pipeline_controlnet_xs.py
        │   │   └── pipeline_controlnet_xs_sd_xl.py
        │   ├── dance_diffusion/
        │   │   ├── __init__.py
        │   │   └── pipeline_dance_diffusion.py
        │   ├── ddim/
        │   │   ├── __init__.py
        │   │   └── pipeline_ddim.py
        │   ├── ddpm/
        │   │   ├── __init__.py
        │   │   └── pipeline_ddpm.py
        │   ├── deepfloyd_if/
        │   │   ├── __init__.py
        │   │   ├── pipeline_if.py
        │   │   ├── pipeline_if_img2img.py
        │   │   ├── pipeline_if_img2img_superresolution.py
        │   │   ├── pipeline_if_inpainting.py
        │   │   ├── pipeline_if_inpainting_superresolution.py
        │   │   ├── pipeline_if_superresolution.py
        │   │   ├── pipeline_output.py
        │   │   ├── safety_checker.py
        │   │   ├── timesteps.py
        │   │   └── watermark.py
        │   ├── deprecated/
        │   │   ├── README.md
        │   │   ├── __init__.py
        │   │   ├── alt_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── modeling_roberta_series.py
        │   │   │   ├── pipeline_alt_diffusion.py
        │   │   │   ├── pipeline_alt_diffusion_img2img.py
        │   │   │   └── pipeline_output.py
        │   │   ├── audio_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── mel.py
        │   │   │   └── pipeline_audio_diffusion.py
        │   │   ├── latent_diffusion_uncond/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_latent_diffusion_uncond.py
        │   │   ├── pndm/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_pndm.py
        │   │   ├── repaint/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_repaint.py
        │   │   ├── score_sde_ve/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_score_sde_ve.py
        │   │   ├── spectrogram_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── continuous_encoder.py
        │   │   │   ├── midi_utils.py
        │   │   │   ├── notes_encoder.py
        │   │   │   └── pipeline_spectrogram_diffusion.py
        │   │   ├── stable_diffusion_variants/
        │   │   │   ├── __init__.py
        │   │   │   ├── pipeline_cycle_diffusion.py
        │   │   │   ├── pipeline_onnx_stable_diffusion_inpaint_legacy.py
        │   │   │   ├── pipeline_stable_diffusion_inpaint_legacy.py
        │   │   │   ├── pipeline_stable_diffusion_model_editing.py
        │   │   │   ├── pipeline_stable_diffusion_paradigms.py
        │   │   │   └── pipeline_stable_diffusion_pix2pix_zero.py
        │   │   ├── stochastic_karras_ve/
        │   │   │   ├── __init__.py
        │   │   │   └── pipeline_stochastic_karras_ve.py
        │   │   ├── versatile_diffusion/
        │   │   │   ├── __init__.py
        │   │   │   ├── modeling_text_unet.py
        │   │   │   ├── pipeline_versatile_diffusion.py
        │   │   │   ├── pipeline_versatile_diffusion_dual_guided.py
        │   │   │   ├── pipeline_versatile_diffusion_image_variation.py
        │   │   │   └── pipeline_versatile_diffusion_text_to_image.py
        │   │   └── vq_diffusion/
        │   │       ├── __init__.py
        │   │       └── pipeline_vq_diffusion.py
        │   ├── dit/
        │   │   ├── __init__.py
        │   │   └── pipeline_dit.py
        │   ├── flux/
        │   │   ├── __init__.py
        │   │   ├── pipeline_flux.py
        │   │   └── pipeline_output.py
        │   ├── free_init_utils.py
        │   ├── free_noise_utils.py
        │   ├── hunyuandit/
        │   │   ├── __init__.py
        │   │   └── pipeline_hunyuandit.py
        │   ├── i2vgen_xl/
        │   │   ├── __init__.py
        │   │   └── pipeline_i2vgen_xl.py
        │   ├── kandinsky/
        │   │   ├── __init__.py
        │   │   ├── pipeline_kandinsky.py
        │   │   ├── pipeline_kandinsky_combined.py
        │   │   ├── pipeline_kandinsky_img2img.py
        │   │   ├── pipeline_kandinsky_inpaint.py
        │   │   ├── pipeline_kandinsky_prior.py
        │   │   └── text_encoder.py
        │   ├── kandinsky2_2/
        │   │   ├── __init__.py
        │   │   ├── pipeline_kandinsky2_2.py
        │   │   ├── pipeline_kandinsky2_2_combined.py
        │   │   ├── pipeline_kandinsky2_2_controlnet.py
        │   │   ├── pipeline_kandinsky2_2_controlnet_img2img.py
        │   │   ├── pipeline_kandinsky2_2_img2img.py
        │   │   ├── pipeline_kandinsky2_2_inpainting.py
        │   │   ├── pipeline_kandinsky2_2_prior.py
        │   │   └── pipeline_kandinsky2_2_prior_emb2emb.py
        │   ├── kandinsky3/
        │   │   ├── __init__.py
        │   │   ├── convert_kandinsky3_unet.py
        │   │   ├── pipeline_kandinsky3.py
        │   │   └── pipeline_kandinsky3_img2img.py
        │   ├── kolors/
        │   │   ├── __init__.py
        │   │   ├── pipeline_kolors.py
        │   │   ├── pipeline_kolors_img2img.py
        │   │   ├── pipeline_output.py
        │   │   ├── text_encoder.py
        │   │   └── tokenizer.py
        │   ├── latent_consistency_models/
        │   │   ├── __init__.py
        │   │   ├── pipeline_latent_consistency_img2img.py
        │   │   └── pipeline_latent_consistency_text2img.py
        │   ├── latent_diffusion/
        │   │   ├── __init__.py
        │   │   ├── pipeline_latent_diffusion.py
        │   │   └── pipeline_latent_diffusion_superresolution.py
        │   ├── latte/
        │   │   ├── __init__.py
        │   │   └── pipeline_latte.py
        │   ├── ledits_pp/
        │   │   ├── __init__.py
        │   │   ├── pipeline_leditspp_stable_diffusion.py
        │   │   ├── pipeline_leditspp_stable_diffusion_xl.py
        │   │   └── pipeline_output.py
        │   ├── lumina/
        │   │   ├── __init__.py
        │   │   └── pipeline_lumina.py
        │   ├── marigold/
        │   │   ├── __init__.py
        │   │   ├── marigold_image_processing.py
        │   │   ├── pipeline_marigold_depth.py
        │   │   └── pipeline_marigold_normals.py
        │   ├── musicldm/
        │   │   ├── __init__.py
        │   │   └── pipeline_musicldm.py
        │   ├── onnx_utils.py
        │   ├── pag/
        │   │   ├── __init__.py
        │   │   ├── pag_utils.py
        │   │   ├── pipeline_pag_controlnet_sd.py
        │   │   ├── pipeline_pag_controlnet_sd_xl.py
        │   │   ├── pipeline_pag_hunyuandit.py
        │   │   ├── pipeline_pag_kolors.py
        │   │   ├── pipeline_pag_pixart_sigma.py
        │   │   ├── pipeline_pag_sd.py
        │   │   ├── pipeline_pag_sd_3.py
        │   │   ├── pipeline_pag_sd_animatediff.py
        │   │   ├── pipeline_pag_sd_xl.py
        │   │   ├── pipeline_pag_sd_xl_img2img.py
        │   │   └── pipeline_pag_sd_xl_inpaint.py
        │   ├── paint_by_example/
        │   │   ├── __init__.py
        │   │   ├── image_encoder.py
        │   │   └── pipeline_paint_by_example.py
        │   ├── pia/
        │   │   ├── __init__.py
        │   │   └── pipeline_pia.py
        │   ├── pipeline_flax_utils.py
        │   ├── pipeline_loading_utils.py
        │   ├── pipeline_utils.py
        │   ├── pixart_alpha/
        │   │   ├── __init__.py
        │   │   ├── pipeline_pixart_alpha.py
        │   │   └── pipeline_pixart_sigma.py
        │   ├── semantic_stable_diffusion/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   └── pipeline_semantic_stable_diffusion.py
        │   ├── shap_e/
        │   │   ├── __init__.py
        │   │   ├── camera.py
        │   │   ├── pipeline_shap_e.py
        │   │   ├── pipeline_shap_e_img2img.py
        │   │   └── renderer.py
        │   ├── stable_audio/
        │   │   ├── __init__.py
        │   │   ├── modeling_stable_audio.py
        │   │   └── pipeline_stable_audio.py
        │   ├── stable_cascade/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_cascade.py
        │   │   ├── pipeline_stable_cascade_combined.py
        │   │   └── pipeline_stable_cascade_prior.py
        │   ├── stable_diffusion/
        │   │   ├── README.md
        │   │   ├── __init__.py
        │   │   ├── clip_image_project_model.py
        │   │   ├── convert_from_ckpt.py
        │   │   ├── pipeline_flax_stable_diffusion.py
        │   │   ├── pipeline_flax_stable_diffusion_img2img.py
        │   │   ├── pipeline_flax_stable_diffusion_inpaint.py
        │   │   ├── pipeline_onnx_stable_diffusion.py
        │   │   ├── pipeline_onnx_stable_diffusion_img2img.py
        │   │   ├── pipeline_onnx_stable_diffusion_inpaint.py
        │   │   ├── pipeline_onnx_stable_diffusion_upscale.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion.py
        │   │   ├── pipeline_stable_diffusion_depth2img.py
        │   │   ├── pipeline_stable_diffusion_image_variation.py
        │   │   ├── pipeline_stable_diffusion_img2img.py
        │   │   ├── pipeline_stable_diffusion_inpaint.py
        │   │   ├── pipeline_stable_diffusion_instruct_pix2pix.py
        │   │   ├── pipeline_stable_diffusion_latent_upscale.py
        │   │   ├── pipeline_stable_diffusion_upscale.py
        │   │   ├── pipeline_stable_unclip.py
        │   │   ├── pipeline_stable_unclip_img2img.py
        │   │   ├── safety_checker.py
        │   │   ├── safety_checker_flax.py
        │   │   └── stable_unclip_image_normalizer.py
        │   ├── stable_diffusion_3/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion_3.py
        │   │   ├── pipeline_stable_diffusion_3_img2img.py
        │   │   └── pipeline_stable_diffusion_3_inpaint.py
        │   ├── stable_diffusion_attend_and_excite/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_attend_and_excite.py
        │   ├── stable_diffusion_diffedit/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_diffedit.py
        │   ├── stable_diffusion_gligen/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_diffusion_gligen.py
        │   │   └── pipeline_stable_diffusion_gligen_text_image.py
        │   ├── stable_diffusion_k_diffusion/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_diffusion_k_diffusion.py
        │   │   └── pipeline_stable_diffusion_xl_k_diffusion.py
        │   ├── stable_diffusion_ldm3d/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_ldm3d.py
        │   ├── stable_diffusion_panorama/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_panorama.py
        │   ├── stable_diffusion_safe/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion_safe.py
        │   │   └── safety_checker.py
        │   ├── stable_diffusion_sag/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_diffusion_sag.py
        │   ├── stable_diffusion_xl/
        │   │   ├── __init__.py
        │   │   ├── pipeline_flax_stable_diffusion_xl.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_stable_diffusion_xl.py
        │   │   ├── pipeline_stable_diffusion_xl_img2img.py
        │   │   ├── pipeline_stable_diffusion_xl_inpaint.py
        │   │   ├── pipeline_stable_diffusion_xl_instruct_pix2pix.py
        │   │   └── watermark.py
        │   ├── stable_video_diffusion/
        │   │   ├── __init__.py
        │   │   └── pipeline_stable_video_diffusion.py
        │   ├── t2i_adapter/
        │   │   ├── __init__.py
        │   │   ├── pipeline_stable_diffusion_adapter.py
        │   │   └── pipeline_stable_diffusion_xl_adapter.py
        │   ├── text_to_video_synthesis/
        │   │   ├── __init__.py
        │   │   ├── pipeline_output.py
        │   │   ├── pipeline_text_to_video_synth.py
        │   │   ├── pipeline_text_to_video_synth_img2img.py
        │   │   ├── pipeline_text_to_video_zero.py
        │   │   └── pipeline_text_to_video_zero_sdxl.py
        │   ├── unclip/
        │   │   ├── __init__.py
        │   │   ├── pipeline_unclip.py
        │   │   ├── pipeline_unclip_image_variation.py
        │   │   └── text_proj.py
        │   ├── unidiffuser/
        │   │   ├── __init__.py
        │   │   ├── modeling_text_decoder.py
        │   │   ├── modeling_uvit.py
        │   │   └── pipeline_unidiffuser.py
        │   └── wuerstchen/
        │       ├── __init__.py
        │       ├── modeling_paella_vq_model.py
        │       ├── modeling_wuerstchen_common.py
        │       ├── modeling_wuerstchen_diffnext.py
        │       ├── modeling_wuerstchen_prior.py
        │       ├── pipeline_wuerstchen.py
        │       ├── pipeline_wuerstchen_combined.py
        │       └── pipeline_wuerstchen_prior.py
        ├── py.typed
        ├── schedulers/
        │   ├── README.md
        │   ├── __init__.py
        │   ├── deprecated/
        │   │   ├── __init__.py
        │   │   ├── scheduling_karras_ve.py
        │   │   └── scheduling_sde_vp.py
        │   ├── scheduling_amused.py
        │   ├── scheduling_consistency_decoder.py
        │   ├── scheduling_consistency_models.py
        │   ├── scheduling_cosine_dpmsolver_multistep.py
        │   ├── scheduling_ddim.py
        │   ├── scheduling_ddim_cogvideox.py
        │   ├── scheduling_ddim_flax.py
        │   ├── scheduling_ddim_inverse.py
        │   ├── scheduling_ddim_parallel.py
        │   ├── scheduling_ddpm.py
        │   ├── scheduling_ddpm_flax.py
        │   ├── scheduling_ddpm_parallel.py
        │   ├── scheduling_ddpm_wuerstchen.py
        │   ├── scheduling_deis_multistep.py
        │   ├── scheduling_dpm_cogvideox.py
        │   ├── scheduling_dpmsolver_multistep.py
        │   ├── scheduling_dpmsolver_multistep_flax.py
        │   ├── scheduling_dpmsolver_multistep_inverse.py
        │   ├── scheduling_dpmsolver_sde.py
        │   ├── scheduling_dpmsolver_singlestep.py
        │   ├── scheduling_edm_dpmsolver_multistep.py
        │   ├── scheduling_edm_euler.py
        │   ├── scheduling_euler_ancestral_discrete.py
        │   ├── scheduling_euler_discrete.py
        │   ├── scheduling_euler_discrete_flax.py
        │   ├── scheduling_flow_match_euler_discrete.py
        │   ├── scheduling_flow_match_heun_discrete.py
        │   ├── scheduling_heun_discrete.py
        │   ├── scheduling_ipndm.py
        │   ├── scheduling_k_dpm_2_ancestral_discrete.py
        │   ├── scheduling_k_dpm_2_discrete.py
        │   ├── scheduling_karras_ve_flax.py
        │   ├── scheduling_lcm.py
        │   ├── scheduling_lms_discrete.py
        │   ├── scheduling_lms_discrete_flax.py
        │   ├── scheduling_pndm.py
        │   ├── scheduling_pndm_flax.py
        │   ├── scheduling_repaint.py
        │   ├── scheduling_sasolver.py
        │   ├── scheduling_sde_ve.py
        │   ├── scheduling_sde_ve_flax.py
        │   ├── scheduling_tcd.py
        │   ├── scheduling_unclip.py
        │   ├── scheduling_unipc_multistep.py
        │   ├── scheduling_utils.py
        │   ├── scheduling_utils_flax.py
        │   └── scheduling_vq_diffusion.py
        ├── training_utils.py
        ├── utils/
        │   ├── __init__.py
        │   ├── accelerate_utils.py
        │   ├── constants.py
        │   ├── deprecation_utils.py
        │   ├── doc_utils.py
        │   ├── dummy_flax_and_transformers_objects.py
        │   ├── dummy_flax_objects.py
        │   ├── dummy_note_seq_objects.py
        │   ├── dummy_onnx_objects.py
        │   ├── dummy_pt_objects.py
        │   ├── dummy_torch_and_librosa_objects.py
        │   ├── dummy_torch_and_scipy_objects.py
        │   ├── dummy_torch_and_torchsde_objects.py
        │   ├── dummy_torch_and_transformers_and_k_diffusion_objects.py
        │   ├── dummy_torch_and_transformers_and_onnx_objects.py
        │   ├── dummy_torch_and_transformers_and_sentencepiece_objects.py
        │   ├── dummy_torch_and_transformers_objects.py
        │   ├── dummy_transformers_and_torch_and_note_seq_objects.py
        │   ├── dynamic_modules_utils.py
        │   ├── export_utils.py
        │   ├── hub_utils.py
        │   ├── import_utils.py
        │   ├── loading_utils.py
        │   ├── logging.py
        │   ├── model_card_template.md
        │   ├── outputs.py
        │   ├── peft_utils.py
        │   ├── pil_utils.py
        │   ├── state_dict_utils.py
        │   ├── testing_utils.py
        │   ├── torch_utils.py
        │   └── versions.py
        └── video_processor.py
Download .txt
Showing preview only (546K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (6563 symbols across 386 files)

FILE: run_stable_flow.py
  class StableFlow (line 9) | class StableFlow:
    method __init__ (line 13) | def __init__(self):
    method _parse_args (line 17) | def _parse_args(self):
    method _load_pipeline (line 32) | def _load_pipeline(self):
    method infer_and_save (line 46) | def infer_and_save(self, prompts):
    method image2latent (line 70) | def image2latent(self, image, latent_nudging_scalar = 1.15):
    method invert_and_save (line 87) | def invert_and_save(self, prompts):

FILE: setup.py
  function deps_list (line 165) | def deps_list(*pkgs):
  class DepsTableUpdateCommand (line 169) | class DepsTableUpdateCommand(Command):
    method initialize_options (line 185) | def initialize_options(self):
    method finalize_options (line 188) | def finalize_options(self):
    method run (line 191) | def run(self):

FILE: src/diffusers/callbacks.py
  class PipelineCallback (line 7) | class PipelineCallback(ConfigMixin):
    method __init__ (line 22) | def __init__(self, cutoff_step_ratio=1.0, cutoff_step_index=None):
    method tensor_inputs (line 36) | def tensor_inputs(self) -> List[str]:
    method callback_fn (line 39) | def callback_fn(self, pipeline, step_index, timesteps, callback_kwargs...
    method __call__ (line 42) | def __call__(self, pipeline, step_index, timestep, callback_kwargs) ->...
  class MultiPipelineCallbacks (line 46) | class MultiPipelineCallbacks:
    method __init__ (line 52) | def __init__(self, callbacks: List[PipelineCallback]):
    method tensor_inputs (line 56) | def tensor_inputs(self) -> List[str]:
    method __call__ (line 59) | def __call__(self, pipeline, step_index, timestep, callback_kwargs) ->...
  class SDCFGCutoffCallback (line 69) | class SDCFGCutoffCallback(PipelineCallback):
    method callback_fn (line 79) | def callback_fn(self, pipeline, step_index, timestep, callback_kwargs)...
  class SDXLCFGCutoffCallback (line 98) | class SDXLCFGCutoffCallback(PipelineCallback):
    method callback_fn (line 108) | def callback_fn(self, pipeline, step_index, timestep, callback_kwargs)...
  class IPAdapterScaleCutoffCallback (line 135) | class IPAdapterScaleCutoffCallback(PipelineCallback):
    method callback_fn (line 145) | def callback_fn(self, pipeline, step_index, timestep, callback_kwargs)...

FILE: src/diffusers/commands/__init__.py
  class BaseDiffusersCLICommand (line 19) | class BaseDiffusersCLICommand(ABC):
    method register_subcommand (line 22) | def register_subcommand(parser: ArgumentParser):
    method run (line 26) | def run(self):

FILE: src/diffusers/commands/diffusers_cli.py
  function main (line 22) | def main():

FILE: src/diffusers/commands/env.py
  function info_command_factory (line 36) | def info_command_factory(_):
  class EnvironmentCommand (line 40) | class EnvironmentCommand(BaseDiffusersCLICommand):
    method register_subcommand (line 42) | def register_subcommand(parser: ArgumentParser) -> None:
    method run (line 46) | def run(self) -> dict:
    method format_dict (line 179) | def format_dict(d: dict) -> str:

FILE: src/diffusers/commands/fp16_safetensors.py
  function conversion_command_factory (line 35) | def conversion_command_factory(args: Namespace):
  class FP16SafetensorsCommand (line 44) | class FP16SafetensorsCommand(BaseDiffusersCLICommand):
    method register_subcommand (line 46) | def register_subcommand(parser: ArgumentParser):
    method __init__ (line 66) | def __init__(self, ckpt_id: str, fp16: bool, use_safetensors: bool):
    method run (line 79) | def run(self):

FILE: src/diffusers/configuration_utils.py
  class FrozenDict (line 55) | class FrozenDict(OrderedDict):
    method __init__ (line 56) | def __init__(self, *args, **kwargs):
    method __delitem__ (line 64) | def __delitem__(self, *args, **kwargs):
    method setdefault (line 67) | def setdefault(self, *args, **kwargs):
    method pop (line 70) | def pop(self, *args, **kwargs):
    method update (line 73) | def update(self, *args, **kwargs):
    method __setattr__ (line 76) | def __setattr__(self, name, value):
    method __setitem__ (line 81) | def __setitem__(self, name, value):
  class ConfigMixin (line 87) | class ConfigMixin:
    method register_to_config (line 110) | def register_to_config(self, **kwargs):
    method __getattr__ (line 127) | def __getattr__(self, name: str) -> Any:
    method save_config (line 145) | def save_config(self, save_directory: Union[str, os.PathLike], push_to...
    method from_config (line 188) | def from_config(cls, config: Union[FrozenDict, Dict[str, Any]] = None,...
    method get_config_dict (line 278) | def get_config_dict(cls, *args, **kwargs):
    method load_config (line 288) | def load_config(
    method _get_init_keys (line 452) | def _get_init_keys(input_class):
    method extract_init_dict (line 456) | def extract_init_dict(cls, config_dict, **kwargs):
    method _dict_from_json_file (line 552) | def _dict_from_json_file(cls, json_file: Union[str, os.PathLike]):
    method __repr__ (line 557) | def __repr__(self):
    method config (line 561) | def config(self) -> Dict[str, Any]:
    method to_json_string (line 570) | def to_json_string(self) -> str:
    method to_json_file (line 596) | def to_json_file(self, json_file_path: Union[str, os.PathLike]):
  function register_to_config (line 608) | def register_to_config(init):
  function flax_register_to_config (line 658) | def flax_register_to_config(cls):
  class LegacyConfigMixin (line 706) | class LegacyConfigMixin(ConfigMixin):
    method from_config (line 713) | def from_config(cls, config: Union[FrozenDict, Dict[str, Any]] = None,...

FILE: src/diffusers/dependency_versions_check.py
  function dep_version_check (line 33) | def dep_version_check(pkg, hint=None):

FILE: src/diffusers/experimental/rl/value_guided_sampling.py
  class ValueGuidedRLPipeline (line 25) | class ValueGuidedRLPipeline(DiffusionPipeline):
    method __init__ (line 44) | def __init__(
    method normalize (line 71) | def normalize(self, x_in, key):
    method de_normalize (line 74) | def de_normalize(self, x_in, key):
    method to_torch (line 77) | def to_torch(self, x_in):
    method reset_x0 (line 84) | def reset_x0(self, x_in, cond, act_dim):
    method run_diffusion (line 89) | def run_diffusion(self, x, conditions, n_guide_steps, scale):
    method __call__ (line 122) | def __call__(self, obs, batch_size=64, planning_horizon=32, n_guide_st...

FILE: src/diffusers/image_processor.py
  function is_valid_image (line 41) | def is_valid_image(image):
  function is_valid_image_imagelist (line 45) | def is_valid_image_imagelist(images):
  class VaeImageProcessor (line 60) | class VaeImageProcessor(ConfigMixin):
    method __init__ (line 85) | def __init__(
    method numpy_to_pil (line 105) | def numpy_to_pil(images: np.ndarray) -> List[PIL.Image.Image]:
    method pil_to_numpy (line 121) | def pil_to_numpy(images: Union[List[PIL.Image.Image], PIL.Image.Image]...
    method numpy_to_pt (line 133) | def numpy_to_pt(images: np.ndarray) -> torch.Tensor:
    method pt_to_numpy (line 144) | def pt_to_numpy(images: torch.Tensor) -> np.ndarray:
    method normalize (line 152) | def normalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.nda...
    method denormalize (line 159) | def denormalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.n...
    method convert_to_rgb (line 166) | def convert_to_rgb(image: PIL.Image.Image) -> PIL.Image.Image:
    method convert_to_grayscale (line 175) | def convert_to_grayscale(image: PIL.Image.Image) -> PIL.Image.Image:
    method blur (line 184) | def blur(image: PIL.Image.Image, blur_factor: int = 4) -> PIL.Image.Im...
    method get_crop_region (line 193) | def get_crop_region(mask_image: PIL.Image.Image, width: int, height: i...
    method _resize_and_fill (line 282) | def _resize_and_fill(
    method _resize_and_crop (line 327) | def _resize_and_crop(
    method resize (line 353) | def resize(
    method binarize (line 409) | def binarize(self, image: PIL.Image.Image) -> PIL.Image.Image:
    method get_default_height_width (line 426) | def get_default_height_width(
    method preprocess (line 469) | def preprocess(
    method postprocess (line 596) | def postprocess(
    method apply_overlay (line 651) | def apply_overlay(
  class VaeImageProcessorLDM3D (line 687) | class VaeImageProcessorLDM3D(VaeImageProcessor):
    method __init__ (line 705) | def __init__(
    method numpy_to_pil (line 715) | def numpy_to_pil(images: np.ndarray) -> List[PIL.Image.Image]:
    method depth_pil_to_numpy (line 731) | def depth_pil_to_numpy(images: Union[List[PIL.Image.Image], PIL.Image....
    method rgblike_to_depthmap (line 743) | def rgblike_to_depthmap(image: Union[np.ndarray, torch.Tensor]) -> Uni...
    method numpy_to_depth (line 753) | def numpy_to_depth(self, images: np.ndarray) -> List[PIL.Image.Image]:
    method postprocess (line 773) | def postprocess(
    method preprocess (line 828) | def preprocess(
  class IPAdapterMaskProcessor (line 928) | class IPAdapterMaskProcessor(VaeImageProcessor):
    method __init__ (line 951) | def __init__(
    method downsample (line 970) | def downsample(mask: torch.Tensor, batch_size: int, num_queries: int, ...
  class PixArtImageProcessor (line 1032) | class PixArtImageProcessor(VaeImageProcessor):
    method __init__ (line 1055) | def __init__(
    method classify_height_width_bin (line 1074) | def classify_height_width_bin(height: int, width: int, ratios: dict) -...
    method resize_and_crop_tensor (line 1082) | def resize_and_crop_tensor(samples: torch.Tensor, new_width: int, new_...

FILE: src/diffusers/loaders/__init__.py
  function text_encoder_lora_state_dict (line 7) | def text_encoder_lora_state_dict(text_encoder):
  function text_encoder_attn_modules (line 33) | def text_encoder_attn_modules(text_encoder):

FILE: src/diffusers/loaders/ip_adapter.py
  class IPAdapterMixin (line 51) | class IPAdapterMixin:
    method load_ip_adapter (line 55) | def load_ip_adapter(
    method set_ip_adapter_scale (line 245) | def set_ip_adapter_scale(self, scale):
    method unload_ip_adapter (line 297) | def unload_ip_adapter(self):

FILE: src/diffusers/loaders/lora_base.py
  function fuse_text_encoder_lora (line 55) | def fuse_text_encoder_lora(text_encoder, lora_scale=1.0, safe_fusing=Fal...
  function unfuse_text_encoder_lora (line 91) | def unfuse_text_encoder_lora(text_encoder):
  function set_adapters_for_text_encoder (line 105) | def set_adapters_for_text_encoder(
  function disable_lora_for_text_encoder (line 149) | def disable_lora_for_text_encoder(text_encoder: Optional["PreTrainedMode...
  function enable_lora_for_text_encoder (line 163) | def enable_lora_for_text_encoder(text_encoder: Optional["PreTrainedModel...
  function _remove_text_encoder_monkey_patch (line 177) | def _remove_text_encoder_monkey_patch(text_encoder):
  class LoraBaseMixin (line 184) | class LoraBaseMixin:
    method load_lora_weights (line 190) | def load_lora_weights(self, **kwargs):
    method save_lora_weights (line 194) | def save_lora_weights(cls, **kwargs):
    method lora_state_dict (line 198) | def lora_state_dict(cls, **kwargs):
    method _optionally_disable_offloading (line 202) | def _optionally_disable_offloading(cls, _pipeline):
    method _fetch_state_dict (line 237) | def _fetch_state_dict(
    method _best_guess_weight_name (line 314) | def _best_guess_weight_name(
    method unload_lora_weights (line 356) | def unload_lora_weights(self):
    method fuse_lora (line 379) | def fuse_lora(
    method unfuse_lora (line 460) | def unfuse_lora(self, components: List[str] = [], **kwargs):
    method set_adapters (line 516) | def set_adapters(
    method disable_lora (line 577) | def disable_lora(self):
    method enable_lora (line 589) | def enable_lora(self):
    method delete_adapters (line 601) | def delete_adapters(self, adapter_names: Union[List[str], str]):
    method get_active_adapters (line 623) | def get_active_adapters(self) -> List[str]:
    method get_list_adapters (line 656) | def get_list_adapters(self) -> Dict[str, List[str]]:
    method set_lora_device (line 678) | def set_lora_device(self, adapter_names: List[str], device: Union[torc...
    method pack_weights (line 707) | def pack_weights(layers, prefix):
    method write_lora_layers (line 713) | def write_lora_layers(
    method lora_scale (line 749) | def lora_scale(self) -> float:

FILE: src/diffusers/loaders/lora_conversion_utils.py
  function _maybe_map_sgm_blocks_to_diffusers (line 23) | def _maybe_map_sgm_blocks_to_diffusers(state_dict, unet_config, delimite...
  function _convert_non_diffusers_lora_to_diffusers (line 126) | def _convert_non_diffusers_lora_to_diffusers(state_dict, unet_name="unet...
  function _convert_unet_lora_key (line 234) | def _convert_unet_lora_key(key):
  function _convert_text_encoder_lora_key (line 290) | def _convert_text_encoder_lora_key(key, lora_name):
  function _get_alpha_name (line 317) | def _get_alpha_name(lora_name_alpha, diffusers_name, alpha):

FILE: src/diffusers/loaders/lora_pipeline.py
  class StableDiffusionLoraLoaderMixin (line 50) | class StableDiffusionLoraLoaderMixin(LoraBaseMixin):
    method load_lora_weights (line 60) | def load_lora_weights(
    method lora_state_dict (line 121) | def lora_state_dict(
    method load_lora_into_unet (line 230) | def load_lora_into_unet(cls, state_dict, network_alphas, unet, adapter...
    method load_lora_into_text_encoder (line 265) | def load_lora_into_text_encoder(
    method save_lora_weights (line 383) | def save_lora_weights(
    method fuse_lora (line 436) | def fuse_lora(
    method unfuse_lora (line 479) | def unfuse_lora(self, components: List[str] = ["unet", "text_encoder"]...
  class StableDiffusionXLLoraLoaderMixin (line 500) | class StableDiffusionXLLoraLoaderMixin(LoraBaseMixin):
    method load_lora_weights (line 511) | def load_lora_weights(
    method lora_state_dict (line 592) | def lora_state_dict(
    method load_lora_into_unet (line 702) | def load_lora_into_unet(cls, state_dict, network_alphas, unet, adapter...
    method load_lora_into_text_encoder (line 738) | def load_lora_into_text_encoder(
    method save_lora_weights (line 856) | def save_lora_weights(
    method fuse_lora (line 917) | def fuse_lora(
    method unfuse_lora (line 960) | def unfuse_lora(self, components: List[str] = ["unet", "text_encoder",...
  class SD3LoraLoaderMixin (line 981) | class SD3LoraLoaderMixin(LoraBaseMixin):
    method lora_state_dict (line 996) | def lora_state_dict(
    method load_lora_weights (line 1085) | def load_lora_weights(
    method load_lora_into_transformer (line 1155) | def load_lora_into_transformer(cls, state_dict, transformer, adapter_n...
    method load_lora_into_text_encoder (line 1234) | def load_lora_into_text_encoder(
    method save_lora_weights (line 1352) | def save_lora_weights(
    method fuse_lora (line 1414) | def fuse_lora(
    method unfuse_lora (line 1457) | def unfuse_lora(self, components: List[str] = ["transformer", "text_en...
  class FluxLoraLoaderMixin (line 1478) | class FluxLoraLoaderMixin(LoraBaseMixin):
    method lora_state_dict (line 1493) | def lora_state_dict(
    method load_lora_weights (line 1582) | def load_lora_weights(
    method load_lora_into_transformer (line 1641) | def load_lora_into_transformer(cls, state_dict, transformer, adapter_n...
    method load_lora_into_text_encoder (line 1720) | def load_lora_into_text_encoder(
    method save_lora_weights (line 1839) | def save_lora_weights(
    method fuse_lora (line 1893) | def fuse_lora(
    method unfuse_lora (line 1936) | def unfuse_lora(self, components: List[str] = ["transformer", "text_en...
  class AmusedLoraLoaderMixin (line 1955) | class AmusedLoraLoaderMixin(StableDiffusionLoraLoaderMixin):
    method load_lora_into_transformer (line 1961) | def load_lora_into_transformer(cls, state_dict, network_alphas, transf...
    method load_lora_into_text_encoder (line 2046) | def load_lora_into_text_encoder(
    method save_lora_weights (line 2164) | def save_lora_weights(
  class LoraLoaderMixin (line 2218) | class LoraLoaderMixin(StableDiffusionLoraLoaderMixin):
    method __init__ (line 2219) | def __init__(self, *args, **kwargs):

FILE: src/diffusers/loaders/peft.py
  class PeftAdapterMixin (line 39) | class PeftAdapterMixin:
    method set_adapters (line 55) | def set_adapters(
    method add_adapter (line 111) | def add_adapter(self, adapter_config, adapter_name: str = "default") -...
    method set_adapter (line 149) | def set_adapter(self, adapter_name: Union[str, List[str]]) -> None:
    method disable_adapters (line 198) | def disable_adapters(self) -> None:
    method enable_adapters (line 220) | def enable_adapters(self) -> None:
    method active_adapters (line 243) | def active_adapters(self) -> List[str]:
    method fuse_lora (line 264) | def fuse_lora(self, lora_scale=1.0, safe_fusing=False, adapter_names=N...
    method _fuse_lora_apply (line 272) | def _fuse_lora_apply(self, module, adapter_names=None):
    method unfuse_lora (line 294) | def unfuse_lora(self):
    method _unfuse_lora_apply (line 299) | def _unfuse_lora_apply(self, module):
    method unload_lora (line 305) | def unload_lora(self):
    method disable_lora (line 315) | def disable_lora(self):
    method enable_lora (line 338) | def enable_lora(self):
    method delete_adapters (line 361) | def delete_adapters(self, adapter_names: Union[List[str], str]):

FILE: src/diffusers/loaders/single_file.py
  function load_single_file_sub_model (line 51) | def load_single_file_sub_model(
  function _map_component_types_to_config_dict (line 178) | def _map_component_types_to_config_dict(component_types):
  function _infer_pipeline_config_dict (line 227) | def _infer_pipeline_config_dict(pipeline_class):
  function _download_diffusers_model_config_from_hub (line 239) | def _download_diffusers_model_config_from_hub(
  class FromSingleFileMixin (line 263) | class FromSingleFileMixin:
    method from_single_file (line 270) | def from_single_file(cls, pretrained_model_link_or_path, **kwargs):

FILE: src/diffusers/loaders/single_file_model.py
  function _get_single_file_loadable_mapping_class (line 88) | def _get_single_file_loadable_mapping_class(cls):
  function _get_mapping_function_kwargs (line 99) | def _get_mapping_function_kwargs(mapping_fn, **kwargs):
  class FromOriginalModelMixin (line 110) | class FromOriginalModelMixin:
    method from_single_file (line 117) | def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optio...

FILE: src/diffusers/loaders/single_file_utils.py
  class SingleFileComponentError (line 276) | class SingleFileComponentError(Exception):
    method __init__ (line 277) | def __init__(self, message=None):
  function is_valid_url (line 282) | def is_valid_url(url):
  function _extract_repo_id_and_weights_name (line 290) | def _extract_repo_id_and_weights_name(pretrained_model_name_or_path):
  function _is_model_weights_in_cached_folder (line 310) | def _is_model_weights_in_cached_folder(cached_folder, name):
  function load_single_file_checkpoint (line 321) | def load_single_file_checkpoint(
  function fetch_original_config (line 355) | def fetch_original_config(original_config_file, local_files_only=False):
  function is_clip_model (line 377) | def is_clip_model(checkpoint):
  function is_clip_sdxl_model (line 384) | def is_clip_sdxl_model(checkpoint):
  function is_clip_sd3_model (line 391) | def is_clip_sd3_model(checkpoint):
  function is_open_clip_model (line 398) | def is_open_clip_model(checkpoint):
  function is_open_clip_sdxl_model (line 405) | def is_open_clip_sdxl_model(checkpoint):
  function is_open_clip_sd3_model (line 412) | def is_open_clip_sd3_model(checkpoint):
  function is_open_clip_sdxl_refiner_model (line 419) | def is_open_clip_sdxl_refiner_model(checkpoint):
  function is_clip_model_in_single_file (line 426) | def is_clip_model_in_single_file(class_obj, checkpoint):
  function infer_diffusers_model_type (line 445) | def infer_diffusers_model_type(checkpoint):
  function fetch_diffusers_config (line 530) | def fetch_diffusers_config(checkpoint):
  function set_image_size (line 537) | def set_image_size(checkpoint, image_size=None):
  function conv_attn_to_linear (line 548) | def conv_attn_to_linear(checkpoint):
  function create_unet_diffusers_config_from_ldm (line 560) | def create_unet_diffusers_config_from_ldm(
  function create_controlnet_diffusers_config_from_ldm (line 691) | def create_controlnet_diffusers_config_from_ldm(original_config, checkpo...
  function create_vae_diffusers_config_from_ldm (line 723) | def create_vae_diffusers_config_from_ldm(original_config, checkpoint, im...
  function update_unet_resnet_ldm_to_diffusers (line 774) | def update_unet_resnet_ldm_to_diffusers(ldm_keys, new_checkpoint, checkp...
  function update_unet_attention_ldm_to_diffusers (line 789) | def update_unet_attention_ldm_to_diffusers(ldm_keys, new_checkpoint, che...
  function update_vae_resnet_ldm_to_diffusers (line 795) | def update_vae_resnet_ldm_to_diffusers(keys, new_checkpoint, checkpoint,...
  function update_vae_attentions_ldm_to_diffusers (line 801) | def update_vae_attentions_ldm_to_diffusers(keys, new_checkpoint, checkpo...
  function convert_stable_cascade_unet_single_file_to_diffusers (line 827) | def convert_stable_cascade_unet_single_file_to_diffusers(checkpoint, **k...
  function convert_ldm_unet_checkpoint (line 883) | def convert_ldm_unet_checkpoint(checkpoint, config, extract_ema=False, *...
  function convert_controlnet_checkpoint (line 1050) | def convert_controlnet_checkpoint(
  function convert_ldm_vae_checkpoint (line 1174) | def convert_ldm_vae_checkpoint(checkpoint, config):
  function convert_ldm_clip_checkpoint (line 1274) | def convert_ldm_clip_checkpoint(checkpoint, remove_prefix=None):
  function convert_open_clip_checkpoint (line 1292) | def convert_open_clip_checkpoint(
  function create_diffusers_clip_model_from_ldm (line 1358) | def create_diffusers_clip_model_from_ldm(
  function _legacy_load_scheduler (line 1468) | def _legacy_load_scheduler(
  function _legacy_load_clip_tokenizer (line 1598) | def _legacy_load_clip_tokenizer(cls, checkpoint, config=None, local_file...
  function _legacy_load_safety_checker (line 1624) | def _legacy_load_safety_checker(local_files_only, torch_dtype):
  function swap_scale_shift (line 1642) | def swap_scale_shift(weight, dim):
  function convert_sd3_transformer_checkpoint_to_diffusers (line 1648) | def convert_sd3_transformer_checkpoint_to_diffusers(checkpoint, **kwargs):
  function is_t5_in_single_file (line 1792) | def is_t5_in_single_file(checkpoint):
  function convert_sd3_t5_checkpoint_to_diffusers (line 1799) | def convert_sd3_t5_checkpoint_to_diffusers(checkpoint):
  function create_diffusers_t5_model_from_checkpoint (line 1814) | def create_diffusers_t5_model_from_checkpoint(
  function convert_animatediff_checkpoint_to_diffusers (line 1863) | def convert_animatediff_checkpoint_to_diffusers(checkpoint, **kwargs):
  function convert_flux_transformer_checkpoint_to_diffusers (line 1882) | def convert_flux_transformer_checkpoint_to_diffusers(checkpoint, **kwargs):

FILE: src/diffusers/loaders/textual_inversion.py
  function load_textual_inversion_state_dicts (line 38) | def load_textual_inversion_state_dicts(pretrained_model_name_or_paths, *...
  class TextualInversionLoaderMixin (line 110) | class TextualInversionLoaderMixin:
    method maybe_convert_prompt (line 115) | def maybe_convert_prompt(self, prompt: Union[str, List[str]], tokenize...
    method _maybe_convert_prompt (line 142) | def _maybe_convert_prompt(self, prompt: str, tokenizer: "PreTrainedTok...
    method _check_text_inv_inputs (line 172) | def _check_text_inv_inputs(self, tokenizer, text_encoder, pretrained_m...
    method _retrieve_tokens_and_embeddings (line 196) | def _retrieve_tokens_and_embeddings(tokens, state_dicts, tokenizer):
    method _extend_tokens_and_embeddings (line 237) | def _extend_tokens_and_embeddings(tokens, embeddings, tokenizer):
    method load_textual_inversion (line 264) | def load_textual_inversion(
    method unload_textual_inversion (line 458) | def unload_textual_inversion(

FILE: src/diffusers/loaders/unet.py
  class UNet2DConditionLoadersMixin (line 60) | class UNet2DConditionLoadersMixin:
    method load_attn_procs (line 69) | def load_attn_procs(self, pretrained_model_name_or_path_or_dict: Union...
    method _process_custom_diffusion (line 237) | def _process_custom_diffusion(self, state_dict):
    method _process_lora (line 271) | def _process_lora(self, state_dict, unet_identifier_key, network_alpha...
    method _optionally_disable_offloading (line 355) | def _optionally_disable_offloading(cls, _pipeline):
    method save_attn_procs (line 389) | def save_attn_procs(
    method _get_custom_diffusion_state_dict (line 488) | def _get_custom_diffusion_state_dict(self):
    method _convert_ip_adapter_image_proj_to_diffusers (line 516) | def _convert_ip_adapter_image_proj_to_diffusers(self, state_dict, low_...
    method _convert_ip_adapter_attn_to_diffusers (line 733) | def _convert_ip_adapter_attn_to_diffusers(self, state_dicts, low_cpu_m...
    method _load_ip_adapter_weights (line 823) | def _load_ip_adapter_weights(self, state_dicts, low_cpu_mem_usage=False):
    method _load_ip_adapter_loras (line 855) | def _load_ip_adapter_loras(self, state_dicts):

FILE: src/diffusers/loaders/unet_loader_utils.py
  function _translate_into_actual_layer_name (line 27) | def _translate_into_actual_layer_name(name):
  function _maybe_expand_lora_scales (line 41) | def _maybe_expand_lora_scales(
  function _maybe_expand_lora_scales_for_one_adapter (line 64) | def _maybe_expand_lora_scales_for_one_adapter(

FILE: src/diffusers/loaders/utils.py
  class AttnProcsLayers (line 20) | class AttnProcsLayers(torch.nn.Module):
    method __init__ (line 21) | def __init__(self, state_dict: Dict[str, torch.Tensor]):

FILE: src/diffusers/models/activations.py
  function get_activation (line 36) | def get_activation(act_fn: str) -> nn.Module:
  class FP32SiLU (line 53) | class FP32SiLU(nn.Module):
    method __init__ (line 58) | def __init__(self):
    method forward (line 61) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class GELU (line 65) | class GELU(nn.Module):
    method __init__ (line 76) | def __init__(self, dim_in: int, dim_out: int, approximate: str = "none...
    method gelu (line 81) | def gelu(self, gate: torch.Tensor) -> torch.Tensor:
    method forward (line 87) | def forward(self, hidden_states):
  class GEGLU (line 93) | class GEGLU(nn.Module):
    method __init__ (line 103) | def __init__(self, dim_in: int, dim_out: int, bias: bool = True):
    method gelu (line 107) | def gelu(self, gate: torch.Tensor) -> torch.Tensor:
    method forward (line 113) | def forward(self, hidden_states, *args, **kwargs):
  class SwiGLU (line 126) | class SwiGLU(nn.Module):
    method __init__ (line 137) | def __init__(self, dim_in: int, dim_out: int, bias: bool = True):
    method forward (line 142) | def forward(self, hidden_states):
  class ApproximateGELU (line 148) | class ApproximateGELU(nn.Module):
    method __init__ (line 159) | def __init__(self, dim_in: int, dim_out: int, bias: bool = True):
    method forward (line 163) | def forward(self, x: torch.Tensor) -> torch.Tensor:

FILE: src/diffusers/models/adapter.py
  class MultiAdapter (line 28) | class MultiAdapter(ModelMixin):
    method __init__ (line 41) | def __init__(self, adapters: List["T2IAdapter"]):
    method forward (line 76) | def forward(self, xs: torch.Tensor, adapter_weights: Optional[List[flo...
    method save_pretrained (line 103) | def save_pretrained(
    method from_pretrained (line 146) | def from_pretrained(cls, pretrained_model_path: Optional[Union[str, os...
  class T2IAdapter (line 217) | class T2IAdapter(ModelMixin, ConfigMixin):
    method __init__ (line 245) | def __init__(
    method forward (line 267) | def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
    method total_downscale_factor (line 277) | def total_downscale_factor(self):
    method downscale_factor (line 281) | def downscale_factor(self):
  class FullAdapter (line 291) | class FullAdapter(nn.Module):
    method __init__ (line 296) | def __init__(
    method forward (line 322) | def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
  class FullAdapterXL (line 341) | class FullAdapterXL(nn.Module):
    method __init__ (line 346) | def __init__(
    method forward (line 374) | def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
  class AdapterBlock (line 391) | class AdapterBlock(nn.Module):
    method __init__ (line 407) | def __init__(self, in_channels: int, out_channels: int, num_res_blocks...
    method forward (line 422) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class AdapterResnetBlock (line 439) | class AdapterResnetBlock(nn.Module):
    method __init__ (line 448) | def __init__(self, channels: int):
    method forward (line 454) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class LightAdapter (line 469) | class LightAdapter(nn.Module):
    method __init__ (line 474) | def __init__(
    method forward (line 500) | def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
  class LightAdapterBlock (line 516) | class LightAdapterBlock(nn.Module):
    method __init__ (line 532) | def __init__(self, in_channels: int, out_channels: int, num_res_blocks...
    method forward (line 544) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class LightAdapterResnetBlock (line 559) | class LightAdapterResnetBlock(nn.Module):
    method __init__ (line 569) | def __init__(self, channels: int):
    method forward (line 575) | def forward(self, x: torch.Tensor) -> torch.Tensor:

FILE: src/diffusers/models/attention.py
  function _chunked_feed_forward (line 31) | def _chunked_feed_forward(ff: nn.Module, hidden_states: torch.Tensor, ch...
  class GatedSelfAttentionDense (line 47) | class GatedSelfAttentionDense(nn.Module):
    method __init__ (line 58) | def __init__(self, query_dim: int, context_dim: int, n_heads: int, d_h...
    method forward (line 75) | def forward(self, x: torch.Tensor, objs: torch.Tensor) -> torch.Tensor:
  class JointTransformerBlock (line 89) | class JointTransformerBlock(nn.Module):
    method __init__ (line 103) | def __init__(self, dim, num_attention_heads, attention_head_dim, conte...
    method set_chunk_feed_forward (line 154) | def set_chunk_feed_forward(self, chunk_size: Optional[int], dim: int =...
    method forward (line 159) | def forward(
  class BasicTransformerBlock (line 213) | class BasicTransformerBlock(nn.Module):
    method __init__ (line 248) | def __init__(
    method set_chunk_feed_forward (line 416) | def set_chunk_feed_forward(self, chunk_size: Optional[int], dim: int =...
    method forward (line 421) | def forward(
  class LuminaFeedForward (line 544) | class LuminaFeedForward(nn.Module):
    method __init__ (line 559) | def __init__(
    method forward (line 590) | def forward(self, x):
  class TemporalBasicTransformerBlock (line 595) | class TemporalBasicTransformerBlock(nn.Module):
    method __init__ (line 607) | def __init__(
    method set_chunk_feed_forward (line 660) | def set_chunk_feed_forward(self, chunk_size: Optional[int], **kwargs):
    method forward (line 666) | def forward(
  class SkipFFTransformerBlock (line 724) | class SkipFFTransformerBlock(nn.Module):
    method __init__ (line 725) | def __init__(
    method forward (line 767) | def forward(self, hidden_states, encoder_hidden_states, cross_attentio...
  class FreeNoiseTransformerBlock (line 797) | class FreeNoiseTransformerBlock(nn.Module):
    method __init__ (line 852) | def __init__(
    method _get_frame_indices (line 966) | def _get_frame_indices(self, num_frames: int) -> List[Tuple[int, int]]:
    method _get_frame_weights (line 974) | def _get_frame_weights(self, num_frames: int, weighting_scheme: str = ...
    method set_free_noise_properties (line 989) | def set_free_noise_properties(
    method set_chunk_feed_forward (line 996) | def set_chunk_feed_forward(self, chunk_size: Optional[int], dim: int =...
    method forward (line 1001) | def forward(
  class FeedForward (line 1109) | class FeedForward(nn.Module):
    method __init__ (line 1123) | def __init__(
    method forward (line 1161) | def forward(self, hidden_states: torch.Tensor, *args, **kwargs) -> tor...

FILE: src/diffusers/models/attention_flax.py
  function _query_chunk_attention (line 23) | def _query_chunk_attention(query, key, value, precision, key_chunk_size:...
  function jax_memory_efficient_attention (line 74) | def jax_memory_efficient_attention(
  class FlaxAttention (line 122) | class FlaxAttention(nn.Module):
    method setup (line 153) | def setup(self):
    method reshape_heads_to_batch_dim (line 165) | def reshape_heads_to_batch_dim(self, tensor):
    method reshape_batch_dim_to_heads (line 173) | def reshape_batch_dim_to_heads(self, tensor):
    method __call__ (line 181) | def __call__(self, hidden_states, context=None, deterministic=True):
  class FlaxBasicTransformerBlock (line 244) | class FlaxBasicTransformerBlock(nn.Module):
    method setup (line 279) | def setup(self):
    method __call__ (line 306) | def __call__(self, hidden_states, context, deterministic=True):
  class FlaxTransformer2DModel (line 328) | class FlaxTransformer2DModel(nn.Module):
    method setup (line 367) | def setup(self):
    method __call__ (line 409) | def __call__(self, hidden_states, context, deterministic=True):
  class FlaxFeedForward (line 434) | class FlaxFeedForward(nn.Module):
    method setup (line 456) | def setup(self):
    method __call__ (line 462) | def __call__(self, hidden_states, deterministic=True):
  class FlaxGEGLU (line 468) | class FlaxGEGLU(nn.Module):
    method setup (line 486) | def setup(self):
    method __call__ (line 491) | def __call__(self, hidden_states, deterministic=True):

FILE: src/diffusers/models/attention_processor.py
  class Attention (line 41) | class Attention(nn.Module):
    method __init__ (line 96) | def __init__(
    method set_use_npu_flash_attention (line 266) | def set_use_npu_flash_attention(self, use_npu_flash_attention: bool) -...
    method set_use_memory_efficient_attention_xformers (line 283) | def set_use_memory_efficient_attention_xformers(
    method set_attention_slice (line 390) | def set_attention_slice(self, slice_size: int) -> None:
    method set_processor (line 418) | def set_processor(self, processor: "AttnProcessor") -> None:
    method get_processor (line 438) | def get_processor(self, return_deprecated_lora: bool = False) -> "Atte...
    method forward (line 452) | def forward(
    method batch_to_head_dim (line 498) | def batch_to_head_dim(self, tensor: torch.Tensor) -> torch.Tensor:
    method head_to_batch_dim (line 515) | def head_to_batch_dim(self, tensor: torch.Tensor, out_dim: int = 3) ->...
    method get_attention_scores (line 542) | def get_attention_scores(
    method prepare_attention_mask (line 589) | def prepare_attention_mask(
    method norm_encoder_hidden_states (line 636) | def norm_encoder_hidden_states(self, encoder_hidden_states: torch.Tens...
    method fuse_projections (line 666) | def fuse_projections(self, fuse=True):
  class AttnProcessor (line 715) | class AttnProcessor:
    method __call__ (line 720) | def __call__(
  class CustomDiffusionAttnProcessor (line 787) | class CustomDiffusionAttnProcessor(nn.Module):
    method __init__ (line 806) | def __init__(
    method __call__ (line 832) | def __call__(
  class AttnAddedKVProcessor (line 891) | class AttnAddedKVProcessor:
    method __call__ (line 897) | def __call__(
  class AttnAddedKVProcessor2_0 (line 958) | class AttnAddedKVProcessor2_0:
    method __init__ (line 964) | def __init__(self):
    method __call__ (line 970) | def __call__(
  class JointAttnProcessor2_0 (line 1034) | class JointAttnProcessor2_0:
    method __init__ (line 1037) | def __init__(self):
    method __call__ (line 1041) | def __call__(
  class PAGJointAttnProcessor2_0 (line 1117) | class PAGJointAttnProcessor2_0:
    method __init__ (line 1120) | def __init__(self):
    method __call__ (line 1126) | def __call__(
  class PAGCFGJointAttnProcessor2_0 (line 1272) | class PAGCFGJointAttnProcessor2_0:
    method __init__ (line 1275) | def __init__(self):
    method __call__ (line 1281) | def __call__(
  class FusedJointAttnProcessor2_0 (line 1437) | class FusedJointAttnProcessor2_0:
    method __init__ (line 1440) | def __init__(self):
    method __call__ (line 1444) | def __call__(
  class AuraFlowAttnProcessor2_0 (line 1516) | class AuraFlowAttnProcessor2_0:
    method __init__ (line 1519) | def __init__(self):
    method __call__ (line 1525) | def __call__(
  class FusedAuraFlowAttnProcessor2_0 (line 1609) | class FusedAuraFlowAttnProcessor2_0:
    method __init__ (line 1612) | def __init__(self):
    method __call__ (line 1618) | def __call__(
  function apply_rope (line 1707) | def apply_rope(xq, xk, freqs_cis):
  class FluxSingleAttnProcessor2_0 (line 1715) | class FluxSingleAttnProcessor2_0:
    method __init__ (line 1720) | def __init__(self):
    method __call__ (line 1724) | def __call__(
  class FluxAttnProcessor2_0 (line 1790) | class FluxAttnProcessor2_0:
    method __init__ (line 1793) | def __init__(self):
    method __call__ (line 1797) | def __call__(
  class XFormersAttnAddedKVProcessor (line 1901) | class XFormersAttnAddedKVProcessor:
    method __init__ (line 1913) | def __init__(self, attention_op: Optional[Callable] = None):
    method __call__ (line 1916) | def __call__(
  class XFormersAttnProcessor (line 1972) | class XFormersAttnProcessor:
    method __init__ (line 1984) | def __init__(self, attention_op: Optional[Callable] = None):
    method __call__ (line 1987) | def __call__(
  class AttnProcessorNPU (line 2066) | class AttnProcessorNPU:
    method __init__ (line 2074) | def __init__(self):
    method __call__ (line 2078) | def __call__(
  class AttnProcessor2_0 (line 2175) | class AttnProcessor2_0:
    method __init__ (line 2180) | def __init__(self):
    method __call__ (line 2184) | def __call__(
  class StableAudioAttnProcessor2_0 (line 2269) | class StableAudioAttnProcessor2_0:
    method __init__ (line 2275) | def __init__(self):
    method apply_partial_rotary_emb (line 2281) | def apply_partial_rotary_emb(
    method __call__ (line 2296) | def __call__(
  class HunyuanAttnProcessor2_0 (line 2400) | class HunyuanAttnProcessor2_0:
    method __init__ (line 2406) | def __init__(self):
    method __call__ (line 2410) | def __call__(
  class FusedHunyuanAttnProcessor2_0 (line 2498) | class FusedHunyuanAttnProcessor2_0:
    method __init__ (line 2505) | def __init__(self):
    method __call__ (line 2511) | def __call__(
  class PAGHunyuanAttnProcessor2_0 (line 2601) | class PAGHunyuanAttnProcessor2_0:
    method __init__ (line 2608) | def __init__(self):
    method __call__ (line 2614) | def __call__(
  class PAGCFGHunyuanAttnProcessor2_0 (line 2724) | class PAGCFGHunyuanAttnProcessor2_0:
    method __init__ (line 2731) | def __init__(self):
    method __call__ (line 2737) | def __call__(
  class LuminaAttnProcessor2_0 (line 2848) | class LuminaAttnProcessor2_0:
    method __init__ (line 2854) | def __init__(self):
    method __call__ (line 2858) | def __call__(
  class FusedAttnProcessor2_0 (line 2944) | class FusedAttnProcessor2_0:
    method __init__ (line 2957) | def __init__(self):
    method __call__ (line 2963) | def __call__(
  class CustomDiffusionXFormersAttnProcessor (line 3050) | class CustomDiffusionXFormersAttnProcessor(nn.Module):
    method __init__ (line 3073) | def __init__(
    method __call__ (line 3101) | def __call__(
  class CustomDiffusionAttnProcessor2_0 (line 3166) | class CustomDiffusionAttnProcessor2_0(nn.Module):
    method __init__ (line 3186) | def __init__(
    method __call__ (line 3212) | def __call__(
  class SlicedAttnProcessor (line 3280) | class SlicedAttnProcessor:
    method __init__ (line 3290) | def __init__(self, slice_size: int):
    method __call__ (line 3293) | def __call__(
  class SlicedAttnAddedKVProcessor (line 3367) | class SlicedAttnAddedKVProcessor:
    method __init__ (line 3377) | def __init__(self, slice_size):
    method __call__ (line 3380) | def __call__(
  class SpatialNorm (line 3459) | class SpatialNorm(nn.Module):
    method __init__ (line 3470) | def __init__(
    method forward (line 3480) | def forward(self, f: torch.Tensor, zq: torch.Tensor) -> torch.Tensor:
  class IPAdapterAttnProcessor (line 3488) | class IPAdapterAttnProcessor(nn.Module):
    method __init__ (line 3503) | def __init__(self, hidden_size, cross_attention_dim=None, num_tokens=(...
    method __call__ (line 3526) | def __call__(
  class IPAdapterAttnProcessor2_0 (line 3686) | class IPAdapterAttnProcessor2_0(torch.nn.Module):
    method __init__ (line 3701) | def __init__(self, hidden_size, cross_attention_dim=None, num_tokens=(...
    method __call__ (line 3729) | def __call__(
  class PAGIdentitySelfAttnProcessor2_0 (line 3916) | class PAGIdentitySelfAttnProcessor2_0:
    method __init__ (line 3922) | def __init__(self):
    method __call__ (line 3928) | def __call__(
  class PAGCFGIdentitySelfAttnProcessor2_0 (line 4015) | class PAGCFGIdentitySelfAttnProcessor2_0:
    method __init__ (line 4021) | def __init__(self):
    method __call__ (line 4027) | def __call__(
  class LoRAAttnProcessor (line 4118) | class LoRAAttnProcessor:
    method __init__ (line 4119) | def __init__(self):
  class LoRAAttnProcessor2_0 (line 4123) | class LoRAAttnProcessor2_0:
    method __init__ (line 4124) | def __init__(self):
  class LoRAXFormersAttnProcessor (line 4128) | class LoRAXFormersAttnProcessor:
    method __init__ (line 4129) | def __init__(self):
  class LoRAAttnAddedKVProcessor (line 4133) | class LoRAAttnAddedKVProcessor:
    method __init__ (line 4134) | def __init__(self):

FILE: src/diffusers/models/autoencoders/autoencoder_asym_kl.py
  class AsymmetricAutoencoderKL (line 26) | class AsymmetricAutoencoderKL(ModelMixin, ConfigMixin):
    method __init__ (line 64) | def __init__(
    method encode (line 115) | def encode(self, x: torch.Tensor, return_dict: bool = True) -> Union[A...
    method _decode (line 125) | def _decode(
    method decode (line 141) | def decode(
    method forward (line 156) | def forward(

FILE: src/diffusers/models/autoencoders/autoencoder_kl.py
  class AutoencoderKL (line 36) | class AutoencoderKL(ModelMixin, ConfigMixin, FromOriginalModelMixin):
    method __init__ (line 75) | def __init__(
    method _set_gradient_checkpointing (line 139) | def _set_gradient_checkpointing(self, module, value=False):
    method enable_tiling (line 143) | def enable_tiling(self, use_tiling: bool = True):
    method disable_tiling (line 151) | def disable_tiling(self):
    method enable_slicing (line 158) | def enable_slicing(self):
    method disable_slicing (line 165) | def disable_slicing(self):
    method attn_processors (line 174) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 198) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 233) | def set_default_attn_processor(self):
    method encode (line 249) | def encode(
    method _decode (line 285) | def _decode(self, z: torch.Tensor, return_dict: bool = True) -> Union[...
    method decode (line 300) | def decode(
    method blend_v (line 328) | def blend_v(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)...
    method blend_h (line 334) | def blend_h(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)...
    method tiled_encode (line 340) | def tiled_encode(self, x: torch.Tensor, return_dict: bool = True) -> A...
    method tiled_decode (line 395) | def tiled_decode(self, z: torch.Tensor, return_dict: bool = True) -> U...
    method forward (line 444) | def forward(
    method fuse_qkv_projections (line 473) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 499) | def unfuse_qkv_projections(self):

FILE: src/diffusers/models/autoencoders/autoencoder_kl_cogvideox.py
  class CogVideoXSafeConv3d (line 38) | class CogVideoXSafeConv3d(nn.Conv3d):
    method forward (line 43) | def forward(self, input: torch.Tensor) -> torch.Tensor:
  class CogVideoXCausalConv3d (line 67) | class CogVideoXCausalConv3d(nn.Module):
    method __init__ (line 79) | def __init__(
    method fake_context_parallel_forward (line 120) | def fake_context_parallel_forward(self, inputs: torch.Tensor) -> torch...
    method _clear_fake_context_parallel_cache (line 136) | def _clear_fake_context_parallel_cache(self):
    method forward (line 140) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class CogVideoXSpatialNorm3D (line 154) | class CogVideoXSpatialNorm3D(nn.Module):
    method __init__ (line 168) | def __init__(
    method forward (line 179) | def forward(self, f: torch.Tensor, zq: torch.Tensor) -> torch.Tensor:
  class CogVideoXResnetBlock3D (line 195) | class CogVideoXResnetBlock3D(nn.Module):
    method __init__ (line 213) | def __init__(
    method forward (line 272) | def forward(
  class CogVideoXDownBlock3D (line 307) | class CogVideoXDownBlock3D(nn.Module):
    method __init__ (line 328) | def __init__(
    method forward (line 375) | def forward(
  class CogVideoXMidBlock3D (line 403) | class CogVideoXMidBlock3D(nn.Module):
    method __init__ (line 421) | def __init__(
    method forward (line 454) | def forward(
  class CogVideoXUpBlock3D (line 478) | class CogVideoXUpBlock3D(nn.Module):
    method __init__ (line 498) | def __init__(
    method forward (line 547) | def forward(
  class CogVideoXEncoder3D (line 576) | class CogVideoXEncoder3D(nn.Module):
    method __init__ (line 602) | def __init__(
    method forward (line 675) | def forward(self, sample: torch.Tensor, temb: Optional[torch.Tensor] =...
  class CogVideoXDecoder3D (line 712) | class CogVideoXDecoder3D(nn.Module):
    method __init__ (line 738) | def __init__(
    method forward (line 818) | def forward(self, sample: torch.Tensor, temb: Optional[torch.Tensor] =...
  class AutoencoderKLCogVideoX (line 855) | class AutoencoderKLCogVideoX(ModelMixin, ConfigMixin, FromOriginalModelM...
    method __init__ (line 891) | def __init__(
    method _set_gradient_checkpointing (line 962) | def _set_gradient_checkpointing(self, module, value=False):
    method clear_fake_context_parallel_cache (line 966) | def clear_fake_context_parallel_cache(self):
    method encode (line 973) | def encode(
    method decode (line 997) | def decode(self, z: torch.FloatTensor, return_dict: bool = True) -> Un...
    method forward (line 1019) | def forward(

FILE: src/diffusers/models/autoencoders/autoencoder_kl_temporal_decoder.py
  class TemporalDecoder (line 29) | class TemporalDecoder(nn.Module):
    method __init__ (line 30) | def __init__(
    method forward (line 87) | def forward(
  class AutoencoderKLTemporalDecoder (line 164) | class AutoencoderKLTemporalDecoder(ModelMixin, ConfigMixin):
    method __init__ (line 197) | def __init__(
    method _set_gradient_checkpointing (line 239) | def _set_gradient_checkpointing(self, module, value=False):
    method attn_processors (line 245) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 269) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 303) | def set_default_attn_processor(self):
    method encode (line 317) | def encode(
    method decode (line 344) | def decode(
    method forward (line 373) | def forward(

FILE: src/diffusers/models/autoencoders/autoencoder_oobleck.py
  class Snake1d (line 30) | class Snake1d(nn.Module):
    method __init__ (line 35) | def __init__(self, hidden_dim, logscale=True):
    method forward (line 44) | def forward(self, hidden_states):
  class OobleckResidualUnit (line 56) | class OobleckResidualUnit(nn.Module):
    method __init__ (line 61) | def __init__(self, dimension: int = 16, dilation: int = 1):
    method forward (line 70) | def forward(self, hidden_state):
  class OobleckEncoderBlock (line 93) | class OobleckEncoderBlock(nn.Module):
    method __init__ (line 96) | def __init__(self, input_dim, output_dim, stride: int = 1):
    method forward (line 107) | def forward(self, hidden_state):
  class OobleckDecoderBlock (line 116) | class OobleckDecoderBlock(nn.Module):
    method __init__ (line 119) | def __init__(self, input_dim, output_dim, stride: int = 1):
    method forward (line 136) | def forward(self, hidden_state):
  class OobleckDiagonalGaussianDistribution (line 146) | class OobleckDiagonalGaussianDistribution(object):
    method __init__ (line 147) | def __init__(self, parameters: torch.Tensor, deterministic: bool = Fal...
    method sample (line 155) | def sample(self, generator: Optional[torch.Generator] = None) -> torch...
    method kl (line 166) | def kl(self, other: "OobleckDiagonalGaussianDistribution" = None) -> t...
    method mode (line 182) | def mode(self) -> torch.Tensor:
  class AutoencoderOobleckOutput (line 187) | class AutoencoderOobleckOutput(BaseOutput):
  class OobleckDecoderOutput (line 202) | class OobleckDecoderOutput(BaseOutput):
  class OobleckEncoder (line 214) | class OobleckEncoder(nn.Module):
    method __init__ (line 217) | def __init__(self, encoder_hidden_size, audio_channels, downsampling_r...
    method forward (line 242) | def forward(self, hidden_state):
  class OobleckDecoder (line 254) | class OobleckDecoder(nn.Module):
    method __init__ (line 257) | def __init__(self, channels, input_channels, audio_channels, upsamplin...
    method forward (line 282) | def forward(self, hidden_state):
  class AutoencoderOobleck (line 294) | class AutoencoderOobleck(ModelMixin, ConfigMixin):
    method __init__ (line 322) | def __init__(
    method enable_slicing (line 358) | def enable_slicing(self):
    method disable_slicing (line 365) | def disable_slicing(self):
    method encode (line 373) | def encode(
    method _decode (line 401) | def _decode(self, z: torch.Tensor, return_dict: bool = True) -> Union[...
    method decode (line 410) | def decode(
    method forward (line 438) | def forward(

FILE: src/diffusers/models/autoencoders/autoencoder_tiny.py
  class AutoencoderTinyOutput (line 29) | class AutoencoderTinyOutput(BaseOutput):
  class AutoencoderTiny (line 41) | class AutoencoderTiny(ModelMixin, ConfigMixin):
    method __init__ (line 98) | def __init__(
    method _set_gradient_checkpointing (line 157) | def _set_gradient_checkpointing(self, module, value: bool = False) -> ...
    method scale_latents (line 161) | def scale_latents(self, x: torch.Tensor) -> torch.Tensor:
    method unscale_latents (line 165) | def unscale_latents(self, x: torch.Tensor) -> torch.Tensor:
    method enable_slicing (line 169) | def enable_slicing(self) -> None:
    method disable_slicing (line 176) | def disable_slicing(self) -> None:
    method enable_tiling (line 183) | def enable_tiling(self, use_tiling: bool = True) -> None:
    method disable_tiling (line 191) | def disable_tiling(self) -> None:
    method _tiled_encode (line 198) | def _tiled_encode(self, x: torch.Tensor) -> torch.Tensor:
    method _tiled_decode (line 246) | def _tiled_decode(self, x: torch.Tensor) -> torch.Tensor:
    method encode (line 294) | def encode(self, x: torch.Tensor, return_dict: bool = True) -> Union[A...
    method decode (line 309) | def decode(
    method forward (line 323) | def forward(

FILE: src/diffusers/models/autoencoders/consistency_decoder_vae.py
  class ConsistencyDecoderVAEOutput (line 39) | class ConsistencyDecoderVAEOutput(BaseOutput):
  class ConsistencyDecoderVAE (line 52) | class ConsistencyDecoderVAE(ModelMixin, ConfigMixin):
    method __init__ (line 72) | def __init__(
    method enable_tiling (line 169) | def enable_tiling(self, use_tiling: bool = True):
    method disable_tiling (line 178) | def disable_tiling(self):
    method enable_slicing (line 186) | def enable_slicing(self):
    method disable_slicing (line 194) | def disable_slicing(self):
    method attn_processors (line 203) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 227) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 262) | def set_default_attn_processor(self):
    method encode (line 278) | def encode(
    method decode (line 313) | def decode(
    method blend_v (line 360) | def blend_v(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)...
    method blend_h (line 367) | def blend_h(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)...
    method tiled_encode (line 373) | def tiled_encode(self, x: torch.Tensor, return_dict: bool = True) -> U...
    method forward (line 428) | def forward(

FILE: src/diffusers/models/autoencoders/vae.py
  class DecoderOutput (line 34) | class DecoderOutput(BaseOutput):
  class Encoder (line 47) | class Encoder(nn.Module):
    method __init__ (line 71) | def __init__(
    method forward (line 140) | def forward(self, sample: torch.Tensor) -> torch.Tensor:
  class Decoder (line 185) | class Decoder(nn.Module):
    method __init__ (line 208) | def __init__(
    method forward (line 284) | def forward(
  class UpSample (line 350) | class UpSample(nn.Module):
    method __init__ (line 361) | def __init__(
    method forward (line 371) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class MaskConditionEncoder (line 378) | class MaskConditionEncoder(nn.Module):
    method __init__ (line 383) | def __init__(
    method forward (line 420) | def forward(self, x: torch.Tensor, mask=None) -> torch.Tensor:
  class MaskConditionDecoder (line 431) | class MaskConditionDecoder(nn.Module):
    method __init__ (line 454) | def __init__(
    method forward (line 535) | def forward(
  class VectorQuantizer (line 645) | class VectorQuantizer(nn.Module):
    method __init__ (line 654) | def __init__(
    method remap_to_used (line 691) | def remap_to_used(self, inds: torch.LongTensor) -> torch.LongTensor:
    method unmap_to_all (line 705) | def unmap_to_all(self, inds: torch.LongTensor) -> torch.LongTensor:
    method forward (line 715) | def forward(self, z: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor...
    method get_codebook_entry (line 749) | def get_codebook_entry(self, indices: torch.LongTensor, shape: Tuple[i...
  class DiagonalGaussianDistribution (line 767) | class DiagonalGaussianDistribution(object):
    method __init__ (line 768) | def __init__(self, parameters: torch.Tensor, deterministic: bool = Fal...
    method sample (line 780) | def sample(self, generator: Optional[torch.Generator] = None) -> torch...
    method kl (line 791) | def kl(self, other: "DiagonalGaussianDistribution" = None) -> torch.Te...
    method nll (line 810) | def nll(self, sample: torch.Tensor, dims: Tuple[int, ...] = [1, 2, 3])...
    method mode (line 819) | def mode(self) -> torch.Tensor:
  class EncoderTiny (line 823) | class EncoderTiny(nn.Module):
    method __init__ (line 841) | def __init__(
    method forward (line 877) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class DecoderTiny (line 899) | class DecoderTiny(nn.Module):
    method __init__ (line 919) | def __init__(
    method forward (line 960) | def forward(self, x: torch.Tensor) -> torch.Tensor:

FILE: src/diffusers/models/autoencoders/vq_model.py
  class VQEncoderOutput (line 28) | class VQEncoderOutput(BaseOutput):
  class VQModel (line 40) | class VQModel(ModelMixin, ConfigMixin):
    method __init__ (line 75) | def __init__(
    method encode (line 130) | def encode(self, x: torch.Tensor, return_dict: bool = True) -> VQEncod...
    method decode (line 140) | def decode(
    method forward (line 160) | def forward(

FILE: src/diffusers/models/controlnet.py
  class ControlNetOutput (line 47) | class ControlNetOutput(BaseOutput):
  class ControlNetConditioningEmbedding (line 66) | class ControlNetConditioningEmbedding(nn.Module):
    method __init__ (line 76) | def __init__(
    method forward (line 98) | def forward(self, conditioning):
  class ControlNetModel (line 111) | class ControlNetModel(ModelMixin, ConfigMixin, FromOriginalModelMixin):
    method __init__ (line 183) | def __init__(
    method from_unet (line 445) | def from_unet(
    method attn_processors (line 522) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 546) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 581) | def set_default_attn_processor(self):
    method set_attention_slice (line 597) | def set_attention_slice(self, slice_size: Union[str, int, List[int]]) ...
    method _set_gradient_checkpointing (line 662) | def _set_gradient_checkpointing(self, module, value: bool = False) -> ...
    method forward (line 666) | def forward(
  function zero_module (line 867) | def zero_module(module):

FILE: src/diffusers/models/controlnet_flax.py
  class FlaxControlNetOutput (line 34) | class FlaxControlNetOutput(BaseOutput):
  class FlaxControlNetConditioningEmbedding (line 47) | class FlaxControlNetConditioningEmbedding(nn.Module):
    method setup (line 52) | def setup(self) -> None:
    method __call__ (line 90) | def __call__(self, conditioning: jnp.ndarray) -> jnp.ndarray:
  class FlaxControlNetModel (line 104) | class FlaxControlNetModel(nn.Module, FlaxModelMixin, ConfigMixin):
    method init_weights (line 172) | def init_weights(self, rng: jax.Array) -> FrozenDict:
    method setup (line 186) | def setup(self) -> None:
    method __call__ (line 314) | def __call__(

FILE: src/diffusers/models/controlnet_hunyuan.py
  class HunyuanControlNetOutput (line 37) | class HunyuanControlNetOutput(BaseOutput):
  class HunyuanDiT2DControlNetModel (line 41) | class HunyuanDiT2DControlNetModel(ModelMixin, ConfigMixin):
    method __init__ (line 43) | def __init__(
    method attn_processors (line 119) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 142) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method from_transformer (line 175) | def from_transformer(
    method forward (line 216) | def forward(
  class HunyuanDiT2DMultiControlNetModel (line 312) | class HunyuanDiT2DMultiControlNetModel(ModelMixin):
    method __init__ (line 325) | def __init__(self, controlnets):
    method forward (line 329) | def forward(

FILE: src/diffusers/models/controlnet_sd3.py
  class SD3ControlNetOutput (line 37) | class SD3ControlNetOutput(BaseOutput):
  class SD3ControlNetModel (line 41) | class SD3ControlNetModel(ModelMixin, ConfigMixin, PeftAdapterMixin, From...
    method __init__ (line 45) | def __init__(
    method enable_forward_chunking (line 110) | def enable_forward_chunking(self, chunk_size: Optional[int] = None, di...
    method attn_processors (line 141) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 165) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method fuse_qkv_projections (line 200) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 226) | def unfuse_qkv_projections(self):
    method _set_gradient_checkpointing (line 239) | def _set_gradient_checkpointing(self, module, value=False):
    method from_transformer (line 244) | def from_transformer(cls, transformer, num_layers=12, load_weights_fro...
    method forward (line 259) | def forward(
  class SD3MultiControlNetModel (line 368) | class SD3MultiControlNetModel(ModelMixin):
    method __init__ (line 381) | def __init__(self, controlnets):
    method forward (line 385) | def forward(

FILE: src/diffusers/models/controlnet_sparsectrl.py
  class SparseControlNetOutput (line 43) | class SparseControlNetOutput(BaseOutput):
  class SparseControlNetConditioningEmbedding (line 62) | class SparseControlNetConditioningEmbedding(nn.Module):
    method __init__ (line 63) | def __init__(
    method forward (line 84) | def forward(self, conditioning: torch.Tensor) -> torch.Tensor:
  class SparseControlNetModel (line 96) | class SparseControlNetModel(ModelMixin, ConfigMixin, FromOriginalModelMi...
    method __init__ (line 161) | def __init__(
    method from_unet (line 388) | def from_unet(
    method attn_processors (line 453) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 477) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 512) | def set_default_attn_processor(self):
    method set_attention_slice (line 528) | def set_attention_slice(self, slice_size: Union[str, int, List[int]]) ...
    method _set_gradient_checkpointing (line 593) | def _set_gradient_checkpointing(self, module, value: bool = False) -> ...
    method forward (line 597) | def forward(
  function zero_module (line 786) | def zero_module(module: nn.Module) -> nn.Module:

FILE: src/diffusers/models/controlnet_xs.py
  class ControlNetXSOutput (line 53) | class ControlNetXSOutput(BaseOutput):
  class DownBlockControlNetXSAdapter (line 66) | class DownBlockControlNetXSAdapter(nn.Module):
    method __init__ (line 70) | def __init__(
  class MidBlockControlNetXSAdapter (line 86) | class MidBlockControlNetXSAdapter(nn.Module):
    method __init__ (line 90) | def __init__(self, midblock: UNetMidBlock2DCrossAttn, base_to_ctrl: nn...
  class UpBlockControlNetXSAdapter (line 97) | class UpBlockControlNetXSAdapter(nn.Module):
    method __init__ (line 100) | def __init__(self, ctrl_to_base: nn.ModuleList):
  function get_down_block_adapter (line 105) | def get_down_block_adapter(
  function get_mid_block_adapter (line 196) | def get_mid_block_adapter(
  function get_up_block_adapter (line 231) | def get_up_block_adapter(
  class ControlNetXSAdapter (line 245) | class ControlNetXSAdapter(ModelMixin, ConfigMixin):
    method __init__ (line 293) | def __init__(
    method from_unet (line 430) | def from_unet(
    method forward (line 506) | def forward(self, *args, **kwargs):
  class UNetControlNetXSModel (line 512) | class UNetControlNetXSModel(ModelMixin, ConfigMixin):
    method __init__ (line 529) | def __init__(
    method from_unet (line 720) | def from_unet(
    method freeze_unet_params (line 838) | def freeze_unet_params(self) -> None:
    method _set_gradient_checkpointing (line 867) | def _set_gradient_checkpointing(self, module, value=False):
    method attn_processors (line 873) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 897) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 932) | def set_default_attn_processor(self):
    method enable_freeu (line 948) | def enable_freeu(self, s1: float, s2: float, b1: float, b2: float):
    method disable_freeu (line 973) | def disable_freeu(self):
    method fuse_qkv_projections (line 982) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 1008) | def unfuse_qkv_projections(self):
    method forward (line 1021) | def forward(
  class ControlNetXSCrossAttnDownBlock2D (line 1224) | class ControlNetXSCrossAttnDownBlock2D(nn.Module):
    method __init__ (line 1225) | def __init__(
    method from_modules (line 1344) | def from_modules(cls, base_downblock: CrossAttnDownBlock2D, ctrl_downb...
    method freeze_base_params (line 1409) | def freeze_base_params(self) -> None:
    method forward (line 1426) | def forward(
  class ControlNetXSCrossAttnMidBlock2D (line 1540) | class ControlNetXSCrossAttnMidBlock2D(nn.Module):
    method __init__ (line 1541) | def __init__(
    method from_modules (line 1594) | def from_modules(
    method freeze_base_params (line 1642) | def freeze_base_params(self) -> None:
    method forward (line 1653) | def forward(
  class ControlNetXSCrossAttnUpBlock2D (line 1690) | class ControlNetXSCrossAttnUpBlock2D(nn.Module):
    method __init__ (line 1691) | def __init__(
    method from_modules (line 1763) | def from_modules(cls, base_upblock: CrossAttnUpBlock2D, ctrl_upblock: ...
    method freeze_base_params (line 1821) | def freeze_base_params(self) -> None:
    method forward (line 1838) | def forward(
  function make_zero_conv (line 1927) | def make_zero_conv(in_channels, out_channels=None):
  function zero_module (line 1931) | def zero_module(module):
  function find_largest_factor (line 1937) | def find_largest_factor(number, max_factor):

FILE: src/diffusers/models/downsampling.py
  class Downsample1D (line 26) | class Downsample1D(nn.Module):
    method __init__ (line 42) | def __init__(
    method forward (line 64) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class Downsample2D (line 69) | class Downsample2D(nn.Module):
    method __init__ (line 85) | def __init__(
    method forward (line 132) | def forward(self, hidden_states: torch.Tensor, *args, **kwargs) -> tor...
  class FirDownsample2D (line 152) | class FirDownsample2D(nn.Module):
    method __init__ (line 166) | def __init__(
    method _downsample_2d (line 181) | def _downsample_2d(
    method forward (line 247) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class KDownsample2D (line 258) | class KDownsample2D(nn.Module):
    method __init__ (line 265) | def __init__(self, pad_mode: str = "reflect"):
    method forward (line 272) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class CogVideoXDownsample3D (line 288) | class CogVideoXDownsample3D(nn.Module):
    method __init__ (line 308) | def __init__(
    method forward (line 322) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  function downsample_2d (line 356) | def downsample_2d(

FILE: src/diffusers/models/embeddings.py
  function get_timestep_embedding (line 27) | def get_timestep_embedding(
  function get_3d_sincos_pos_embed (line 81) | def get_3d_sincos_pos_embed(
  function get_2d_sincos_pos_embed (line 128) | def get_2d_sincos_pos_embed(
  function get_2d_sincos_pos_embed_from_grid (line 150) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid):
  function get_1d_sincos_pos_embed_from_grid (line 162) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos):
  class PatchEmbed (line 183) | class PatchEmbed(nn.Module):
    method __init__ (line 186) | def __init__(
    method cropped_pos_embed (line 237) | def cropped_pos_embed(self, height, width):
    method forward (line 260) | def forward(self, latent):
  class LuminaPatchEmbed (line 291) | class LuminaPatchEmbed(nn.Module):
    method __init__ (line 294) | def __init__(self, patch_size=2, in_channels=4, embed_dim=768, bias=Tr...
    method forward (line 303) | def forward(self, x, freqs_cis):
  class CogVideoXPatchEmbed (line 337) | class CogVideoXPatchEmbed(nn.Module):
    method __init__ (line 338) | def __init__(
    method forward (line 354) | def forward(self, text_embeds: torch.Tensor, image_embeds: torch.Tensor):
  function get_2d_rotary_pos_embed (line 377) | def get_2d_rotary_pos_embed(embed_dim, crops_coords, grid_size, use_real...
  function get_2d_rotary_pos_embed_from_grid (line 405) | def get_2d_rotary_pos_embed_from_grid(embed_dim, grid, use_real=False):
  function get_2d_rotary_pos_embed_lumina (line 425) | def get_2d_rotary_pos_embed_lumina(embed_dim, len_h, len_w, linear_facto...
  function get_1d_rotary_pos_embed (line 441) | def get_1d_rotary_pos_embed(
  function apply_rotary_emb (line 495) | def apply_rotary_emb(
  class TimestepEmbedding (line 543) | class TimestepEmbedding(nn.Module):
    method __init__ (line 544) | def __init__(
    method forward (line 576) | def forward(self, sample, condition=None):
  class Timesteps (line 591) | class Timesteps(nn.Module):
    method __init__ (line 592) | def __init__(self, num_channels: int, flip_sin_to_cos: bool, downscale...
    method forward (line 599) | def forward(self, timesteps):
  class GaussianFourierProjection (line 610) | class GaussianFourierProjection(nn.Module):
    method __init__ (line 613) | def __init__(
    method forward (line 628) | def forward(self, x):
  class SinusoidalPositionalEmbedding (line 641) | class SinusoidalPositionalEmbedding(nn.Module):
    method __init__ (line 653) | def __init__(self, embed_dim: int, max_seq_length: int = 32):
    method forward (line 662) | def forward(self, x):
  class ImagePositionalEmbeddings (line 668) | class ImagePositionalEmbeddings(nn.Module):
    method __init__ (line 692) | def __init__(
    method forward (line 710) | def forward(self, index):
  class LabelEmbedding (line 733) | class LabelEmbedding(nn.Module):
    method __init__ (line 743) | def __init__(self, num_classes, hidden_size, dropout_prob):
    method token_drop (line 750) | def token_drop(self, labels, force_drop_ids=None):
    method forward (line 761) | def forward(self, labels: torch.LongTensor, force_drop_ids=None):
  class TextImageProjection (line 769) | class TextImageProjection(nn.Module):
    method __init__ (line 770) | def __init__(
    method forward (line 783) | def forward(self, text_embeds: torch.Tensor, image_embeds: torch.Tensor):
  class ImageProjection (line 796) | class ImageProjection(nn.Module):
    method __init__ (line 797) | def __init__(
    method forward (line 809) | def forward(self, image_embeds: torch.Tensor):
  class IPAdapterFullImageProjection (line 819) | class IPAdapterFullImageProjection(nn.Module):
    method __init__ (line 820) | def __init__(self, image_embed_dim=1024, cross_attention_dim=1024):
    method forward (line 827) | def forward(self, image_embeds: torch.Tensor):
  class IPAdapterFaceIDImageProjection (line 831) | class IPAdapterFaceIDImageProjection(nn.Module):
    method __init__ (line 832) | def __init__(self, image_embed_dim=1024, cross_attention_dim=1024, mul...
    method forward (line 841) | def forward(self, image_embeds: torch.Tensor):
  class CombinedTimestepLabelEmbeddings (line 847) | class CombinedTimestepLabelEmbeddings(nn.Module):
    method __init__ (line 848) | def __init__(self, num_classes, embedding_dim, class_dropout_prob=0.1):
    method forward (line 855) | def forward(self, timestep, class_labels, hidden_dtype=None):
  class CombinedTimestepTextProjEmbeddings (line 866) | class CombinedTimestepTextProjEmbeddings(nn.Module):
    method __init__ (line 867) | def __init__(self, embedding_dim, pooled_projection_dim):
    method forward (line 874) | def forward(self, timestep, pooled_projection):
  class CombinedTimestepGuidanceTextProjEmbeddings (line 885) | class CombinedTimestepGuidanceTextProjEmbeddings(nn.Module):
    method __init__ (line 886) | def __init__(self, embedding_dim, pooled_projection_dim):
    method forward (line 894) | def forward(self, timestep, guidance, pooled_projection):
  class HunyuanDiTAttentionPool (line 909) | class HunyuanDiTAttentionPool(nn.Module):
    method __init__ (line 912) | def __init__(self, spacial_dim: int, embed_dim: int, num_heads: int, o...
    method forward (line 921) | def forward(self, x):
  class HunyuanCombinedTimestepTextSizeStyleEmbedding (line 949) | class HunyuanCombinedTimestepTextSizeStyleEmbedding(nn.Module):
    method __init__ (line 950) | def __init__(
    method forward (line 984) | def forward(self, timestep, encoder_hidden_states, image_meta_size, st...
  class LuminaCombinedTimestepCaptionEmbedding (line 1010) | class LuminaCombinedTimestepCaptionEmbedding(nn.Module):
    method __init__ (line 1011) | def __init__(self, hidden_size=4096, cross_attention_dim=2048, frequen...
    method forward (line 1028) | def forward(self, timestep, caption_feat, caption_mask):
  class TextTimeEmbedding (line 1044) | class TextTimeEmbedding(nn.Module):
    method __init__ (line 1045) | def __init__(self, encoder_dim: int, time_embed_dim: int, num_heads: i...
    method forward (line 1052) | def forward(self, hidden_states):
  class TextImageTimeEmbedding (line 1060) | class TextImageTimeEmbedding(nn.Module):
    method __init__ (line 1061) | def __init__(self, text_embed_dim: int = 768, image_embed_dim: int = 7...
    method forward (line 1067) | def forward(self, text_embeds: torch.Tensor, image_embeds: torch.Tensor):
  class ImageTimeEmbedding (line 1078) | class ImageTimeEmbedding(nn.Module):
    method __init__ (line 1079) | def __init__(self, image_embed_dim: int = 768, time_embed_dim: int = 1...
    method forward (line 1084) | def forward(self, image_embeds: torch.Tensor):
  class ImageHintTimeEmbedding (line 1091) | class ImageHintTimeEmbedding(nn.Module):
    method __init__ (line 1092) | def __init__(self, image_embed_dim: int = 768, time_embed_dim: int = 1...
    method forward (line 1114) | def forward(self, image_embeds: torch.Tensor, hint: torch.Tensor):
  class AttentionPooling (line 1122) | class AttentionPooling(nn.Module):
    method __init__ (line 1125) | def __init__(self, num_heads, embed_dim, dtype=None):
    method forward (line 1135) | def forward(self, x):
  function get_fourier_embeds_from_boundingbox (line 1172) | def get_fourier_embeds_from_boundingbox(embed_dim, box):
  class GLIGENTextBoundingboxProjection (line 1193) | class GLIGENTextBoundingboxProjection(nn.Module):
    method __init__ (line 1194) | def __init__(self, positive_len, out_dim, feature_type="text-only", fo...
    method forward (line 1235) | def forward(
  class PixArtAlphaCombinedTimestepSizeEmbeddings (line 1286) | class PixArtAlphaCombinedTimestepSizeEmbeddings(nn.Module):
    method __init__ (line 1294) | def __init__(self, embedding_dim, size_emb_dim, use_additional_conditi...
    method forward (line 1307) | def forward(self, timestep, resolution, aspect_ratio, batch_size, hidd...
  class PixArtAlphaTextProjection (line 1323) | class PixArtAlphaTextProjection(nn.Module):
    method __init__ (line 1330) | def __init__(self, in_features, hidden_size, out_features=None, act_fn...
    method forward (line 1345) | def forward(self, caption):
  class IPAdapterPlusImageProjectionBlock (line 1352) | class IPAdapterPlusImageProjectionBlock(nn.Module):
    method __init__ (line 1353) | def __init__(
    method forward (line 1376) | def forward(self, x, latents, residual):
  class IPAdapterPlusImageProjection (line 1385) | class IPAdapterPlusImageProjection(nn.Module):
    method __init__ (line 1401) | def __init__(
    method forward (line 1424) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class IPAdapterFaceIDPlusImageProjection (line 1444) | class IPAdapterFaceIDPlusImageProjection(nn.Module):
    method __init__ (line 1461) | def __init__(
    method forward (line 1496) | def forward(self, id_embeds: torch.Tensor) -> torch.Tensor:
  class MultiIPAdapterImageProjection (line 1524) | class MultiIPAdapterImageProjection(nn.Module):
    method __init__ (line 1525) | def __init__(self, IPAdapterImageProjectionLayers: Union[List[nn.Modul...
    method forward (line 1529) | def forward(self, image_embeds: List[torch.Tensor]):

FILE: src/diffusers/models/embeddings_flax.py
  function get_sinusoidal_embeddings (line 20) | def get_sinusoidal_embeddings(
  class FlaxTimestepEmbedding (line 58) | class FlaxTimestepEmbedding(nn.Module):
    method __call__ (line 73) | def __call__(self, temb):
  class FlaxTimesteps (line 80) | class FlaxTimesteps(nn.Module):
    method __call__ (line 94) | def __call__(self, timesteps):

FILE: src/diffusers/models/lora.py
  function text_encoder_attn_modules (line 41) | def text_encoder_attn_modules(text_encoder):
  function text_encoder_mlp_modules (line 55) | def text_encoder_mlp_modules(text_encoder):
  function adjust_lora_scale_text_encoder (line 69) | def adjust_lora_scale_text_encoder(text_encoder, lora_scale: float = 1.0):
  class PatchedLoraProjection (line 83) | class PatchedLoraProjection(torch.nn.Module):
    method __init__ (line 84) | def __init__(self, regular_linear_layer, lora_scale=1, network_alpha=N...
    method state_dict (line 111) | def state_dict(self, *args, destination=None, prefix="", keep_vars=Fal...
    method _fuse_lora (line 119) | def _fuse_lora(self, lora_scale=1.0, safe_fusing=False):
    method _unfuse_lora (line 151) | def _unfuse_lora(self):
    method forward (line 167) | def forward(self, input):
  class LoRALinearLayer (line 175) | class LoRALinearLayer(nn.Module):
    method __init__ (line 196) | def __init__(
    method forward (line 222) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class LoRAConv2dLayer (line 235) | class LoRAConv2dLayer(nn.Module):
    method __init__ (line 258) | def __init__(
    method forward (line 286) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class LoRACompatibleConv (line 299) | class LoRACompatibleConv(nn.Conv2d):
    method __init__ (line 304) | def __init__(self, *args, lora_layer: Optional[LoRAConv2dLayer] = None...
    method set_lora_layer (line 311) | def set_lora_layer(self, lora_layer: Optional[LoRAConv2dLayer]):
    method _fuse_lora (line 317) | def _fuse_lora(self, lora_scale: float = 1.0, safe_fusing: bool = False):
    method _unfuse_lora (line 351) | def _unfuse_lora(self):
    method forward (line 369) | def forward(self, hidden_states: torch.Tensor, scale: float = 1.0) -> ...
  class LoRACompatibleLinear (line 386) | class LoRACompatibleLinear(nn.Linear):
    method __init__ (line 391) | def __init__(self, *args, lora_layer: Optional[LoRALinearLayer] = None...
    method set_lora_layer (line 398) | def set_lora_layer(self, lora_layer: Optional[LoRALinearLayer]):
    method _fuse_lora (line 403) | def _fuse_lora(self, lora_scale: float = 1.0, safe_fusing: bool = False):
    method _unfuse_lora (line 435) | def _unfuse_lora(self):
    method forward (line 451) | def forward(self, hidden_states: torch.Tensor, scale: float = 1.0) -> ...

FILE: src/diffusers/models/model_loading_utils.py
  function _determine_device_map (line 56) | def _determine_device_map(model: torch.nn.Module, device_map, max_memory...
  function _fetch_remapped_cls_from_config (line 78) | def _fetch_remapped_cls_from_config(config, old_class):
  function load_state_dict (line 98) | def load_state_dict(checkpoint_file: Union[str, os.PathLike], variant: O...
  function load_model_dict_into_meta (line 133) | def load_model_dict_into_meta(
  function _load_state_dict_into_model (line 165) | def _load_state_dict_into_model(model_to_load, state_dict: OrderedDict) ...
  function _fetch_index_file (line 186) | def _fetch_index_file(

FILE: src/diffusers/models/modeling_flax_pytorch_utils.py
  function rename_key (line 29) | def rename_key(key):
  function rename_key_and_reshape_tensor (line 44) | def rename_key_and_reshape_tensor(pt_tuple_key, pt_tensor, random_flax_s...
  function convert_pytorch_state_dict_to_flax (line 107) | def convert_pytorch_state_dict_to_flax(pt_state_dict, flax_model, init_k...

FILE: src/diffusers/models/modeling_flax_utils.py
  class FlaxModelMixin (line 50) | class FlaxModelMixin(PushToHubMixin):
    method _from_config (line 65) | def _from_config(cls, config, **kwargs):
    method _cast_floating_to (line 71) | def _cast_floating_to(self, params: Union[Dict, FrozenDict], dtype: jn...
    method to_bf16 (line 95) | def to_bf16(self, params: Union[Dict, FrozenDict], mask: Any = None):
    method to_fp32 (line 134) | def to_fp32(self, params: Union[Dict, FrozenDict], mask: Any = None):
    method to_fp16 (line 161) | def to_fp16(self, params: Union[Dict, FrozenDict], mask: Any = None):
    method init_weights (line 200) | def init_weights(self, rng: jax.Array) -> Dict:
    method from_pretrained (line 205) | def from_pretrained(
    method save_pretrained (line 497) | def save_pretrained(

FILE: src/diffusers/models/modeling_outputs.py
  class AutoencoderKLOutput (line 7) | class AutoencoderKLOutput(BaseOutput):
  class Transformer2DModelOutput (line 21) | class Transformer2DModelOutput(BaseOutput):

FILE: src/diffusers/models/modeling_pytorch_flax_utils.py
  function load_flax_checkpoint_in_pytorch_model (line 37) | def load_flax_checkpoint_in_pytorch_model(pt_model, model_file):
  function load_flax_weights_in_pytorch_model (line 58) | def load_flax_weights_in_pytorch_model(pt_model, flax_state):

FILE: src/diffusers/models/modeling_utils.py
  function get_parameter_device (line 78) | def get_parameter_device(parameter: torch.nn.Module) -> torch.device:
  function get_parameter_dtype (line 94) | def get_parameter_dtype(parameter: torch.nn.Module) -> torch.dtype:
  class ModelMixin (line 116) | class ModelMixin(torch.nn.Module, PushToHubMixin):
    method __init__ (line 132) | def __init__(self):
    method __getattr__ (line 135) | def __getattr__(self, name: str) -> Any:
    method is_gradient_checkpointing (line 154) | def is_gradient_checkpointing(self) -> bool:
    method enable_gradient_checkpointing (line 160) | def enable_gradient_checkpointing(self) -> None:
    method disable_gradient_checkpointing (line 169) | def disable_gradient_checkpointing(self) -> None:
    method set_use_npu_flash_attention (line 177) | def set_use_npu_flash_attention(self, valid: bool) -> None:
    method enable_npu_flash_attention (line 193) | def enable_npu_flash_attention(self) -> None:
    method disable_npu_flash_attention (line 200) | def disable_npu_flash_attention(self) -> None:
    method set_use_memory_efficient_attention_xformers (line 207) | def set_use_memory_efficient_attention_xformers(
    method enable_xformers_memory_efficient_attention (line 224) | def enable_xformers_memory_efficient_attention(self, attention_op: Opt...
    method disable_xformers_memory_efficient_attention (line 260) | def disable_xformers_memory_efficient_attention(self) -> None:
    method save_pretrained (line 266) | def save_pretrained(
    method from_pretrained (line 412) | def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union...
    method _load_pretrained_model (line 863) | def _load_pretrained_model(
    method _get_signature_keys (line 967) | def _get_signature_keys(cls, obj):
    method _get_no_split_modules (line 976) | def _get_no_split_modules(self, device_map: str):
    method device (line 1006) | def device(self) -> torch.device:
    method dtype (line 1014) | def dtype(self) -> torch.dtype:
    method num_parameters (line 1020) | def num_parameters(self, only_trainable: bool = False, exclude_embeddi...
    method _convert_deprecated_attention_blocks (line 1058) | def _convert_deprecated_attention_blocks(self, state_dict: OrderedDict...
    method _temp_convert_self_to_deprecated_attention_blocks (line 1102) | def _temp_convert_self_to_deprecated_attention_blocks(self) -> None:
    method _undo_temp_convert_self_to_deprecated_attention_blocks (line 1129) | def _undo_temp_convert_self_to_deprecated_attention_blocks(self) -> None:
  class LegacyModelMixin (line 1153) | class LegacyModelMixin(ModelMixin):
    method from_pretrained (line 1161) | def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union...

FILE: src/diffusers/models/normalization.py
  class AdaLayerNorm (line 31) | class AdaLayerNorm(nn.Module):
    method __init__ (line 44) | def __init__(
    method forward (line 67) | def forward(
  class FP32LayerNorm (line 88) | class FP32LayerNorm(nn.LayerNorm):
    method forward (line 89) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class AdaLayerNormZero (line 100) | class AdaLayerNormZero(nn.Module):
    method __init__ (line 109) | def __init__(self, embedding_dim: int, num_embeddings: Optional[int] =...
    method forward (line 127) | def forward(
  class AdaLayerNormZeroSingle (line 143) | class AdaLayerNormZeroSingle(nn.Module):
    method __init__ (line 152) | def __init__(self, embedding_dim: int, norm_type="layer_norm", bias=Tr...
    method forward (line 164) | def forward(
  class LuminaRMSNormZero (line 175) | class LuminaRMSNormZero(nn.Module):
    method __init__ (line 183) | def __init__(self, embedding_dim: int, norm_eps: float, norm_elementwi...
    method forward (line 193) | def forward(
  class AdaLayerNormSingle (line 206) | class AdaLayerNormSingle(nn.Module):
    method __init__ (line 217) | def __init__(self, embedding_dim: int, use_additional_conditions: bool...
    method forward (line 227) | def forward(
  class AdaGroupNorm (line 239) | class AdaGroupNorm(nn.Module):
    method __init__ (line 251) | def __init__(
    method forward (line 265) | def forward(self, x: torch.Tensor, emb: torch.Tensor) -> torch.Tensor:
  class AdaLayerNormContinuous (line 277) | class AdaLayerNormContinuous(nn.Module):
    method __init__ (line 278) | def __init__(
    method forward (line 302) | def forward(self, x: torch.Tensor, conditioning_embedding: torch.Tenso...
  class LuminaLayerNormContinuous (line 310) | class LuminaLayerNormContinuous(nn.Module):
    method __init__ (line 311) | def __init__(
    method forward (line 342) | def forward(
  class CogVideoXLayerNormZero (line 358) | class CogVideoXLayerNormZero(nn.Module):
    method __init__ (line 359) | def __init__(
    method forward (line 373) | def forward(
  class LayerNorm (line 387) | class LayerNorm(nn.Module):
    method __init__ (line 388) | def __init__(self, dim, eps: float = 1e-5, elementwise_affine: bool = ...
    method forward (line 405) | def forward(self, input):
  class RMSNorm (line 409) | class RMSNorm(nn.Module):
    method __init__ (line 410) | def __init__(self, dim, eps: float, elementwise_affine: bool = True):
    method forward (line 425) | def forward(self, hidden_states):
  class GlobalResponseNorm (line 441) | class GlobalResponseNorm(nn.Module):
    method __init__ (line 443) | def __init__(self, dim):
    method forward (line 448) | def forward(self, x):

FILE: src/diffusers/models/resnet.py
  class ResnetBlockCondNorm2D (line 44) | class ResnetBlockCondNorm2D(nn.Module):
    method __init__ (line 74) | def __init__(
    method forward (line 149) | def forward(self, input_tensor: torch.Tensor, temb: torch.Tensor, *arg...
  class ResnetBlock2D (line 189) | class ResnetBlock2D(nn.Module):
    method __init__ (line 220) | def __init__(
    method forward (line 320) | def forward(self, input_tensor: torch.Tensor, temb: torch.Tensor, *arg...
  function rearrange_dims (line 377) | def rearrange_dims(tensor: torch.Tensor) -> torch.Tensor:
  class Conv1dBlock (line 388) | class Conv1dBlock(nn.Module):
    method __init__ (line 400) | def __init__(
    method forward (line 414) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class ResidualTemporalBlock1D (line 424) | class ResidualTemporalBlock1D(nn.Module):
    method __init__ (line 436) | def __init__(
    method forward (line 455) | def forward(self, inputs: torch.Tensor, t: torch.Tensor) -> torch.Tensor:
  class TemporalConvLayer (line 471) | class TemporalConvLayer(nn.Module):
    method __init__ (line 482) | def __init__(
    method forward (line 523) | def forward(self, hidden_states: torch.Tensor, num_frames: int = 1) ->...
  class TemporalResnetBlock (line 542) | class TemporalResnetBlock(nn.Module):
    method __init__ (line 554) | def __init__(
    method forward (line 608) | def forward(self, input_tensor: torch.Tensor, temb: torch.Tensor) -> t...
  class SpatioTemporalResBlock (line 635) | class SpatioTemporalResBlock(nn.Module):
    method __init__ (line 653) | def __init__(
    method forward (line 686) | def forward(
  class AlphaBlender (line 719) | class AlphaBlender(nn.Module):
    method __init__ (line 733) | def __init__(
    method get_alpha (line 753) | def get_alpha(self, image_only_indicator: torch.Tensor, ndims: int) ->...
    method forward (line 784) | def forward(

FILE: src/diffusers/models/resnet_flax.py
  class FlaxUpsample2D (line 19) | class FlaxUpsample2D(nn.Module):
    method setup (line 23) | def setup(self):
    method __call__ (line 32) | def __call__(self, hidden_states):
  class FlaxDownsample2D (line 43) | class FlaxDownsample2D(nn.Module):
    method setup (line 47) | def setup(self):
    method __call__ (line 56) | def __call__(self, hidden_states):
  class FlaxResnetBlock2D (line 63) | class FlaxResnetBlock2D(nn.Module):
    method setup (line 70) | def setup(self):
    method __call__ (line 106) | def __call__(self, hidden_states, temb, deterministic=True):

FILE: src/diffusers/models/transformers/auraflow_transformer_2d.py
  function find_multiple (line 41) | def find_multiple(n: int, k: int) -> int:
  class AuraFlowPatchEmbed (line 49) | class AuraFlowPatchEmbed(nn.Module):
    method __init__ (line 50) | def __init__(
    method forward (line 71) | def forward(self, latent):
  class AuraFlowFeedForward (line 88) | class AuraFlowFeedForward(nn.Module):
    method __init__ (line 89) | def __init__(self, dim, hidden_dim=None) -> None:
    method forward (line 101) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class AuraFlowPreFinalBlock (line 107) | class AuraFlowPreFinalBlock(nn.Module):
    method __init__ (line 108) | def __init__(self, embedding_dim: int, conditioning_embedding_dim: int):
    method forward (line 114) | def forward(self, x: torch.Tensor, conditioning_embedding: torch.Tenso...
  class AuraFlowSingleTransformerBlock (line 122) | class AuraFlowSingleTransformerBlock(nn.Module):
    method __init__ (line 125) | def __init__(self, dim, num_attention_heads, attention_head_dim):
    method forward (line 146) | def forward(self, hidden_states: torch.FloatTensor, temb: torch.FloatT...
  class AuraFlowJointTransformerBlock (line 166) | class AuraFlowJointTransformerBlock(nn.Module):
    method __init__ (line 181) | def __init__(self, dim, num_attention_heads, attention_head_dim):
    method forward (line 208) | def forward(
  class AuraFlowTransformer2DModel (line 240) | class AuraFlowTransformer2DModel(ModelMixin, ConfigMixin):
    method __init__ (line 264) | def __init__(
    method attn_processors (line 330) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 354) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method fuse_qkv_projections (line 389) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 415) | def unfuse_qkv_projections(self):
    method _set_gradient_checkpointing (line 428) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 432) | def forward(

FILE: src/diffusers/models/transformers/cogvideox_transformer_3d.py
  class CogVideoXBlock (line 35) | class CogVideoXBlock(nn.Module):
    method __init__ (line 63) | def __init__(
    method forward (line 107) | def forward(
  class CogVideoXTransformer3DModel (line 145) | class CogVideoXTransformer3DModel(ModelMixin, ConfigMixin):
    method __init__ (line 185) | def __init__(
    method _set_gradient_checkpointing (line 271) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 274) | def forward(

FILE: src/diffusers/models/transformers/dit_transformer_2d.py
  class DiTTransformer2DModel (line 31) | class DiTTransformer2DModel(ModelMixin, ConfigMixin):
    method __init__ (line 70) | def __init__(
    method _set_gradient_checkpointing (line 146) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 150) | def forward(

FILE: src/diffusers/models/transformers/dual_transformer_2d.py
  class DualTransformer2DModel (line 22) | class DualTransformer2DModel(nn.Module):
    method __init__ (line 49) | def __init__(
    method forward (line 98) | def forward(

FILE: src/diffusers/models/transformers/hunyuan_transformer_2d.py
  class AdaLayerNormShift (line 37) | class AdaLayerNormShift(nn.Module):
    method __init__ (line 46) | def __init__(self, embedding_dim: int, elementwise_affine=True, eps=1e...
    method forward (line 52) | def forward(self, x: torch.Tensor, emb: torch.Tensor) -> torch.Tensor:
  class HunyuanDiTBlock (line 59) | class HunyuanDiTBlock(nn.Module):
    method __init__ (line 91) | def __init__(
    method set_chunk_feed_forward (line 161) | def set_chunk_feed_forward(self, chunk_size: Optional[int], dim: int =...
    method forward (line 166) | def forward(
  class HunyuanDiT2DModel (line 203) | class HunyuanDiT2DModel(ModelMixin, ConfigMixin):
    method __init__ (line 248) | def __init__(
    method fuse_qkv_projections (line 321) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 347) | def unfuse_qkv_projections(self):
    method attn_processors (line 362) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 386) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 420) | def set_default_attn_processor(self):
    method forward (line 426) | def forward(
    method enable_forward_chunking (line 539) | def enable_forward_chunking(self, chunk_size: Optional[int] = None, di...
    method disable_forward_chunking (line 569) | def disable_forward_chunking(self):

FILE: src/diffusers/models/transformers/latte_transformer_3d.py
  class LatteTransformer3DModel (line 28) | class LatteTransformer3DModel(ModelMixin, ConfigMixin):
    method __init__ (line 69) | def __init__(
    method _set_gradient_checkpointing (line 165) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 168) | def forward(

FILE: src/diffusers/models/transformers/lumina_nextdit2d.py
  class LuminaNextDiTBlock (line 36) | class LuminaNextDiTBlock(nn.Module):
    method __init__ (line 53) | def __init__(
    method forward (line 118) | def forward(
  class LuminaNextDiT2DModel (line 178) | class LuminaNextDiT2DModel(ModelMixin, ConfigMixin):
    method __init__ (line 225) | def __init__(
    method forward (line 289) | def forward(

FILE: src/diffusers/models/transformers/pixart_transformer_2d.py
  class PixArtTransformer2DModel (line 32) | class PixArtTransformer2DModel(ModelMixin, ConfigMixin):
    method __init__ (line 84) | def __init__(
    method _set_gradient_checkpointing (line 186) | def _set_gradient_checkpointing(self, module, value=False):
    method attn_processors (line 192) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 216) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method fuse_qkv_projections (line 251) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 277) | def unfuse_qkv_projections(self):
    method forward (line 290) | def forward(

FILE: src/diffusers/models/transformers/prior_transformer.py
  class PriorTransformerOutput (line 24) | class PriorTransformerOutput(BaseOutput):
  class PriorTransformer (line 36) | class PriorTransformer(ModelMixin, ConfigMixin, UNet2DConditionLoadersMi...
    method __init__ (line 74) | def __init__(
    method attn_processors (line 171) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 195) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 230) | def set_default_attn_processor(self):
    method forward (line 245) | def forward(
    method post_process_latents (line 378) | def post_process_latents(self, prior_latents):

FILE: src/diffusers/models/transformers/stable_audio_transformer.py
  class StableAudioGaussianFourierProjection (line 39) | class StableAudioGaussianFourierProjection(nn.Module):
    method __init__ (line 43) | def __init__(
    method forward (line 58) | def forward(self, x):
  class StableAudioDiTBlock (line 72) | class StableAudioDiTBlock(nn.Module):
    method __init__ (line 88) | def __init__(
    method set_chunk_feed_forward (line 146) | def set_chunk_feed_forward(self, chunk_size: Optional[int], dim: int =...
    method forward (line 151) | def forward(
  class StableAudioDiTModel (line 190) | class StableAudioDiTModel(ModelMixin, ConfigMixin):
    method __init__ (line 216) | def __init__(
    method attn_processors (line 283) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 307) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 342) | def set_default_attn_processor(self):
    method _set_gradient_checkpointing (line 348) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 352) | def forward(

FILE: src/diffusers/models/transformers/t5_film_transformer.py
  class T5FilmDecoder (line 26) | class T5FilmDecoder(ModelMixin, ConfigMixin):
    method __init__ (line 50) | def __init__(
    method encoder_decoder_mask (line 89) | def encoder_decoder_mask(self, query_input: torch.Tensor, key_input: t...
    method forward (line 93) | def forward(self, encodings_and_masks, decoder_input_tokens, decoder_n...
  class DecoderLayer (line 150) | class DecoderLayer(nn.Module):
    method __init__ (line 169) | def __init__(
    method forward (line 196) | def forward(
  class T5LayerSelfAttentionCond (line 228) | class T5LayerSelfAttentionCond(nn.Module):
    method __init__ (line 243) | def __init__(self, d_model: int, d_kv: int, num_heads: int, dropout_ra...
    method forward (line 250) | def forward(
  class T5LayerCrossAttention (line 270) | class T5LayerCrossAttention(nn.Module):
    method __init__ (line 287) | def __init__(self, d_model: int, d_kv: int, num_heads: int, dropout_ra...
    method forward (line 293) | def forward(
  class T5LayerFFCond (line 309) | class T5LayerFFCond(nn.Module):
    method __init__ (line 324) | def __init__(self, d_model: int, d_ff: int, dropout_rate: float, layer...
    method forward (line 331) | def forward(self, hidden_states: torch.Tensor, conditioning_emb: Optio...
  class T5DenseGatedActDense (line 341) | class T5DenseGatedActDense(nn.Module):
    method __init__ (line 354) | def __init__(self, d_model: int, d_ff: int, dropout_rate: float):
    method forward (line 362) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class T5LayerNorm (line 372) | class T5LayerNorm(nn.Module):
    method __init__ (line 383) | def __init__(self, hidden_size: int, eps: float = 1e-6):
    method forward (line 391) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class NewGELUActivation (line 407) | class NewGELUActivation(nn.Module):
    method forward (line 413) | def forward(self, input: torch.Tensor) -> torch.Tensor:
  class T5FiLMLayer (line 417) | class T5FiLMLayer(nn.Module):
    method __init__ (line 428) | def __init__(self, in_features: int, out_features: int):
    method forward (line 432) | def forward(self, x: torch.Tensor, conditioning_emb: torch.Tensor) -> ...

FILE: src/diffusers/models/transformers/transformer_2d.py
  class Transformer2DModelOutput (line 32) | class Transformer2DModelOutput(Transformer2DModelOutput):
    method __init__ (line 33) | def __init__(self, *args, **kwargs):
  class Transformer2DModel (line 39) | class Transformer2DModel(LegacyModelMixin, LegacyConfigMixin):
    method __init__ (line 71) | def __init__(
    method _init_continuous_input (line 174) | def _init_continuous_input(self, norm_type):
    method _init_vectorized_inputs (line 211) | def _init_vectorized_inputs(self, norm_type):
    method _init_patched_inputs (line 251) | def _init_patched_inputs(self, norm_type):
    method _set_gradient_checkpointing (line 323) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 327) | def forward(
    method _operate_on_continuous_inputs (line 479) | def _operate_on_continuous_inputs(self, hidden_states):
    method _operate_on_patched_inputs (line 494) | def _operate_on_patched_inputs(self, hidden_states, encoder_hidden_sta...
    method _get_output_for_continuous_inputs (line 514) | def _get_output_for_continuous_inputs(self, hidden_states, residual, b...
    method _get_output_for_vectorized_inputs (line 529) | def _get_output_for_vectorized_inputs(self, hidden_states):
    method _get_output_for_patched_inputs (line 538) | def _get_output_for_patched_inputs(

FILE: src/diffusers/models/transformers/transformer_flux.py
  function rope (line 38) | def rope(pos: torch.Tensor, dim: int, theta: int) -> torch.Tensor:
  class EmbedND (line 55) | class EmbedND(nn.Module):
    method __init__ (line 56) | def __init__(self, dim: int, theta: int, axes_dim: List[int]):
    method forward (line 62) | def forward(self, ids: torch.Tensor) -> torch.Tensor:
  class FluxSingleTransformerBlock (line 72) | class FluxSingleTransformerBlock(nn.Module):
    method __init__ (line 86) | def __init__(self, dim, num_attention_heads, attention_head_dim, mlp_r...
    method forward (line 109) | def forward(
  class FluxTransformerBlock (line 143) | class FluxTransformerBlock(nn.Module):
    method __init__ (line 157) | def __init__(self, dim, num_attention_heads, attention_head_dim, qk_no...
    method forward (line 194) | def forward(
  class FluxTransformer2DModel (line 250) | class FluxTransformer2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin, ...
    method __init__ (line 271) | def __init__(
    method _set_gradient_checkpointing (line 326) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 330) | def forward(

FILE: src/diffusers/models/transformers/transformer_sd3.py
  class SD3Transformer2DModel (line 35) | class SD3Transformer2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin, F...
    method __init__ (line 59) | def __init__(
    method enable_forward_chunking (line 111) | def enable_forward_chunking(self, chunk_size: Optional[int] = None, di...
    method disable_forward_chunking (line 141) | def disable_forward_chunking(self):
    method attn_processors (line 154) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 178) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method fuse_qkv_projections (line 213) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 239) | def unfuse_qkv_projections(self):
    method _set_gradient_checkpointing (line 252) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 256) | def forward(

FILE: src/diffusers/models/transformers/transformer_temporal.py
  class TransformerTemporalModelOutput (line 29) | class TransformerTemporalModelOutput(BaseOutput):
  class TransformerTemporalModel (line 41) | class TransformerTemporalModel(ModelMixin, ConfigMixin):
    method __init__ (line 71) | def __init__(
    method forward (line 121) | def forward(
  class TransformerSpatioTemporalModel (line 203) | class TransformerSpatioTemporalModel(nn.Module):
    method __init__ (line 218) | def __init__(
    method forward (line 278) | def forward(

FILE: src/diffusers/models/unets/unet_1d.py
  class UNet1DOutput (line 29) | class UNet1DOutput(BaseOutput):
  class UNet1DModel (line 41) | class UNet1DModel(ModelMixin, ConfigMixin):
    method __init__ (line 75) | def __init__(
    method forward (line 195) | def forward(

FILE: src/diffusers/models/unets/unet_1d_blocks.py
  class DownResnetBlock1D (line 25) | class DownResnetBlock1D(nn.Module):
    method __init__ (line 26) | def __init__(
    method forward (line 69) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class UpResnetBlock1D (line 87) | class UpResnetBlock1D(nn.Module):
    method __init__ (line 88) | def __init__(
    method forward (line 129) | def forward(
  class ValueFunctionMidBlock1D (line 152) | class ValueFunctionMidBlock1D(nn.Module):
    method __init__ (line 153) | def __init__(self, in_channels: int, out_channels: int, embed_dim: int):
    method forward (line 164) | def forward(self, x: torch.Tensor, temb: Optional[torch.Tensor] = None...
  class MidResTemporalBlock1D (line 172) | class MidResTemporalBlock1D(nn.Module):
    method __init__ (line 173) | def __init__(
    method forward (line 212) | def forward(self, hidden_states: torch.Tensor, temb: torch.Tensor) -> ...
  class OutConv1DBlock (line 225) | class OutConv1DBlock(nn.Module):
    method __init__ (line 226) | def __init__(self, num_groups_out: int, out_channels: int, embed_dim: ...
    method forward (line 233) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class OutValueFunctionBlock (line 243) | class OutValueFunctionBlock(nn.Module):
    method __init__ (line 244) | def __init__(self, fc_dim: int, embed_dim: int, act_fn: str = "mish"):
    method forward (line 254) | def forward(self, hidden_states: torch.Tensor, temb: torch.Tensor) -> ...
  class Downsample1d (line 283) | class Downsample1d(nn.Module):
    method __init__ (line 284) | def __init__(self, kernel: str = "linear", pad_mode: str = "reflect"):
    method forward (line 291) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class Upsample1d (line 300) | class Upsample1d(nn.Module):
    method __init__ (line 301) | def __init__(self, kernel: str = "linear", pad_mode: str = "reflect"):
    method forward (line 308) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class SelfAttention1d (line 317) | class SelfAttention1d(nn.Module):
    method __init__ (line 318) | def __init__(self, in_channels: int, n_head: int = 1, dropout_rate: fl...
    method transpose_for_scores (line 332) | def transpose_for_scores(self, projection: torch.Tensor) -> torch.Tensor:
    method forward (line 338) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class ResConvBlock (line 375) | class ResConvBlock(nn.Module):
    method __init__ (line 376) | def __init__(self, in_channels: int, mid_channels: int, out_channels: ...
    method forward (line 393) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class UNetMidBlock1D (line 409) | class UNetMidBlock1D(nn.Module):
    method __init__ (line 410) | def __init__(self, mid_channels: int, in_channels: int, out_channels: ...
    method forward (line 438) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class AttnDownBlock1D (line 449) | class AttnDownBlock1D(nn.Module):
    method __init__ (line 450) | def __init__(self, out_channels: int, in_channels: int, mid_channels: ...
    method forward (line 469) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class DownBlock1D (line 479) | class DownBlock1D(nn.Module):
    method __init__ (line 480) | def __init__(self, out_channels: int, in_channels: int, mid_channels: ...
    method forward (line 493) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class DownBlock1DNoSkip (line 502) | class DownBlock1DNoSkip(nn.Module):
    method __init__ (line 503) | def __init__(self, out_channels: int, in_channels: int, mid_channels: ...
    method forward (line 515) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class AttnUpBlock1D (line 523) | class AttnUpBlock1D(nn.Module):
    method __init__ (line 524) | def __init__(self, in_channels: int, out_channels: int, mid_channels: ...
    method forward (line 543) | def forward(
  class UpBlock1D (line 561) | class UpBlock1D(nn.Module):
    method __init__ (line 562) | def __init__(self, in_channels: int, out_channels: int, mid_channels: ...
    method forward (line 575) | def forward(
  class UpBlock1DNoSkip (line 592) | class UpBlock1DNoSkip(nn.Module):
    method __init__ (line 593) | def __init__(self, in_channels: int, out_channels: int, mid_channels: ...
    method forward (line 605) | def forward(
  function get_down_block (line 626) | def get_down_block(
  function get_up_block (line 651) | def get_up_block(
  function get_mid_block (line 671) | def get_mid_block(
  function get_out_block (line 695) | def get_out_block(

FILE: src/diffusers/models/unets/unet_2d.py
  class UNet2DOutput (line 28) | class UNet2DOutput(BaseOutput):
  class UNet2DModel (line 40) | class UNet2DModel(ModelMixin, ConfigMixin):
    method __init__ (line 93) | def __init__(
    method forward (line 243) | def forward(

FILE: src/diffusers/models/unets/unet_2d_blocks.py
  function get_down_block (line 43) | def get_down_block(
  function get_mid_block (line 252) | def get_mid_block(
  function get_up_block (line 327) | def get_up_block(
  class AutoencoderTinyBlock (line 552) | class AutoencoderTinyBlock(nn.Module):
    method __init__ (line 568) | def __init__(self, in_channels: int, out_channels: int, act_fn: str):
    method forward (line 585) | def forward(self, x: torch.Tensor) -> torch.Tensor:
  class UNetMidBlock2D (line 589) | class UNetMidBlock2D(nn.Module):
    method __init__ (line 620) | def __init__(
    method forward (line 734) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class UNetMidBlock2DCrossAttn (line 744) | class UNetMidBlock2DCrossAttn(nn.Module):
    method __init__ (line 745) | def __init__(
    method forward (line 847) | def forward(
  class UNetMidBlock2DSimpleCrossAttn (line 902) | class UNetMidBlock2DSimpleCrossAttn(nn.Module):
    method __init__ (line 903) | def __init__(
    method forward (line 987) | def forward(
  class AttnDownBlock2D (line 1027) | class AttnDownBlock2D(nn.Module):
    method __init__ (line 1028) | def __init__(
    method forward (line 1119) | def forward(
  class CrossAttnDownBlock2D (line 1149) | class CrossAttnDownBlock2D(nn.Module):
    method __init__ (line 1150) | def __init__(
    method forward (line 1241) | def forward(
  class DownBlock2D (line 1312) | class DownBlock2D(nn.Module):
    method __init__ (line 1313) | def __init__(
    method forward (line 1364) | def forward(
  class DownEncoderBlock2D (line 1404) | class DownEncoderBlock2D(nn.Module):
    method __init__ (line 1405) | def __init__(
    method forward (line 1468) | def forward(self, hidden_states: torch.Tensor, *args, **kwargs) -> tor...
  class AttnDownEncoderBlock2D (line 1483) | class AttnDownEncoderBlock2D(nn.Module):
    method __init__ (line 1484) | def __init__(
    method forward (line 1570) | def forward(self, hidden_states: torch.Tensor, *args, **kwargs) -> tor...
  class AttnSkipDownBlock2D (line 1586) | class AttnSkipDownBlock2D(nn.Module):
    method __init__ (line 1587) | def __init__(
    method forward (line 1667) | def forward(
  class SkipDownBlock2D (line 1698) | class SkipDownBlock2D(nn.Module):
    method __init__ (line 1699) | def __init__(
    method forward (line 1758) | def forward(
  class ResnetDownsampleBlock2D (line 1788) | class ResnetDownsampleBlock2D(nn.Module):
    method __init__ (line 1789) | def __init__(
    method forward (line 1852) | def forward(
  class SimpleCrossAttnDownBlock2D (line 1892) | class SimpleCrossAttnDownBlock2D(nn.Module):
    method __init__ (line 1893) | def __init__(
    method forward (line 1987) | def forward(
  class KDownBlock2D (line 2053) | class KDownBlock2D(nn.Module):
    method __init__ (line 2054) | def __init__(
    method forward (line 2099) | def forward(
  class KCrossAttnDownBlock2D (line 2137) | class KCrossAttnDownBlock2D(nn.Module):
    method __init__ (line 2138) | def __init__(
    method forward (line 2202) | def forward(
  class AttnUpBlock2D (line 2267) | class AttnUpBlock2D(nn.Module):
    method __init__ (line 2268) | def __init__(
    method forward (line 2359) | def forward(
  class CrossAttnUpBlock2D (line 2391) | class CrossAttnUpBlock2D(nn.Module):
    method __init__ (line 2392) | def __init__(
    method forward (line 2482) | def forward(
  class UpBlock2D (line 2567) | class UpBlock2D(nn.Module):
    method __init__ (line 2568) | def __init__(
    method forward (line 2617) | def forward(
  class UpDecoderBlock2D (line 2682) | class UpDecoderBlock2D(nn.Module):
    method __init__ (line 2683) | def __init__(
    method forward (line 2744) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class AttnUpDecoderBlock2D (line 2755) | class AttnUpDecoderBlock2D(nn.Module):
    method __init__ (line 2756) | def __init__(
    method forward (line 2842) | def forward(self, hidden_states: torch.Tensor, temb: Optional[torch.Te...
  class AttnSkipUpBlock2D (line 2854) | class AttnSkipUpBlock2D(nn.Module):
    method __init__ (line 2855) | def __init__(
    method forward (line 2948) | def forward(
  class SkipUpBlock2D (line 2988) | class SkipUpBlock2D(nn.Module):
    method __init__ (line 2989) | def __init__(
    method forward (line 3060) | def forward(
  class ResnetUpsampleBlock2D (line 3098) | class ResnetUpsampleBlock2D(nn.Module):
    method __init__ (line 3099) | def __init__(
    method forward (line 3167) | def forward(
  class SimpleCrossAttnUpBlock2D (line 3212) | class SimpleCrossAttnUpBlock2D(nn.Module):
    method __init__ (line 3213) | def __init__(
    method forward (line 3311) | def forward(
  class KUpBlock2D (line 3379) | class KUpBlock2D(nn.Module):
    method __init__ (line 3380) | def __init__(
    method forward (line 3429) | def forward(
  class KCrossAttnUpBlock2D (line 3473) | class KCrossAttnUpBlock2D(nn.Module):
    method __init__ (line 3474) | def __init__(
    method forward (line 3559) | def forward(
  class KAttentionBlock (line 3620) | class KAttentionBlock(nn.Module):
    method __init__ (line 3644) | def __init__(
    method _to_3d (line 3687) | def _to_3d(self, hidden_states: torch.Tensor, height: int, weight: int...
    method _to_4d (line 3690) | def _to_4d(self, hidden_states: torch.Tensor, height: int, weight: int...
    method forward (line 3693) | def forward(

FILE: src/diffusers/models/unets/unet_2d_blocks_flax.py
  class FlaxCrossAttnDownBlock2D (line 22) | class FlaxCrossAttnDownBlock2D(nn.Module):
    method setup (line 62) | def setup(self):
    method __call__ (line 96) | def __call__(self, hidden_states, temb, encoder_hidden_states, determi...
  class FlaxDownBlock2D (line 111) | class FlaxDownBlock2D(nn.Module):
    method setup (line 137) | def setup(self):
    method __call__ (line 155) | def __call__(self, hidden_states, temb, deterministic=True):
  class FlaxCrossAttnUpBlock2D (line 169) | class FlaxCrossAttnUpBlock2D(nn.Module):
    method setup (line 210) | def setup(self):
    method __call__ (line 245) | def __call__(self, hidden_states, res_hidden_states_tuple, temb, encod...
  class FlaxUpBlock2D (line 261) | class FlaxUpBlock2D(nn.Module):
    method setup (line 290) | def setup(self):
    method __call__ (line 310) | def __call__(self, hidden_states, res_hidden_states_tuple, temb, deter...
  class FlaxUNetMidBlock2DCrossAttn (line 325) | class FlaxUNetMidBlock2DCrossAttn(nn.Module):
    method setup (line 357) | def setup(self):
    method __call__ (line 394) | def __call__(self, hidden_states, temb, encoder_hidden_states, determi...

FILE: src/diffusers/models/unets/unet_2d_condition.py
  class UNet2DConditionOutput (line 59) | class UNet2DConditionOutput(BaseOutput):
  class UNet2DConditionModel (line 71) | class UNet2DConditionModel(
    method __init__ (line 171) | def __init__(
    method _check_config (line 487) | def _check_config(
    method _set_time_proj (line 539) | def _set_time_proj(
    method _set_encoder_hid_proj (line 567) | def _set_encoder_hid_proj(
    method _set_class_embedding (line 607) | def _set_class_embedding(
    method _set_add_embedding (line 644) | def _set_add_embedding(
    method _set_pos_net_if_use_gligen (line 684) | def _set_pos_net_if_use_gligen(self, attention_type: str, cross_attent...
    method attn_processors (line 698) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 721) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 755) | def set_default_attn_processor(self):
    method set_attention_slice (line 770) | def set_attention_slice(self, slice_size: Union[str, int, List[int]] =...
    method _set_gradient_checkpointing (line 835) | def _set_gradient_checkpointing(self, module, value=False):
    method enable_freeu (line 839) | def enable_freeu(self, s1: float, s2: float, b1: float, b2: float):
    method disable_freeu (line 863) | def disable_freeu(self):
    method fuse_qkv_projections (line 871) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 896) | def unfuse_qkv_projections(self):
    method get_time_embed (line 909) | def get_time_embed(
    method get_class_embed (line 935) | def get_class_embed(self, sample: torch.Tensor, class_labels: Optional...
    method get_aug_embed (line 951) | def get_aug_embed(
    method process_encoder_hidden_states (line 1003) | def process_encoder_hidden_states(
    method forward (line 1039) | def forward(

FILE: src/diffusers/models/unets/unet_2d_condition_flax.py
  class FlaxUNet2DConditionOutput (line 36) | class FlaxUNet2DConditionOutput(BaseOutput):
  class FlaxUNet2DConditionModel (line 49) | class FlaxUNet2DConditionModel(nn.Module, FlaxModelMixin, ConfigMixin):
    method init_weights (line 133) | def init_weights(self, rng: jax.Array) -> FrozenDict:
    method setup (line 165) | def setup(self) -> None:
    method __call__ (line 330) | def __call__(

FILE: src/diffusers/models/unets/unet_3d_blocks.py
  class DownBlockMotion (line 47) | class DownBlockMotion(DownBlockMotion):
    method __init__ (line 48) | def __init__(self, *args, **kwargs):
  class CrossAttnDownBlockMotion (line 54) | class CrossAttnDownBlockMotion(CrossAttnDownBlockMotion):
    method __init__ (line 55) | def __init__(self, *args, **kwargs):
  class UpBlockMotion (line 61) | class UpBlockMotion(UpBlockMotion):
    method __init__ (line 62) | def __init__(self, *args, **kwargs):
  class CrossAttnUpBlockMotion (line 68) | class CrossAttnUpBlockMotion(CrossAttnUpBlockMotion):
    method __init__ (line 69) | def __init__(self, *args, **kwargs):
  class UNetMidBlockCrossAttnMotion (line 75) | class UNetMidBlockCrossAttnMotion(UNetMidBlockCrossAttnMotion):
    method __init__ (line 76) | def __init__(self, *args, **kwargs):
  function get_down_block (line 82) | def get_down_block(
  function get_up_block (line 174) | def get_up_block(
  class UNetMidBlock3DCrossAttn (line 274) | class UNetMidBlock3DCrossAttn(nn.Module):
    method __init__ (line 275) | def __init__(
    method forward (line 376) | def forward(
  class CrossAttnDownBlock3D (line 408) | class CrossAttnDownBlock3D(nn.Module):
    method __init__ (line 409) | def __init__(
    method forward (line 509) | def forward(
  class DownBlock3D (line 550) | class DownBlock3D(nn.Module):
    method __init__ (line 551) | def __init__(
    method forward (line 616) | def forward(
  class CrossAttnUpBlock3D (line 639) | class CrossAttnUpBlock3D(nn.Module):
    method __init__ (line 640) | def __init__(
    method forward (line 734) | def forward(
  class UpBlock3D (line 796) | class UpBlock3D(nn.Module):
    method __init__ (line 797) | def __init__(
    method forward (line 856) | def forward(
  class MidBlockTemporalDecoder (line 899) | class MidBlockTemporalDecoder(nn.Module):
    method __init__ (line 900) | def __init__(
    method forward (line 943) | def forward(
  class UpBlockTemporalDecoder (line 962) | class UpBlockTemporalDecoder(nn.Module):
    method __init__ (line 963) | def __init__(
    method forward (line 994) | def forward(
  class UNetMidBlockSpatioTemporal (line 1012) | class UNetMidBlockSpatioTemporal(nn.Module):
    method __init__ (line 1013) | def __init__(
    method forward (line 1067) | def forward(
  class DownBlockSpatioTemporal (line 1122) | class DownBlockSpatioTemporal(nn.Module):
    method __init__ (line 1123) | def __init__(
    method forward (line 1163) | def forward(
  class CrossAttnDownBlockSpatioTemporal (line 1212) | class CrossAttnDownBlockSpatioTemporal(nn.Module):
    method __init__ (line 1213) | def __init__(
    method forward (line 1273) | def forward(
  class UpBlockSpatioTemporal (line 1334) | class UpBlockSpatioTemporal(nn.Module):
    method __init__ (line 1335) | def __init__(
    method forward (line 1372) | def forward(
  class CrossAttnUpBlockSpatioTemporal (line 1423) | class CrossAttnUpBlockSpatioTemporal(nn.Module):
    method __init__ (line 1424) | def __init__(
    method forward (line 1481) | def forward(

FILE: src/diffusers/models/unets/unet_3d_condition.py
  class UNet3DConditionOutput (line 54) | class UNet3DConditionOutput(BaseOutput):
  class UNet3DConditionModel (line 66) | class UNet3DConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoade...
    method __init__ (line 102) | def __init__(
    method attn_processors (line 294) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attention_slice (line 318) | def set_attention_slice(self, slice_size: Union[str, int, List[int]]) ...
    method set_attn_processor (line 384) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method enable_forward_chunking (line 418) | def enable_forward_chunking(self, chunk_size: Optional[int] = None, di...
    method disable_forward_chunking (line 447) | def disable_forward_chunking(self):
    method set_default_attn_processor (line 459) | def set_default_attn_processor(self):
    method _set_gradient_checkpointing (line 474) | def _set_gradient_checkpointing(self, module, value: bool = False) -> ...
    method enable_freeu (line 479) | def enable_freeu(self, s1, s2, b1, b2):
    method disable_freeu (line 504) | def disable_freeu(self):
    method fuse_qkv_projections (line 513) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 539) | def unfuse_qkv_projections(self):
    method forward (line 552) | def forward(

FILE: src/diffusers/models/unets/unet_i2vgen_xl.py
  class I2VGenXLTransformerTemporalEncoder (line 52) | class I2VGenXLTransformerTemporalEncoder(nn.Module):
    method __init__ (line 53) | def __init__(
    method forward (line 83) | def forward(
  class I2VGenXLUNet (line 101) | class I2VGenXLUNet(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin):
    method __init__ (line 131) | def __init__(
    method attn_processors (line 323) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 347) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method enable_forward_chunking (line 382) | def enable_forward_chunking(self, chunk_size: Optional[int] = None, di...
    method disable_forward_chunking (line 412) | def disable_forward_chunking(self):
    method set_default_attn_processor (line 424) | def set_default_attn_processor(self):
    method _set_gradient_checkpointing (line 440) | def _set_gradient_checkpointing(self, module, value: bool = False) -> ...
    method enable_freeu (line 445) | def enable_freeu(self, s1, s2, b1, b2):
    method disable_freeu (line 470) | def disable_freeu(self):
    method fuse_qkv_projections (line 479) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 505) | def unfuse_qkv_projections(self):
    method forward (line 518) | def forward(

FILE: src/diffusers/models/unets/unet_kandinsky3.py
  class Kandinsky3UNetOutput (line 33) | class Kandinsky3UNetOutput(BaseOutput):
  class Kandinsky3EncoderProj (line 37) | class Kandinsky3EncoderProj(nn.Module):
    method __init__ (line 38) | def __init__(self, encoder_hid_dim, cross_attention_dim):
    method forward (line 43) | def forward(self, x):
  class Kandinsky3UNet (line 49) | class Kandinsky3UNet(ModelMixin, ConfigMixin):
    method __init__ (line 51) | def __init__(
    method attn_processors (line 145) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 168) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 202) | def set_default_attn_processor(self):
    method _set_gradient_checkpointing (line 208) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 212) | def forward(self, sample, timestep, encoder_hidden_states=None, encode...
  class Kandinsky3UpSampleBlock (line 254) | class Kandinsky3UpSampleBlock(nn.Module):
    method __init__ (line 255) | def __init__(
    method forward (line 313) | def forward(self, x, time_embed, context=None, context_mask=None, imag...
  class Kandinsky3DownSampleBlock (line 325) | class Kandinsky3DownSampleBlock(nn.Module):
    method __init__ (line 326) | def __init__(
    method forward (line 381) | def forward(self, x, time_embed, context=None, context_mask=None, imag...
  class Kandinsky3ConditionalGroupNorm (line 393) | class Kandinsky3ConditionalGroupNorm(nn.Module):
    method __init__ (line 394) | def __init__(self, groups, normalized_shape, context_dim):
    method forward (line 401) | def forward(self, x, context):
  class Kandinsky3Block (line 412) | class Kandinsky3Block(nn.Module):
    method __init__ (line 413) | def __init__(self, in_channels, out_channels, time_embed_dim, kernel_s...
    method forward (line 430) | def forward(self, x, time_embed):
  class Kandinsky3ResNetBlock (line 439) | class Kandinsky3ResNetBlock(nn.Module):
    method __init__ (line 440) | def __init__(
    method forward (line 471) | def forward(self, x, time_embed):
  class Kandinsky3AttentionPooling (line 483) | class Kandinsky3AttentionPooling(nn.Module):
    method __init__ (line 484) | def __init__(self, num_channels, context_dim, head_dim=64):
    method forward (line 494) | def forward(self, x, context, context_mask=None):
  class Kandinsky3AttentionBlock (line 500) | class Kandinsky3AttentionBlock(nn.Module):
    method __init__ (line 501) | def __init__(self, num_channels, time_embed_dim, context_dim=None, nor...
    method forward (line 520) | def forward(self, x, time_embed, context=None, context_mask=None, imag...

FILE: src/diffusers/models/unets/unet_motion_model.py
  class UNetMotionOutput (line 53) | class UNetMotionOutput(BaseOutput):
  class AnimateDiffTransformer3D (line 65) | class AnimateDiffTransformer3D(nn.Module):
    method __init__ (line 94) | def __init__(
    method forward (line 144) | def forward(
  class DownBlockMotion (line 216) | class DownBlockMotion(nn.Module):
    method __init__ (line 217) | def __init__(
    method forward (line 310) | def forward(
  class CrossAttnDownBlockMotion (line 362) | class CrossAttnDownBlockMotion(nn.Module):
    method __init__ (line 363) | def __init__(
    method forward (line 497) | def forward(
  class CrossAttnUpBlockMotion (line 573) | class CrossAttnUpBlockMotion(nn.Module):
    method __init__ (line 574) | def __init__(
    method forward (line 699) | def forward(
  class UpBlockMotion (line 791) | class UpBlockMotion(nn.Module):
    method __init__ (line 792) | def __init__(
    method forward (line 870) | def forward(
  class UNetMidBlockCrossAttnMotion (line 943) | class UNetMidBlockCrossAttnMotion(nn.Module):
    method __init__ (line 944) | def __init__(
    method forward (line 1069) | def forward(
  class MotionModules (line 1137) | class MotionModules(nn.Module):
    method __init__ (line 1138) | def __init__(
  class MotionAdapter (line 1178) | class MotionAdapter(ModelMixin, ConfigMixin, FromOriginalModelMixin):
    method __init__ (line 1180) | def __init__(
    method forward (line 1311) | def forward(self, sample):
  class UNetMotionModel (line 1315) | class UNetMotionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMix...
    method __init__ (line 1327) | def __init__(
    method from_unet2d (line 1651) | def from_unet2d(
    method freeze_unet2d_params (line 1804) | def freeze_unet2d_params(self) -> None:
    method load_motion_modules (line 1828) | def load_motion_modules(self, motion_adapter: Optional[MotionAdapter])...
    method save_motion_modules (line 1838) | def save_motion_modules(
    method attn_processors (line 1875) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 1899) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method enable_forward_chunking (line 1933) | def enable_forward_chunking(self, chunk_size: Optional[int] = None, di...
    method disable_forward_chunking (line 1962) | def disable_forward_chunking(self) -> None:
    method set_default_attn_processor (line 1974) | def set_default_attn_processor(self) -> None:
    method _set_gradient_checkpointing (line 1989) | def _set_gradient_checkpointing(self, module, value: bool = False) -> ...
    method enable_freeu (line 1994) | def enable_freeu(self, s1: float, s2: float, b1: float, b2: float) -> ...
    method disable_freeu (line 2019) | def disable_freeu(self) -> None:
    method fuse_qkv_projections (line 2028) | def fuse_qkv_projections(self):
    method unfuse_qkv_projections (line 2054) | def unfuse_qkv_projections(self):
    method forward (line 2067) | def forward(

FILE: src/diffusers/models/unets/unet_spatio_temporal_condition.py
  class UNetSpatioTemporalConditionOutput (line 20) | class UNetSpatioTemporalConditionOutput(BaseOutput):
  class UNetSpatioTemporalConditionModel (line 32) | class UNetSpatioTemporalConditionModel(ModelMixin, ConfigMixin, UNet2DCo...
    method __init__ (line 71) | def __init__(
    method attn_processors (line 249) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 276) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 310) | def set_default_attn_processor(self):
    method _set_gradient_checkpointing (line 323) | def _set_gradient_checkpointing(self, module, value=False):
    method enable_forward_chunking (line 328) | def enable_forward_chunking(self, chunk_size: Optional[int] = None, di...
    method forward (line 357) | def forward(

FILE: src/diffusers/models/unets/unet_stable_cascade.py
  class SDCascadeLayerNorm (line 31) | class SDCascadeLayerNorm(nn.LayerNorm):
    method __init__ (line 32) | def __init__(self, *args, **kwargs):
    method forward (line 35) | def forward(self, x):
  class SDCascadeTimestepBlock (line 41) | class SDCascadeTimestepBlock(nn.Module):
    method __init__ (line 42) | def __init__(self, c, c_timestep, conds=[]):
    method forward (line 50) | def forward(self, x, t):
  class SDCascadeResBlock (line 59) | class SDCascadeResBlock(nn.Module):
    method __init__ (line 60) | def __init__(self, c, c_skip=0, kernel_size=3, dropout=0.0):
    method forward (line 72) | def forward(self, x, x_skip=None):
  class GlobalResponseNorm (line 82) | class GlobalResponseNorm(nn.Module):
    method __init__ (line 83) | def __init__(self, dim):
    method forward (line 88) | def forward(self, x):
  class SDCascadeAttnBlock (line 94) | class SDCascadeAttnBlock(nn.Module):
    method __init__ (line 95) | def __init__(self, c, c_cond, nhead, self_attn=True, dropout=0.0):
    method forward (line 103) | def forward(self, x, kv):
  class UpDownBlock2d (line 113) | class UpDownBlock2d(nn.Module):
    method __init__ (line 114) | def __init__(self, in_channels, out_channels, mode, enabled=True):
    method forward (line 126) | def forward(self, x):
  class StableCascadeUNetOutput (line 133) | class StableCascadeUNetOutput(BaseOutput):
  class StableCascadeUNet (line 137) | class StableCascadeUNet(ModelMixin, ConfigMixin, FromOriginalModelMixin):
    method __init__ (line 141) | def __init__(
    method _set_gradient_checkpointing (line 390) | def _set_gradient_checkpointing(self, value=False):
    method _init_weights (line 393) | def _init_weights(self, m):
    method get_timestep_ratio_embedding (line 422) | def get_timestep_ratio_embedding(self, timestep_ratio, max_positions=1...
    method get_clip_embeddings (line 436) | def get_clip_embeddings(self, clip_txt_pooled, clip_txt=None, clip_img...
    method _down_encode (line 454) | def _down_encode(self, x, r_embed, clip):
    method _up_decode (line 503) | def _up_decode(self, level_outputs, r_embed, clip):
    method forward (line 566) | def forward(

FILE: src/diffusers/models/unets/uvit_2d.py
  class UVit2DModel (line 39) | class UVit2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin):
    method __init__ (line 43) | def __init__(
    method _set_gradient_checkpointing (line 151) | def _set_gradient_checkpointing(self, module, value: bool = False) -> ...
    method forward (line 154) | def forward(self, input_ids, encoder_hidden_states, pooled_text_emb, m...
    method attn_processors (line 217) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 241) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 276) | def set_default_attn_processor(self):
  class UVit2DConvEmbed (line 292) | class UVit2DConvEmbed(nn.Module):
    method __init__ (line 293) | def __init__(self, in_channels, block_out_channels, vocab_size, elemen...
    method forward (line 299) | def forward(self, input_ids):
  class UVitBlock (line 307) | class UVitBlock(nn.Module):
    method __init__ (line 308) | def __init__(
    method forward (line 386) | def forward(self, x, pooled_text_emb, encoder_hidden_states, cross_att...
  class ConvNextBlock (line 406) | class ConvNextBlock(nn.Module):
    method __init__ (line 407) | def __init__(
    method forward (line 427) | def forward(self, x, cond_embeds):
  class ConvMlmLayer (line 451) | class ConvMlmLayer(nn.Module):
    method __init__ (line 452) | def __init__(
    method forward (line 466) | def forward(self, hidden_states):

FILE: src/diffusers/models/upsampling.py
  class Upsample1D (line 25) | class Upsample1D(nn.Module):
    method __init__ (line 41) | def __init__(
    method forward (line 62) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class Upsample2D (line 75) | class Upsample2D(nn.Module):
    method __init__ (line 91) | def __init__(
    method forward (line 141) | def forward(self, hidden_states: torch.Tensor, output_size: Optional[i...
  class FirUpsample2D (line 187) | class FirUpsample2D(nn.Module):
    method __init__ (line 201) | def __init__(
    method _upsample_2d (line 216) | def _upsample_2d(
    method forward (line 311) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
  class KUpsample2D (line 321) | class KUpsample2D(nn.Module):
    method __init__ (line 328) | def __init__(self, pad_mode: str = "reflect"):
    method forward (line 335) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  class CogVideoXUpsample3D (line 351) | class CogVideoXUpsample3D(nn.Module):
    method __init__ (line 370) | def __init__(
    method forward (line 384) | def forward(self, inputs: torch.Tensor) -> torch.Tensor:
  function upfirdn2d_native (line 415) | def upfirdn2d_native(
  function upsample_2d (line 465) | def upsample_2d(

FILE: src/diffusers/models/vae_flax.py
  class FlaxDecoderOutput (line 33) | class FlaxDecoderOutput(BaseOutput):
  class FlaxAutoencoderKLOutput (line 48) | class FlaxAutoencoderKLOutput(BaseOutput):
  class FlaxUpsample2D (line 61) | class FlaxUpsample2D(nn.Module):
    method setup (line 75) | def setup(self):
    method __call__ (line 84) | def __call__(self, hidden_states):
  class FlaxDownsample2D (line 95) | class FlaxDownsample2D(nn.Module):
    method setup (line 109) | def setup(self):
    method __call__ (line 118) | def __call__(self, hidden_states):
  class FlaxResnetBlock2D (line 125) | class FlaxResnetBlock2D(nn.Module):
    method setup (line 151) | def setup(self):
    method __call__ (line 185) | def __call__(self, hidden_states, deterministic=True):
  class FlaxAttentionBlock (line 202) | class FlaxAttentionBlock(nn.Module):
    method setup (line 223) | def setup(self):
    method transpose_for_scores (line 232) | def transpose_for_scores(self, projection):
    method __call__ (line 240) | def __call__(self, hidden_states):
  class FlaxDownEncoderBlock2D (line 275) | class FlaxDownEncoderBlock2D(nn.Module):
    method setup (line 304) | def setup(self):
    method __call__ (line 322) | def __call__(self, hidden_states, deterministic=True):
  class FlaxUpDecoderBlock2D (line 332) | class FlaxUpDecoderBlock2D(nn.Module):
    method setup (line 361) | def setup(self):
    method __call__ (line 379) | def __call__(self, hidden_states, deterministic=True):
  class FlaxUNetMidBlock2D (line 389) | class FlaxUNetMidBlock2D(nn.Module):
    method setup (line 415) | def setup(self):
    method __call__ (line 452) | def __call__(self, hidden_states, deterministic=True):
  class FlaxEncoder (line 461) | class FlaxEncoder(nn.Module):
    method setup (line 506) | def setup(self):
    method __call__ (line 555) | def __call__(self, sample, deterministic: bool = True):
  class FlaxDecoder (line 574) | class FlaxDecoder(nn.Module):
    method setup (line 618) | def setup(self):
    method __call__ (line 671) | def __call__(self, sample, deterministic: bool = True):
  class FlaxDiagonalGaussianDistribution (line 689) | class FlaxDiagonalGaussianDistribution(object):
    method __init__ (line 690) | def __init__(self, parameters, deterministic=False):
    method sample (line 700) | def sample(self, key):
    method kl (line 703) | def kl(self, other=None):
    method nll (line 715) | def nll(self, sample, axis=[1, 2, 3]):
    method mode (line 722) | def mode(self):
  class FlaxAutoencoderKL (line 727) | class FlaxAutoencoderKL(nn.Module, FlaxModelMixin, ConfigMixin):
    method setup (line 790) | def setup(self):
    method init_weights (line 827) | def init_weights(self, rng: jax.Array) -> FrozenDict:
    method encode (line 837) | def encode(self, sample, deterministic: bool = True, return_dict: bool...
    method decode (line 849) | def decode(self, latents, deterministic: bool = True, return_dict: boo...
    method __call__ (line 863) | def __call__(self, sample, sample_posterior=False, deterministic: bool...

FILE: src/diffusers/models/vq_model.py
  class VQEncoderOutput (line 18) | class VQEncoderOutput(VQEncoderOutput):
    method __init__ (line 19) | def __init__(self, *args, **kwargs):
  class VQModel (line 25) | class VQModel(VQModel):
    method __init__ (line 26) | def __init__(self, *args, **kwargs):

FILE: src/diffusers/optimization.py
  class SchedulerType (line 30) | class SchedulerType(Enum):
  function get_constant_schedule (line 40) | def get_constant_schedule(optimizer: Optimizer, last_epoch: int = -1) ->...
  function get_constant_schedule_with_warmup (line 56) | def get_constant_schedule_with_warmup(optimizer: Optimizer, num_warmup_s...
  function get_piecewise_constant_schedule (line 81) | def get_piecewise_constant_schedule(optimizer: Optimizer, step_rules: st...
  function get_linear_schedule_with_warmup (line 123) | def get_linear_schedule_with_warmup(
  function get_cosine_schedule_with_warmup (line 154) | def get_cosine_schedule_with_warmup(
  function get_cosine_with_hard_restarts_schedule_with_warmup (line 188) | def get_cosine_with_hard_restarts_schedule_with_warmup(
  function get_polynomial_decay_schedule_with_warmup (line 223) | def get_polynomial_decay_schedule_with_warmup(
  function get_scheduler (line 289) | def get_scheduler(

FILE: src/diffusers/pipelines/amused/pipeline_amused.py
  class AmusedPipeline (line 42) | class AmusedPipeline(DiffusionPipeline):
    method __init__ (line 52) | def __init__(
    method __call__ (line 74) | def __call__(

FILE: src/diffusers/pipelines/amused/pipeline_amused_img2img.py
  class AmusedImg2ImgPipeline (line 52) | class AmusedImg2ImgPipeline(DiffusionPipeline):
    method __init__ (line 67) | def __init__(
    method __call__ (line 89) | def __call__(

FILE: src/diffusers/pipelines/amused/pipeline_amused_inpaint.py
  class AmusedInpaintPipeline (line 60) | class AmusedInpaintPipeline(DiffusionPipeline):
    method __init__ (line 75) | def __init__(
    method __call__ (line 105) | def __call__(

FILE: src/diffusers/pipelines/animatediff/pipeline_animatediff.py
  class AnimateDiffPipeline (line 69) | class AnimateDiffPipeline(
    method __init__ (line 110) | def __init__(
    method encode_prompt (line 146) | def encode_prompt(
    method encode_image (line 329) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 354) | def prepare_ip_adapter_image_embeds(
    method decode_latents (line 399) | def decode_latents(self, latents, decode_chunk_size: int = 16):
    method prepare_extra_step_kwargs (line 418) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 436) | def check_inputs(
    method prepare_latents (line 505) | def prepare_latents(
    method guidance_scale (line 538) | def guidance_scale(self):
    method clip_skip (line 542) | def clip_skip(self):
    method do_classifier_free_guidance (line 549) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 553) | def cross_attention_kwargs(self):
    method num_timesteps (line 557) | def num_timesteps(self):
    method __call__ (line 562) | def __call__(

FILE: src/diffusers/pipelines/animatediff/pipeline_animatediff_controlnet.py
  class AnimateDiffControlNetPipeline (line 106) | class AnimateDiffControlNetPipeline(
    method __init__ (line 147) | def __init__(
    method encode_prompt (line 184) | def encode_prompt(
    method encode_image (line 367) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 392) | def prepare_ip_adapter_image_embeds(
    method decode_latents (line 438) | def decode_latents(self, latents, decode_chunk_size: int = 16):
    method prepare_extra_step_kwargs (line 457) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 474) | def check_inputs(
    method prepare_latents (line 615) | def prepare_latents(
    method prepare_video (line 647) | def prepare_video(
    method guidance_scale (line 680) | def guidance_scale(self):
    method clip_skip (line 684) | def clip_skip(self):
    method do_classifier_free_guidance (line 691) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 695) | def cross_attention_kwargs(self):
    method num_timesteps (line 699) | def num_timesteps(self):
    method __call__ (line 703) | def __call__(

FILE: src/diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py
  function rescale_noise_cfg (line 115) | def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
  function retrieve_timesteps (line 130) | def retrieve_timesteps(
  class AnimateDiffSDXLPipeline (line 189) | class AnimateDiffSDXLPipeline(
    method __init__ (line 259) | def __init__(
    method encode_prompt (line 304) | def encode_prompt(
    method encode_image (line 539) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 564) | def prepare_ip_adapter_image_embeds(
    method decode_latents (line 610) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 623) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 640) | def check_inputs(
    method prepare_latents (line 713) | def prepare_latents(
    method _get_add_time_ids (line 738) | def _get_add_time_ids(
    method upcast_vae (line 756) | def upcast_vae(self):
    method get_guidance_scale_embedding (line 775) | def get_guidance_scale_embedding(
    method guidance_scale (line 806) | def guidance_scale(self):
    method guidance_rescale (line 810) | def guidance_rescale(self):
    method clip_skip (line 814) | def clip_skip(self):
    method do_classifier_free_guidance (line 821) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 825) | def cross_attention_kwargs(self):
    method denoising_end (line 829) | def denoising_end(self):
    method num_timesteps (line 833) | def num_timesteps(self):
    method interrupt (line 837) | def interrupt(self):
    method __call__ (line 842) | def __call__(

FILE: src/diffusers/pipelines/animatediff/pipeline_animatediff_sparsectrl.py
  function retrieve_latents (line 110) | def retrieve_latents(
  class AnimateDiffSparseControlNetPipeline (line 123) | class AnimateDiffSparseControlNetPipeline(
    method __init__ (line 164) | def __init__(
    method encode_prompt (line 198) | def encode_prompt(
    method encode_image (line 381) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 406) | def prepare_ip_adapter_image_embeds(
    method decode_latents (line 452) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 465) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 482) | def check_inputs(
    method check_image (line 577) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_latents (line 615) | def prepare_latents(
    method prepare_image (line 640) | def prepare_image(self, image, width, height, device, dtype):
    method prepare_sparse_control_conditioning (line 661) | def prepare_sparse_control_conditioning(
    method guidance_scale (line 680) | def guidance_scale(self):
    method clip_skip (line 684) | def clip_skip(self):
    method do_classifier_free_guidance (line 691) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 695) | def cross_attention_kwargs(self):
    method num_timesteps (line 699) | def num_timesteps(self):
    method __call__ (line 704) | def __call__(

FILE: src/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py
  function retrieve_latents (line 100) | def retrieve_latents(
  function retrieve_timesteps (line 114) | def retrieve_timesteps(
  class AnimateDiffVideoToVideoPipeline (line 173) | class AnimateDiffVideoToVideoPipeline(
    method __init__ (line 214) | def __init__(
    method encode_prompt (line 250) | def encode_prompt(
    method encode_image (line 433) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 458) | def prepare_ip_adapter_image_embeds(
    method encode_video (line 503) | def encode_video(self, video, generator, decode_chunk_size: int = 16) ...
    method decode_latents (line 512) | def decode_latents(self, latents, decode_chunk_size: int = 16):
    method prepare_extra_step_kwargs (line 531) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 548) | def check_inputs(
    method get_timesteps (line 620) | def get_timesteps(self, num_inference_steps, timesteps, strength, devi...
    method prepare_latents (line 629) | def prepare_latents(
    method guidance_scale (line 716) | def guidance_scale(self):
    method clip_skip (line 720) | def clip_skip(self):
    method do_classifier_free_guidance (line 727) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 731) | def cross_attention_kwargs(self):
    method num_timesteps (line 735) | def num_timesteps(self):
    method __call__ (line 739) | def __call__(

FILE: src/diffusers/pipelines/animatediff/pipeline_output.py
  class AnimateDiffPipelineOutput (line 12) | class AnimateDiffPipelineOutput(BaseOutput):

FILE: src/diffusers/pipelines/audioldm/pipeline_audioldm.py
  class AudioLDMPipeline (line 52) | class AudioLDMPipeline(DiffusionPipeline, StableDiffusionMixin):
    method __init__ (line 78) | def __init__(
    method _encode_prompt (line 99) | def _encode_prompt(
    method decode_latents (line 238) | def decode_latents(self, latents):
    method mel_spectrogram_to_waveform (line 243) | def mel_spectrogram_to_waveform(self, mel_spectrogram):
    method prepare_extra_step_kwargs (line 253) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 270) | def check_inputs(
    method prepare_latents (line 329) | def prepare_latents(self, batch_size, num_channels_latents, height, dt...
    method __call__ (line 353) | def __call__(

FILE: src/diffusers/pipelines/audioldm2/modeling_audioldm2.py
  function add_special_tokens (line 47) | def add_special_tokens(hidden_states, attention_mask, sos_token, eos_tok...
  class AudioLDM2ProjectionModelOutput (line 63) | class AudioLDM2ProjectionModelOutput(BaseOutput):
  class AudioLDM2ProjectionModel (line 82) | class AudioLDM2ProjectionModel(ModelMixin, ConfigMixin):
    method __init__ (line 98) | def __init__(
    method forward (line 126) | def forward(
  class AudioLDM2UNet2DConditionModel (line 167) | class AudioLDM2UNet2DConditionModel(ModelMixin, ConfigMixin, UNet2DCondi...
    method __init__ (line 242) | def __init__(
    method attn_processors (line 536) | def attn_processors(self) -> Dict[str, AttentionProcessor]:
    method set_attn_processor (line 560) | def set_attn_processor(self, processor: Union[AttentionProcessor, Dict...
    method set_default_attn_processor (line 595) | def set_default_attn_processor(self):
    method set_attention_slice (line 611) | def set_attention_slice(self, slice_size):
    method _set_gradient_checkpointing (line 677) | def _set_gradient_checkpointing(self, module, value=False):
    method forward (line 681) | def forward(
  function get_down_block (line 892) | def get_down_block(
  function get_up_block (line 949) | def get_up_block(
  class CrossAttnDownBlock2D (line 1006) | class CrossAttnDownBlock2D(nn.Module):
    method __init__ (line 1007) | def __init__(
    method forward (line 1092) | def forward(
  class UNetMidBlock2DCrossAttn (line 1185) | class UNetMidBlock2DCrossAttn(nn.Module):
    method __init__ (line 1186) | def __init__(
    method forward (line 1271) | def forward(
  class CrossAttnUpBlock2D (line 1356) | class CrossAttnUpBlock2D(nn.Module):
    method __init__ (line 1357) | def __init__(
    method forward (line 1438) | def forward(

FILE: src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py
  function prepare_inputs_for_generation (line 118) | def prepare_inputs_for_generation(
  class AudioLDM2Pipeline (line 136) | class AudioLDM2Pipeline(DiffusionPipeline):
    method __init__ (line 181) | def __init__(
    method enable_vae_slicing (line 213) | def enable_vae_slicing(self):
    method disable_vae_slicing (line 221) | def disable_vae_slicing(self):
    method enable_model_cpu_offload (line 228) | def enable_model_cpu_offload(self, gpu_id=0):
    method generate_language_model (line 265) | def generate_language_model(
    method encode_prompt (line 307) | def encode_prompt(
    method mel_spectrogram_to_waveform (line 640) | def mel_spectrogram_to_waveform(self, mel_spectrogram):
    method score_waveforms (line 649) | def score_waveforms(self, text, audio, num_waveforms_per_prompt, devic...
    method prepare_extra_step_kwargs (line 674) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 691) | def check_inputs(
    method prepare_latents (line 790) | def prepare_latents(self, batch_size, num_channels_latents, height, dt...
    method __call__ (line 814) | def __call__(

FILE: src/diffusers/pipelines/aura_flow/pipeline_aura_flow.py
  function retrieve_timesteps (line 48) | def retrieve_timesteps(
  class AuraFlowPipeline (line 107) | class AuraFlowPipeline(DiffusionPipeline):
    method __init__ (line 128) | def __init__(
    method check_inputs (line 147) | def check_inputs(
    method encode_prompt (line 205) | def encode_prompt(
    method prepare_latents (line 333) | def prepare_latents(
    method upcast_vae (line 365) | def upcast_vae(self):
    method __call__ (line 385) | def __call__(

FILE: src/diffusers/pipelines/auto_pipeline.py
  function _get_connected_pipeline (line 181) | def _get_connected_pipeline(pipeline_cls):
  function _get_task_class (line 195) | def _get_task_class(mapping, pipeline_class_name, throw_error_if_not_exi...
  class AutoPipelineForText2Image (line 213) | class AutoPipelineForText2Image(ConfigMixin):
    method __init__ (line 231) | def __init__(self, *args, **kwargs):
    method from_pretrained (line 240) | def from_pretrained(cls, pretrained_model_or_path, **kwargs):
    method from_pipe (line 385) | def from_pipe(cls, pipeline, **kwargs):
  class AutoPipelineForImage2Image (line 499) | class AutoPipelineForImage2Image(ConfigMixin):
    method __init__ (line 517) | def __init__(self, *args, **kwargs):
    method from_pretrained (line 526) | def from_pretrained(cls, pretrained_model_or_path, **kwargs):
    method from_pipe (line 672) | def from_pipe(cls, pipeline, **kwargs):
  class AutoPipelineForInpainting (line 792) | class AutoPipelineForInpainting(ConfigMixin):
    method __init__ (line 810) | def __init__(self, *args, **kwargs):
    method from_pretrained (line 819) | def from_pretrained(cls, pretrained_model_or_path, **kwargs):
    method from_pipe (line 964) | def from_pipe(cls, pipeline, **kwargs):

FILE: src/diffusers/pipelines/blip_diffusion/blip_image_processing.py
  class BlipImageProcessor (line 49) | class BlipImageProcessor(BaseImageProcessor):
    method __init__ (line 86) | def __init__(
    method resize (line 116) | def resize(
    method preprocess (line 164) | def preprocess(
    method postprocess (line 301) | def postprocess(self, sample: torch.Tensor, output_type: str = "pil"):

FILE: src/diffusers/pipelines/blip_diffusion/modeling_blip2.py
  class Blip2TextEmbeddings (line 47) | class Blip2TextEmbeddings(nn.Module):
    method __init__ (line 50) | def __init__(self, config):
    method forward (line 66) | def forward(
  class Blip2VisionEmbeddings (line 101) | class Blip2VisionEmbeddings(nn.Module):
    method __init__ (line 102) | def __init__(self, config: Blip2VisionConfig):
    method forward (line 120) | def forward(self, pixel_values: torch.Tensor) -> torch.Tensor:
  class Blip2QFormerEncoder (line 133) | class Blip2QFormerEncoder(nn.Module):
    method __init__ (line 134) | def __init__(self, config):
    method forward (line 142) | def forward(
  class Blip2QFormerLayer (line 236) | class Blip2QFormerLayer(nn.Module):
    method __init__ (line 237) | def __init__(self, config, layer_idx):
    method forward (line 256) | def forward(
    method feed_forward_chunk (line 327) | def feed_forward_chunk(self, attention_output):
    method feed_forward_chunk_query (line 332) | def feed_forward_chunk_query(self, attention_output):
  class ProjLayer (line 339) | class ProjLayer(nn.Module):
    method __init__ (line 340) | def __init__(self, in_dim, out_dim, hidden_dim, drop_p=0.1, eps=1e-12):
    method forward (line 351) | def forward(self, x):
  class Blip2VisionModel (line 361) | class Blip2VisionModel(Blip2PreTrainedModel):
    method __init__ (line 365) | def __init__(self, config: Blip2VisionConfig):
    method forward (line 377) | def forward(
    method get_input_embeddings (line 421) | def get_input_embeddings(self):
  class Blip2QFormerModel (line 426) | class Blip2QFormerModel(Blip2PreTrainedModel):
    method __init__ (line 431) | def __init__(self, config: Blip2Config):
    method get_input_embeddings (line 454) | def get_input_embeddings(self):
    method set_input_embeddings (line 457) | def set_input_embeddings(self, value):
    method _prune_heads (line 460) | def _prune_heads(self, heads_to_prune):
    method get_extended_attention_mask (line 468) | def get_extended_attention_mask(
    method forward (line 513) | def forward(

FILE: src/diffusers/pipelines/blip_diffusion/modeling_ctx_clip.py
  function _expand_mask (line 25) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option...
  class ContextCLIPTextModel (line 42) | class ContextCLIPTextModel(CLIPPreTrainedModel):
    method __init__ (line 47) | def __init__(self, config: CLIPTextConfig):
    method forward (line 53) | def forward(
  class ContextCLIPTextTransformer (line 76) | class ContextCLIPTextTransformer(nn.Module):
    method __init__ (line 77) | def __init__(self, config: CLIPTextConfig):
    method forward (line 85) | def forward(
    method _build_causal_attention_mask (line 162) | def _build_causal_attention_mask(self, bsz, seq_len, dtype):
  class ContextCLIPTextEmbeddings (line 172) | class ContextCLIPTextEmbeddings(nn.Module):
    method __init__ (line 173) | def __init__(self, config: CLIPTextConfig):
    method forward (line 183) | def forward(

FILE: src/diffusers/pipelines/blip_diffusion/pipeline_blip_diffusion.py
  class BlipDiffusionPipeline (line 75) | class BlipDiffusionPipeline(DiffusionPipeline):
    method __init__ (line 103) | def __init__(
    method get_query_embeddings (line 129) | def get_query_embeddings(self, input_image, src_subject):
    method _build_prompt (line 133) | def _build_prompt(self, prompts, tgt_subjects, prompt_strength=1.0, pr...
    method prepare_latents (line 143) | def prepare_latents(self, batch_size, num_channels, height, width, dty...
    method encode_prompt (line 160) | def encode_prompt(self, query_embeds, prompt, device=None):
    method __call__ (line 188) | def __call__(

FILE: src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py
  function retrieve_timesteps (line 59) | def retrieve_timesteps(
  class CogVideoXPipelineOutput (line 119) | class CogVideoXPipelineOutput(BaseOutput):
  class CogVideoXPipeline (line 133) | class CogVideoXPipeline(DiffusionPipeline):
    method __init__ (line 165) | def __init__(
    method _get_t5_prompt_embeds (line 187) | def _get_t5_prompt_embeds(
    method encode_prompt (line 229) | def encode_prompt(
    method prepare_latents (line 310) | def prepare_latents(
    method decode_latents (line 335) | def decode_latents(self, latents: torch.Tensor, num_seconds: int):
    method prepare_extra_step_kwargs (line 352) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 370) | def check_inputs(
    method guidance_scale (line 422) | def guidance_scale(self):
    method num_timesteps (line 426) | def num_timesteps(self):
    method interrupt (line 430) | def interrupt(self):
    method __call__ (line 435) | def __call__(

FILE: src/diffusers/pipelines/consistency_models/pipeline_consistency_models.py
  class ConsistencyModelPipeline (line 63) | class ConsistencyModelPipeline(DiffusionPipeline):
    method __init__ (line 80) | def __init__(self, unet: UNet2DModel, scheduler: CMStochasticIterative...
    method prepare_latents (line 90) | def prepare_latents(self, batch_size, num_channels, height, width, dty...
    method postprocess_image (line 108) | def postprocess_image(self, sample: torch.Tensor, output_type: str = "...
    method prepare_class_labels (line 128) | def prepare_class_labels(self, batch_size, device, class_labels=None):
    method check_inputs (line 144) | def check_inputs(self, num_inference_steps, timesteps, latents, batch_...
    method __call__ (line 169) | def __call__(

FILE: src/diffusers/pipelines/controlnet/multicontrolnet.py
  class MultiControlNetModel (line 15) | class MultiControlNetModel(ModelMixin):
    method __init__ (line 28) | def __init__(self, controlnets: Union[List[ControlNetModel], Tuple[Con...
    method forward (line 32) | def forward(
    method save_pretrained (line 75) | def save_pretrained(
    method from_pretrained (line 114) | def from_pretrained(cls, pretrained_model_path: Optional[Union[str, os...

FILE: src/diffusers/pipelines/controlnet/pipeline_controlnet.py
  function retrieve_timesteps (line 96) | def retrieve_timesteps(
  class StableDiffusionControlNetPipeline (line 155) | class StableDiffusionControlNetPipeline(
    method __init__ (line 205) | def __init__(
    method _encode_prompt (line 258) | def _encode_prompt(
    method encode_prompt (line 291) | def encode_prompt(
    method encode_image (line 474) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 499) | def prepare_ip_adapter_image_embeds(
    method run_safety_checker (line 545) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 560) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 572) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 589) | def check_inputs(
    method check_image (line 752) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_image (line 789) | def prepare_image(
    method prepare_latents (line 820) | def prepare_latents(self, batch_size, num_channels_latents, height, wi...
    method get_guidance_scale_embedding (line 843) | def get_guidance_scale_embedding(
    method guidance_scale (line 874) | def guidance_scale(self):
    method clip_skip (line 878) | def clip_skip(self):
    method do_classifier_free_guidance (line 885) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 889) | def cross_attention_kwargs(self):
    method num_timesteps (line 893) | def num_timesteps(self):
    method __call__ (line 898) | def __call__(

FILE: src/diffusers/pipelines/controlnet/pipeline_controlnet_blip_diffusion.py
  class BlipDiffusionControlNetPipeline (line 82) | class BlipDiffusionControlNetPipeline(DiffusionPipeline):
    method __init__ (line 112) | def __init__(
    method get_query_embeddings (line 140) | def get_query_embeddings(self, input_image, src_subject):
    method _build_prompt (line 144) | def _build_prompt(self, prompts, tgt_subjects, prompt_strength=1.0, pr...
    method prepare_latents (line 154) | def prepare_latents(self, batch_size, num_channels, height, width, dty...
    method encode_prompt (line 171) | def encode_prompt(self, query_embeds, prompt, device=None):
    method prepare_control_image (line 198) | def prepare_control_image(
    method __call__ (line 236) | def __call__(

FILE: src/diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py
  function retrieve_latents (line 96) | def retrieve_latents(
  function prepare_image (line 109) | def prepare_image(image):
  class StableDiffusionControlNetImg2ImgPipeline (line 133) | class StableDiffusionControlNetImg2ImgPipeline(
    method __init__ (line 183) | def __init__(
    method _encode_prompt (line 236) | def _encode_prompt(
    method encode_prompt (line 269) | def encode_prompt(
    method encode_image (line 452) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 477) | def prepare_ip_adapter_image_embeds(
    method run_safety_checker (line 523) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 538) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 550) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 567) | def check_inputs(
    method check_image (line 725) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_control_image (line 763) | def prepare_control_image(
    method get_timesteps (line 794) | def get_timesteps(self, num_inference_steps, strength, device):
    method prepare_latents (line 806) | def prepare_latents(self, image, timestep, batch_size, num_images_per_...
    method guidance_scale (line 872) | def guidance_scale(self):
    method clip_skip (line 876) | def clip_skip(self):
    method do_classifier_free_guidance (line 883) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 887) | def cross_attention_kwargs(self):
    method num_timesteps (line 891) | def num_timesteps(self):
    method __call__ (line 896) | def __call__(

FILE: src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py
  function retrieve_latents (line 108) | def retrieve_latents(
  class StableDiffusionControlNetInpaintPipeline (line 121) | class StableDiffusionControlNetInpaintPipeline(
    method __init__ (line 182) | def __init__(
    method _encode_prompt (line 238) | def _encode_prompt(
    method encode_prompt (line 271) | def encode_prompt(
    method encode_image (line 454) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 479) | def prepare_ip_adapter_image_embeds(
    method run_safety_checker (line 525) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 540) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 552) | def prepare_extra_step_kwargs(self, generator, eta):
    method get_timesteps (line 570) | def get_timesteps(self, num_inference_steps, strength, device):
    method check_inputs (line 581) | def check_inputs(
    method check_image (line 760) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_control_image (line 797) | def prepare_control_image(
    method prepare_latents (line 832) | def prepare_latents(
    method prepare_mask_latents (line 896) | def prepare_mask_latents(
    method _encode_vae_image (line 942) | def _encode_vae_image(self, image: torch.Tensor, generator: torch.Gene...
    method guidance_scale (line 957) | def guidance_scale(self):
    method clip_skip (line 961) | def clip_skip(self):
    method do_classifier_free_guidance (line 968) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 972) | def cross_attention_kwargs(self):
    method num_timesteps (line 976) | def num_timesteps(self):
    method __call__ (line 981) | def __call__(

FILE: src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py
  function retrieve_latents (line 68) | def retrieve_latents(
  function rescale_noise_cfg (line 139) | def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
  class StableDiffusionXLControlNetInpaintPipeline (line 153) | class StableDiffusionXLControlNetInpaintPipeline(
    method __init__ (line 221) | def __init__(
    method encode_prompt (line 273) | def encode_prompt(
    method encode_image (line 508) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 533) | def prepare_ip_adapter_image_embeds(
    method prepare_extra_step_kwargs (line 579) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_image (line 596) | def check_image(self, image, prompt, prompt_embeds):
    method check_inputs (line 633) | def check_inputs(
    method prepare_control_image (line 850) | def prepare_control_image(
    method prepare_latents (line 884) | def prepare_latents(
    method _encode_vae_image (line 951) | def _encode_vae_image(self, image: torch.Tensor, generator: torch.Gene...
    method prepare_mask_latents (line 974) | def prepare_mask_latents(
    method get_timesteps (line 1022) | def get_timesteps(self, num_inference_steps, strength, device, denoisi...
    method _get_add_time_ids (line 1058) | def _get_add_time_ids(
    method upcast_vae (line 1105) | def upcast_vae(self):
    method guidance_scale (line 1123) | def guidance_scale(self):
    method clip_skip (line 1127) | def clip_skip(self):
    method do_classifier_free_guidance (line 1134) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 1138) | def cross_attention_kwargs(self):
    method num_timesteps (line 1142) | def num_timesteps(self):
    method __call__ (line 1147) | def __call__(

FILE: src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py
  function retrieve_timesteps (line 117) | def retrieve_timesteps(
  class StableDiffusionXLControlNetPipeline (line 176) | class StableDiffusionXLControlNetPipeline(
    method __init__ (line 247) | def __init__(
    method encode_prompt (line 294) | def encode_prompt(
    method encode_image (line 529) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 554) | def prepare_ip_adapter_image_embeds(
    method prepare_extra_step_kwargs (line 600) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 617) | def check_inputs(
    method check_image (line 807) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_image (line 845) | def prepare_image(
    method prepare_latents (line 876) | def prepare_latents(self, batch_size, num_channels_latents, height, wi...
    method _get_add_time_ids (line 899) | def _get_add_time_ids(
    method upcast_vae (line 918) | def upcast_vae(self):
    method get_guidance_scale_embedding (line 936) | def get_guidance_scale_embedding(
    method guidance_scale (line 967) | def guidance_scale(self):
    method clip_skip (line 971) | def clip_skip(self):
    method do_classifier_free_guidance (line 978) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 982) | def cross_attention_kwargs(self):
    method denoising_end (line 986) | def denoising_end(self):
    method num_timesteps (line 990) | def num_timesteps(self):
    method __call__ (line 995) | def __call__(

FILE: src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py
  function retrieve_latents (line 146) | def retrieve_latents(
  class StableDiffusionXLControlNetImg2ImgPipeline (line 159) | class StableDiffusionXLControlNetImg2ImgPipeline(
    method __init__ (line 239) | def __init__(
    method encode_prompt (line 288) | def encode_prompt(
    method encode_image (line 523) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method prepare_ip_adapter_image_embeds (line 548) | def prepare_ip_adapter_image_embeds(
    method prepare_extra_step_kwargs (line 594) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 611) | def check_inputs(
    method check_image (line 813) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_control_image (line 851) | def prepare_control_image(
    method get_timesteps (line 882) | def get_timesteps(self, num_inference_steps, strength, device):
    method prepare_latents (line 894) | def prepare_latents(
    method _get_add_time_ids (line 981) | def _get_add_time_ids(
    method upcast_vae (line 1033) | def upcast_vae(self):
    method guidance_scale (line 1051) | def guidance_scale(self):
    method clip_skip (line 1055) | def clip_skip(self):
    method do_classifier_free_guidance (line 1062) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 1066) | def cross_attention_kwargs(self):
    method num_timesteps (line 1070) | def num_timesteps(self):
    method __call__ (line 1075) | def __call__(

FILE: src/diffusers/pipelines/controlnet/pipeline_flax_controlnet.py
  class FlaxStableDiffusionControlNetPipeline (line 111) | class FlaxStableDiffusionControlNetPipeline(FlaxDiffusionPipeline):
    method __init__ (line 141) | def __init__(
    method prepare_text_inputs (line 180) | def prepare_text_inputs(self, prompt: Union[str, List[str]]):
    method prepare_image_inputs (line 194) | def prepare_image_inputs(self, image: Union[Image.Image, List[Image.Im...
    method _get_has_nsfw_concepts (line 205) | def _get_has_nsfw_concepts(self, features, params):
    method _run_safety_checker (line 209) | def _run_safety_checker(self, images, safety_model_params, jit=False):
    method _generate (line 239) | def _generate(
    method __call__ (line 349) | def __call__(
  function _p_generate (line 488) | def _p_generate(
  function _p_get_has_nsfw_concepts (line 514) | def _p_get_has_nsfw_concepts(pipe, features, params):
  function unshard (line 518) | def unshard(x: jnp.ndarray):
  function preprocess (line 525) | def preprocess(image, dtype):

FILE: src/diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py
  function map_to_standard_shapes (line 114) | def map_to_standard_shapes(target_width, target_height):
  function get_resize_crop_region_for_grid (line 122) | def get_resize_crop_region_for_grid(src, tgt_size):
  function rescale_noise_cfg (line 143) | def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
  class HunyuanDiTControlNetPipeline (line 157) | class HunyuanDiTControlNetPipeline(DiffusionPipeline):
    method __init__ (line 208) | def __init__(
    method encode_prompt (line 270) | def encode_prompt(
    method run_safety_checker (line 436) | def run_safety_checker(self, image, device, dtype):
    method prepare_extra_step_kwargs (line 451) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 469) | def check_inputs(
    method prepare_latents (line 546) | def prepare_latents(self, batch_size, num_channels_latents, height, wi...
    method prepare_image (line 569) | def prepare_image(
    method guidance_scale (line 604) | def guidance_scale(self):
    method guidance_rescale (line 608) | def guidance_rescale(self):
    method do_classifier_free_guidance (line 615) | def do_classifier_free_guidance(self):
    method num_timesteps (line 619) | def num_timesteps(self):
    method interrupt (line 623) | def interrupt(self):
    method __call__ (line 628) | def __call__(

FILE: src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py
  function retrieve_timesteps (line 78) | def retrieve_timesteps(
  class StableDiffusion3ControlNetPipeline (line 137) | class StableDiffusion3ControlNetPipeline(DiffusionPipeline, SD3LoraLoade...
    method __init__ (line 179) | def __init__(
    method _get_t5_prompt_embeds (line 222) | def _get_t5_prompt_embeds(
    method _get_clip_prompt_embeds (line 279) | def _get_clip_prompt_embeds(
    method encode_prompt (line 335) | def encode_prompt(
    method check_inputs (line 528) | def check_inputs(
    method prepare_latents (line 619) | def prepare_latents(
    method prepare_image (line 650) | def prepare_image(
    method guidance_scale (line 685) | def guidance_scale(self):
    method clip_skip (line 689) | def clip_skip(self):
    method do_classifier_free_guidance (line 696) | def do_classifier_free_guidance(self):
    method joint_attention_kwargs (line 700) | def joint_attention_kwargs(self):
    method num_timesteps (line 704) | def num_timesteps(self):
    method interrupt (line 708) | def interrupt(self):
    method __call__ (line 713) | def __call__(

FILE: src/diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs.py
  class StableDiffusionControlNetXSPipeline (line 92) | class StableDiffusionControlNetXSPipeline(
    method __init__ (line 138) | def __init__(
    method _encode_prompt (line 189) | def _encode_prompt(
    method encode_prompt (line 222) | def encode_prompt(
    method run_safety_checker (line 405) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 420) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 432) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 449) | def check_inputs(
    method check_image (line 519) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_image (line 556) | def prepare_image(
    method prepare_latents (line 586) | def prepare_latents(self, batch_size, num_channels_latents, height, wi...
    method guidance_scale (line 610) | def guidance_scale(self):
    method clip_skip (line 615) | def clip_skip(self):
    method do_classifier_free_guidance (line 620) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 625) | def cross_attention_kwargs(self):
    method num_timesteps (line 630) | def num_timesteps(self):
    method __call__ (line 635) | def __call__(

FILE: src/diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs_sd_xl.py
  class StableDiffusionXLControlNetXSPipeline (line 106) | class StableDiffusionXLControlNetXSPipeline(
    method __init__ (line 169) | def __init__(
    method encode_prompt (line 214) | def encode_prompt(
    method prepare_extra_step_kwargs (line 449) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 466) | def check_inputs(
    method check_image (line 563) | def check_image(self, image, prompt, prompt_embeds):
    method prepare_image (line 600) | def prepare_image(
    method prepare_latents (line 630) | def prepare_latents(self, batch_size, num_channels_latents, height, wi...
    method _get_add_time_ids (line 652) | def _get_add_time_ids(
    method upcast_vae (line 671) | def upcast_vae(self):
    method guidance_scale (line 690) | def guidance_scale(self):
    method clip_skip (line 695) | def clip_skip(self):
    method do_classifier_free_guidance (line 700) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 705) | def cross_attention_kwargs(self):
    method num_timesteps (line 710) | def num_timesteps(self):
    method __call__ (line 715) | def __call__(

FILE: src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py
  class DanceDiffusionPipeline (line 28) | class DanceDiffusionPipeline(DiffusionPipeline):
    method __init__ (line 45) | def __init__(self, unet, scheduler):
    method __call__ (line 50) | def __call__(

FILE: src/diffusers/pipelines/ddim/pipeline_ddim.py
  class DDIMPipeline (line 24) | class DDIMPipeline(DiffusionPipeline):
    method __init__ (line 41) | def __init__(self, unet, scheduler):
    method __call__ (line 50) | def __call__(

FILE: src/diffusers/pipelines/ddpm/pipeline_ddpm.py
  class DDPMPipeline (line 24) | class DDPMPipeline(DiffusionPipeline):
    method __init__ (line 41) | def __init__(self, unet, scheduler):
    method __call__ (line 46) | def __call__(

FILE: src/diffusers/pipelines/deepfloyd_if/pipeline_if.py
  class IFPipeline (line 87) | class IFPipeline(DiffusionPipeline, StableDiffusionLoraLoaderMixin):
    method __init__ (line 119) | def __init__(
    method encode_prompt (line 160) | def encode_prompt(
    method run_safety_checker (line 313) | def run_safety_checker(self, image, device, dtype):
    method prepare_extra_step_kwargs (line 327) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 344) | def check_inputs(
    method prepare_intermediate_images (line 386) | def prepare_intermediate_images(self, batch_size, num_channels, height...
    method _text_preprocessing (line 400) | def _text_preprocessing(self, text, clean_caption=False):
    method _clean_caption (line 424) | def _clean_caption(self, caption):
    method __call__ (line 540) | def __call__(

FILE: src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py
  function resize (line 39) | def resize(images: PIL.Image.Image, img_size: int) -> PIL.Image.Image:
  class IFImg2ImgPipeline (line 111) | class IFImg2ImgPipeline(DiffusionPipeline, StableDiffusionLoraLoaderMixin):
    method __init__ (line 143) | def __init__(
    method encode_prompt (line 184) | def encode_prompt(
    method run_safety_checker (line 338) | def run_safety_checker(self, image, device, dtype):
    method prepare_extra_step_kwargs (line 352) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 369) | def check_inputs(
    method _text_preprocessing (line 443) | def _text_preprocessing(self, text, clean_caption=False):
    method _clean_caption (line 468) | def _clean_caption(self, caption):
    method preprocess_image (line 582) | def preprocess_image(self, image: PIL.Image.Image) -> torch.Tensor:
    method get_timesteps (line 619) | def get_timesteps(self, num_inference_steps, strength):
    method prepare_intermediate_images (line 630) | def prepare_intermediate_images(
    method __call__ (line 654) | def __call__(

FILE: src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py
  function resize (line 42) | def resize(images: PIL.Image.Image, img_size: int) -> PIL.Image.Image:
  class IFImg2ImgSuperResolutionPipeline (line 114) | class IFImg2ImgSuperResolutionPipeline(DiffusionPipeline, StableDiffusio...
    method __init__ (line 147) | def __init__(
    method _text_preprocessing (line 195) | def _text_preprocessing(self, text, clean_caption=False):
    method _clean_caption (line 220) | def _clean_caption(self, caption):
    method encode_prompt (line 336) | def encode_prompt(
    method run_safety_checker (line 490) | def run_safety_checker(self, image, device, dtype):
    method prepare_extra_step_kwargs (line 504) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 521) | def check_inputs(
    method preprocess_original_image (line 631) | def preprocess_original_image(self, image: PIL.Image.Image) -> torch.T...
    method preprocess_image (line 668) | def preprocess_image(self, image: PIL.Image.Image, num_images_per_prom...
    method get_timesteps (line 700) | def get_timesteps(self, num_inference_steps, strength):
    method prepare_intermediate_images (line 712) | def prepare_intermediate_images(
    method __call__ (line 736) | def __call__(

FILE: src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py
  function resize (line 40) | def resize(images: PIL.Image.Image, img_size: int) -> PIL.Image.Image:
  class IFInpaintingPipeline (line 114) | class IFInpaintingPipeline(DiffusionPipeline, StableDiffusionLoraLoaderM...
    method __init__ (line 146) | def __init__(
    method encode_prompt (line 188) | def encode_prompt(
    method run_safety_checker (line 342) | def run_safety_checker(self, image, device, dtype):
    method prepare_extra_step_kwargs (line 356) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 373) | def check_inputs(
    method _text_preprocessing (line 483) | def _text_preprocessing(self, text, clean_caption=False):
    method _clean_caption (line 508) | def _clean_caption(self, caption):
    method preprocess_image (line 623) | def preprocess_image(self, image: PIL.Image.Image) -> torch.Tensor:
    method preprocess_mask_image (line 659) | def preprocess_mask_image(self, mask_image) -> torch.Tensor:
    method get_timesteps (line 709) | def get_timesteps(self, num_inference_steps, strength):
    method prepare_intermediate_images (line 720) | def prepare_intermediate_images(
    method __call__ (line 746) | def __call__(

FILE: src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py
  function resize (line 42) | def resize(images: PIL.Image.Image, img_size: int) -> PIL.Image.Image:
  class IFInpaintingSuperResolutionPipeline (line 116) | class IFInpaintingSuperResolutionPipeline(DiffusionPipeline, StableDiffu...
    method __init__ (line 149) | def __init__(
    method _text_preprocessing (line 197) | def _text_preprocessing(self, text, clean_caption=False):
    method _clean_caption (line 222) | def _clean_caption(self, caption):
    method encode_prompt (line 338) | def encode_prompt(
    method run_safety_checker (line 492) | def run_safety_checker(self, image, device, dtype):
    method prepare_extra_step_kwargs (line 506) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 523) | def check_inputs(
    method preprocess_original_image (line 667) | def preprocess_original_image(self, image: PIL.Image.Image) -> torch.T...
    method preprocess_image (line 704) | def preprocess_image(self, image: PIL.Image.Image, num_images_per_prom...
    method preprocess_mask_image (line 736) | def preprocess_mask_image(self, mask_image) -> torch.Tensor:
    method get_timesteps (line 786) | def get_timesteps(self, num_inference_steps, strength):
    method prepare_intermediate_images (line 798) | def prepare_intermediate_images(
    method __call__ (line 824) | def __call__(

FILE: src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py
  class IFSuperResolutionPipeline (line 72) | class IFSuperResolutionPipeline(DiffusionPipeline, StableDiffusionLoraLo...
    method __init__ (line 105) | def __init__(
    method _text_preprocessing (line 153) | def _text_preprocessing(self, text, clean_caption=False):
    method _clean_caption (line 178) | def _clean_caption(self, caption):
    method encode_prompt (line 294) | def encode_prompt(
    method run_safety_checker (line 448) | def run_safety_checker(self, image, device, dtype):
    method prepare_extra_step_kwargs (line 462) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 479) | def check_inputs(
    method prepare_intermediate_images (line 559) | def prepare_intermediate_images(self, batch_size, num_channels, height...
    method preprocess_image (line 573) | def preprocess_image(self, image, num_images_per_prompt, device):
    method __call__ (line 606) | def __call__(

FILE: src/diffusers/pipelines/deepfloyd_if/pipeline_output.py
  class IFPipelineOutput (line 11) | class IFPipelineOutput(BaseOutput):

FILE: src/diffusers/pipelines/deepfloyd_if/safety_checker.py
  class IFSafetyChecker (line 12) | class IFSafetyChecker(PreTrainedModel):
    method __init__ (line 17) | def __init__(self, config: CLIPConfig):
    method forward (line 26) | def forward(self, clip_input, images, p_threshold=0.5, w_threshold=0.5):

FILE: src/diffusers/pipelines/deepfloyd_if/watermark.py
  class IFWatermarker (line 12) | class IFWatermarker(ModelMixin, ConfigMixin):
    method __init__ (line 13) | def __init__(self):
    method apply_watermark (line 19) | def apply_watermark(self, images: List[PIL.Image.Image], sample_size=N...

FILE: src/diffusers/pipelines/deprecated/alt_diffusion/modeling_roberta_series.py
  class TransformationModelOutput (line 11) | class TransformationModelOutput(ModelOutput):
  class RobertaSeriesConfig (line 39) | class RobertaSeriesConfig(XLMRobertaConfig):
    method __init__ (line 40) | def __init__(
  class RobertaSeriesModelWithTransformation (line 58) | class RobertaSeriesModelWithTransformation(RobertaPreTrainedModel):
    method __init__ (line 64) | def __init__(self, config):
    method forward (line 74) | def forward(

FILE: src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py
  function rescale_noise_cfg (line 67) | def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
  function retrieve_timesteps (line 82) | def retrieve_timesteps(
  class AltDiffusionPipeline (line 141) | class AltDiffusionPipeline(
    method __init__ (line 187) | def __init__(
    method _encode_prompt (line 279) | def _encode_prompt(
    method encode_prompt (line 311) | def encode_prompt(
    method encode_image (line 492) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method run_safety_checker (line 516) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 530) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 541) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 558) | def check_inputs(
    method prepare_latents (line 610) | def prepare_latents(self, batch_size, num_channels_latents, height, wi...
    method get_guidance_scale_embedding (line 632) | def get_guidance_scale_embedding(self, w, embedding_dim=512, dtype=tor...
    method guidance_scale (line 661) | def guidance_scale(self):
    method guidance_rescale (line 665) | def guidance_rescale(self):
    method clip_skip (line 669) | def clip_skip(self):
    method do_classifier_free_guidance (line 676) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 680) | def cross_attention_kwargs(self):
    method num_timesteps (line 684) | def num_timesteps(self):
    method __call__ (line 689) | def __call__(

FILE: src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py
  function retrieve_latents (line 84) | def retrieve_latents(
  function preprocess (line 98) | def preprocess(image):
  function retrieve_timesteps (line 122) | def retrieve_timesteps(
  class AltDiffusionImg2ImgPipeline (line 181) | class AltDiffusionImg2ImgPipeline(
    method __init__ (line 227) | def __init__(
    method _encode_prompt (line 319) | def _encode_prompt(
    method encode_prompt (line 351) | def encode_prompt(
    method encode_image (line 532) | def encode_image(self, image, device, num_images_per_prompt, output_hi...
    method run_safety_checker (line 556) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 570) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 581) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 598) | def check_inputs(
    method get_timesteps (line 649) | def get_timesteps(self, num_inference_steps, strength, device):
    method prepare_latents (line 658) | def prepare_latents(self, image, timestep, batch_size, num_images_per_...
    method get_guidance_scale_embedding (line 716) | def get_guidance_scale_embedding(self, w, embedding_dim=512, dtype=tor...
    method guidance_scale (line 745) | def guidance_scale(self):
    method clip_skip (line 749) | def clip_skip(self):
    method do_classifier_free_guidance (line 756) | def do_classifier_free_guidance(self):
    method cross_attention_kwargs (line 760) | def cross_attention_kwargs(self):
    method num_timesteps (line 764) | def num_timesteps(self):
    method __call__ (line 769) | def __call__(

FILE: src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_output.py
  class AltDiffusionPipelineOutput (line 14) | class AltDiffusionPipelineOutput(BaseOutput):

FILE: src/diffusers/pipelines/deprecated/audio_diffusion/mel.py
  class Mel (line 37) | class Mel(ConfigMixin, SchedulerMixin):
    method __init__ (line 59) | def __init__(
    method set_resolution (line 80) | def set_resolution(self, x_res: int, y_res: int):
    method load_audio (line 94) | def load_audio(self, audio_file: str = None, raw_audio: np.ndarray = N...
    method get_number_of_slices (line 112) | def get_number_of_slices(self) -> int:
    method get_audio_slice (line 121) | def get_audio_slice(self, slice: int = 0) -> np.ndarray:
    method get_sample_rate (line 134) | def get_sample_rate(self) -> int:
    method audio_slice_to_image (line 143) | def audio_slice_to_image(self, slice: int) -> Image.Image:
    method image_to_audio (line 162) | def image_to_audio(self, image: Image.Image) -> np.ndarray:

FILE: src/diffusers/pipelines/deprecated/audio_diffusion/pipeline_audio_diffusion.py
  class AudioDiffusionPipeline (line 30) | class AudioDiffusionPipeline(DiffusionPipeline):
    method __init__ (line 51) | def __init__(
    method get_default_steps (line 61) | def get_default_steps(self) -> int:
    method __call__ (line 71) | def __call__(
    method encode (line 271) | def encode(self, images: List[Image.Image], steps: int = 50) -> np.nda...
    method slerp (line 312) | def slerp(x0: torch.Tensor, x1: torch.Tensor, alpha: float) -> torch.T...

FILE: src/diffusers/pipelines/deprecated/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py
  class LDMPipeline (line 26) | class LDMPipeline(DiffusionPipeline):
    method __init__ (line 42) | def __init__(self, vqvae: VQModel, unet: UNet2DModel, scheduler: DDIMS...
    method __call__ (line 47) | def __call__(

FILE: src/diffusers/pipelines/deprecated/pndm/pipeline_pndm.py
  class PNDMPipeline (line 26) | class PNDMPipeline(DiffusionPipeline):
    method __init__ (line 43) | def __init__(self, unet: UNet2DModel, scheduler: PNDMScheduler):
    method __call__ (line 51) | def __call__(

FILE: src/diffusers/pipelines/deprecated/repaint/pipeline_repaint.py
  function _preprocess_image (line 33) | def _preprocess_image(image: Union[List, PIL.Image.Image, torch.Tensor]):
  function _preprocess_mask (line 56) | def _preprocess_mask(mask: Union[List, PIL.Image.Image, torch.Tensor]):
  class RePaintPipeline (line 76) | class RePaintPipeline(DiffusionPipeline):
    method __init__ (line 94) | def __init__(self, unet, scheduler):
    method __call__ (line 99) | def __call__(

FILE: src/diffusers/pipelines/deprecated/score_sde_ve/pipeline_score_sde_ve.py
  class ScoreSdeVePipeline (line 25) | class ScoreSdeVePipeline(DiffusionPipeline):
    method __init__ (line 42) | def __init__(self, unet: UNet2DModel, scheduler: ScoreSdeVeScheduler):
    method __call__ (line 47) | def __call__(

FILE: src/diffusers/pipelines/deprecated/spectrogram_diffusion/continuous_encoder.py
  class SpectrogramContEncoder (line 29) | class SpectrogramContEncoder(ModelMixin, ConfigMixin, ModuleUtilsMixin):
    method __init__ (line 31) | def __init__(
    method forward (line 71) | def forward(self, encoder_inputs, encoder_inputs_mask):

FILE: src/diffusers/pipelines/deprecated/spectrogram_diffusion/midi_utils.py
  class NoteRepresentationConfig (line 84) | class NoteRepresentationConfig:
  class NoteEventData (line 92) | class NoteEventData:
  class NoteEncodingState (line 101) | class NoteEncodingState:
  class EventRange (line 109) | class EventRange:
  class Event (line 116) | class Event:
  class Tokenizer (line 121) | class Tokenizer:
    method __init__ (line 122) | def __init__(self, regular_ids: int):
    method encode (line 127) | def encode(self, token_ids):
  class Codec (line 145) | class Codec:
    method __init__ (line 156) | def __init__(self, max_shift_steps: int, steps_per_second: float, even...
    method num_classes (line 172) | def num_classes(self) -> int:
    method is_shift_event_index (line 178) | def is_shift_event_index(self, index: int) -> bool:
    method max_shift_steps (line 182) | def max_shift_steps(self) -> int:
    method encode_event (line 185) | def encode_event(self, event: Event) -> int:
    method event_type_range (line 200) | def event_type_range(self, event_type: str) -> Tuple[int, int]:
    method decode_event_index (line 210) | def decode_event_index(self, index: int) -> Event:
  class ProgramGranularity (line 222) | class ProgramGranularity:
  function drop_programs (line 228) | def drop_programs(tokens, codec: Codec):
  function programs_to_midi_classes (line 234) | def programs_to_midi_classes(tokens, codec):
  function frame (line 254) | def frame(signal, frame_length, frame_step, pad_end=False, pad_value=0, ...
  function program_to_slakh_program (line 272) | def program_to_slakh_program(program):
  function audio_to_frames (line 279) | def audio_to_frames(
  function note_sequence_to_onsets_and_offsets_and_programs (line 302) | def note_sequence_to_onsets_and_offsets_and_programs(
  function num_velocity_bins_from_codec (line 332) | def num_velocity_bins_from_codec(codec: Codec):
  function segment (line 339) | def segment(a, n):
  function velocity_to_bin (line 343) | def velocity_to_bin(velocity, num_velocity_bins):
  function note_event_data_to_events (line 350) | def note_event_data_to_events(
  function note_encoding_state_to_events (line 382) | def note_encoding_state_to_events(state: NoteEncodingState) -> Sequence[...
  function encode_and_index_events (line 392) | def encode_and_index_events(
  function extract_sequence_with_indices (line 498) | def extract_sequence_with_indices(features, state_events_end_token=None,...
  function map_midi_programs (line 524) | def map_midi_programs(
  function run_length_encode_shifts_fn (line 534) | def run_length_encode_shifts_fn(
  function note_representation_processor_chain (line 604) | def note_representation_processor_chain(features, codec: Codec, note_rep...
  class MidiProcessor (line 619) | class MidiProcessor:
    method __init__ (line 620) | def __init__(self):
    method __call__ (line 635) | def __call__(self, midi: Union[bytes, os.PathLike, str]):

FILE: src/diffusers/pipelines/deprecated/spectrogram_diffusion/notes_encoder.py
  class SpectrogramNotesEncoder (line 25) | class SpectrogramNotesEncoder(ModelMixin, ConfigMixin, ModuleUtilsMixin):
    method __init__ (line 27) | def __init__(
    method forward (line 69) | def forward(self, encoder_input_tokens, encoder_inputs_mask):

FILE: src/diffusers/pipelines/deprecated/spectrogram_diffusion/pipeline_spectrogram_diffusion.py
  class SpectrogramDiffusionPipeline (line 41) | class SpectrogramDiffusionPipeline(DiffusionPipeline):
    method __init__ (line 60) | def __init__(
    method scale_features (line 83) | def scale_features(self, features, output_range=(-1.0, 1.0), clip=False):
    method scale_to_features (line 93) | def scale_to_features(self, outputs, input_range=(-1.0, 1.0), clip=Fal...
    method encode (line 102) | def encode(self, input_tokens, continuous_inputs, continuous_mask):
    method decode (line 114) | def decode(self, encodings_and_masks, input_tokens, noise_time):
    method __call__ (line 130) | def __call__(

FILE: src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py
  function preprocess (line 41) | def preprocess(image):
  function retrieve_latents (line 65) | def retrieve_latents(
  function posterior_sample (line 78) | def posterior_sample(scheduler, latents, timestep, clean_latents, genera...
  function compute_noise (line 105) | def compute_noise(scheduler, prev_latents, latents, timestep, noise_pred...
  class CycleDiffusionPipeline (line 139) | class CycleDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMi...
    method __init__ (line 174) | def __init__(
    method _encode_prompt (line 251) | def _encode_prompt(
    method encode_prompt (line 284) | def encode_prompt(
    method check_inputs (line 466) | def check_inputs(
    method prepare_extra_step_kwargs (line 518) | def prepare_extra_step_kwargs(self, generator, eta):
    method run_safety_checker (line 536) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 551) | def decode_latents(self, latents):
    method get_timesteps (line 563) | def get_timesteps(self, num_inference_steps, strength, device):
    method prepare_latents (line 574) | def prepare_latents(self, image, timestep, batch_size, num_images_per_...
    method __call__ (line 630) | def __call__(

FILE: src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_onnx_stable_diffusion_inpaint_legacy.py
  function preprocess (line 20) | def preprocess(image):
  function preprocess_mask (line 29) | def preprocess_mask(mask, scale_factor=8):
  class OnnxStableDiffusionInpaintPipelineLegacy (line 41) | class OnnxStableDiffusionInpaintPipelineLegacy(DiffusionPipeline):
    method __init__ (line 82) | def __init__(
    method _encode_prompt (line 152) | def _encode_prompt(
    method check_inputs (line 255) | def check_inputs(
    method __call__ (line 297) | def __call__(

FILE: src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py
  function preprocess_image (line 40) | def preprocess_image(image, batch_size):
  function preprocess_mask (line 50) | def preprocess_mask(mask, batch_size, scale_factor=8):
  class StableDiffusionInpaintPipelineLegacy (line 81) | class StableDiffusionInpaintPipelineLegacy(
    method __init__ (line 123) | def __init__(
    method _encode_prompt (line 221) | def _encode_prompt(
    method encode_prompt (line 254) | def encode_prompt(
    method run_safety_checker (line 437) | def run_safety_checker(self, image, device, dtype):
    method decode_latents (line 452) | def decode_latents(self, latents):
    method prepare_extra_step_kwargs (line 464) | def prepare_extra_step_kwargs(self, generator, eta):
    method check_inputs (line 481) | def check_inputs(
    method get_timesteps (line 532) | def get_timesteps(self, num_inference_steps, strength, device):
    method prepare_latents (line 541) | def prepare_latents(self, image, timestep, num_images_per_prompt, dtyp...
    method __call__ (line 558) | def __call__(

FILE: src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_model_editing.py
  class StableDiffusionModelEditingPipeline (line 39) | class StableDiff
Copy disabled (too large) Download .json
Condensed preview — 478 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (11,517K chars).
[
  {
    "path": ".gitignore",
    "chars": 1918,
    "preview": "# Initially taken from GitHub's Python gitignore file\n\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$"
  },
  {
    "path": "LICENSE",
    "chars": 18387,
    "preview": "Copyright (c) 2025 Snap Inc.\nCopyright (c) 2025 The Hebrew University of Jerusalem\nCopyright (c) 2025 Tel Aviv Universit"
  },
  {
    "path": "README.md",
    "chars": 5373,
    "preview": "# Stable Flow: Vital Layers for Training-Free Image Editing [CVPR 2025]\n<a href=\"https://omriavrahami.com/stable-flow/\">"
  },
  {
    "path": "environment.yml",
    "chars": 3893,
    "preview": "name: stable-flow\nchannels:\n  - pytorch\n  - nvidia\n  - defaults\ndependencies:\n  - _libgcc_mutex=0.1=main\n  - _openmp_mut"
  },
  {
    "path": "run_stable_flow.py",
    "chars": 4413,
    "preview": "import argparse\nimport os\n\nimport torch\nfrom diffusers import FluxPipeline\nimport numpy as np\nfrom PIL import Image\n\ncla"
  },
  {
    "path": "setup.py",
    "chars": 10566,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/__init__.py",
    "chars": 34105,
    "preview": "__version__ = \"0.30.0\"\n\nfrom typing import TYPE_CHECKING\n\nfrom .utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDe"
  },
  {
    "path": "src/diffusers/callbacks.py",
    "chars": 6717,
    "preview": "from typing import Any, Dict, List\n\nfrom .configuration_utils import ConfigMixin, register_to_config\nfrom .utils import "
  },
  {
    "path": "src/diffusers/commands/__init__.py",
    "chars": 920,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/commands/diffusers_cli.py",
    "chars": 1317,
    "preview": "#!/usr/bin/env python\n# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License,"
  },
  {
    "path": "src/diffusers/commands/env.py",
    "chars": 6221,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/commands/fp16_safetensors.py",
    "chars": 5423,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/configuration_utils.py",
    "chars": 32484,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n# Copyright (c) 2022, NVIDIA CORPORATION.  All rights reserve"
  },
  {
    "path": "src/diffusers/dependency_versions_check.py",
    "chars": 1271,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/dependency_versions_table.py",
    "chars": 1507,
    "preview": "# THIS FILE HAS BEEN AUTOGENERATED. To update:\n# 1. modify the `_deps` dict in setup.py\n# 2. run `make deps_table_update"
  },
  {
    "path": "src/diffusers/experimental/README.md",
    "chars": 284,
    "preview": "# 🧨 Diffusers Experimental\n\nWe are adding experimental code to support novel applications and usages of the Diffusers li"
  },
  {
    "path": "src/diffusers/experimental/__init__.py",
    "chars": 38,
    "preview": "from .rl import ValueGuidedRLPipeline\n"
  },
  {
    "path": "src/diffusers/experimental/rl/__init__.py",
    "chars": 57,
    "preview": "from .value_guided_sampling import ValueGuidedRLPipeline\n"
  },
  {
    "path": "src/diffusers/experimental/rl/value_guided_sampling.py",
    "chars": 6033,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/image_processor.py",
    "chars": 45318,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/__init__.py",
    "chars": 4005,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ..utils import DIFFUSERS_SLOW_IMPORT, _LazyModule, deprecate\nfrom ..utils.import_"
  },
  {
    "path": "src/diffusers/loaders/ip_adapter.py",
    "chars": 16966,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/lora_base.py",
    "chars": 31716,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/lora_conversion_utils.py",
    "chars": 14322,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/lora_pipeline.py",
    "chars": 104464,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/peft.py",
    "chars": 16127,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "src/diffusers/loaders/single_file.py",
    "chars": 24149,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/single_file_model.py",
    "chars": 14330,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/single_file_utils.py",
    "chars": 88872,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "src/diffusers/loaders/textual_inversion.py",
    "chars": 26646,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/unet.py",
    "chars": 43709,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/unet_loader_utils.py",
    "chars": 6220,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/loaders/utils.py",
    "chars": 2423,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/README.md",
    "chars": 127,
    "preview": "# Models\n\nFor more detail on the models, please refer to the [docs](https://huggingface.co/docs/diffusers/api/models/ove"
  },
  {
    "path": "src/diffusers/models/__init__.py",
    "chars": 6494,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/activations.py",
    "chars": 5979,
    "preview": "# coding=utf-8\n# Copyright 2024 HuggingFace Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
  },
  {
    "path": "src/diffusers/models/adapter.py",
    "chars": 24723,
    "preview": "# Copyright 2022 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/attention.py",
    "chars": 50261,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/attention_flax.py",
    "chars": 20250,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/attention_processor.py",
    "chars": 177758,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/autoencoders/__init__.py",
    "chars": 421,
    "preview": "from .autoencoder_asym_kl import AsymmetricAutoencoderKL\nfrom .autoencoder_kl import AutoencoderKL\nfrom .autoencoder_kl_"
  },
  {
    "path": "src/diffusers/models/autoencoders/autoencoder_asym_kl.py",
    "chars": 7720,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/autoencoders/autoencoder_kl.py",
    "chars": 22299,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/autoencoders/autoencoder_kl_cogvideox.py",
    "chars": 40324,
    "preview": "# Copyright 2024 The CogVideoX team, Tsinghua University & ZhipuAI and The HuggingFace Team.\n# All rights reserved.\n#\n# "
  },
  {
    "path": "src/diffusers/models/autoencoders/autoencoder_kl_temporal_decoder.py",
    "chars": 16248,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/autoencoders/autoencoder_oobleck.py",
    "chars": 17046,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/autoencoders/autoencoder_tiny.py",
    "chars": 15992,
    "preview": "# Copyright 2024 Ollin Boer Bohan and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, "
  },
  {
    "path": "src/diffusers/models/autoencoders/consistency_decoder_vae.py",
    "chars": 19708,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/autoencoders/vae.py",
    "chars": 36545,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/autoencoders/vq_model.py",
    "chars": 7812,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/controlnet.py",
    "chars": 43239,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/controlnet_flax.py",
    "chars": 16708,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/controlnet_hunyuan.py",
    "chars": 16913,
    "preview": "# Copyright 2024 HunyuanDiT Authors, Qixun Wang and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Ap"
  },
  {
    "path": "src/diffusers/models/controlnet_sd3.py",
    "chars": 17950,
    "preview": "# Copyright 2024 Stability AI, The HuggingFace Team and The InstantX Team. All rights reserved.\n#\n# Licensed under the A"
  },
  {
    "path": "src/diffusers/models/controlnet_sparsectrl.py",
    "chars": 38539,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/controlnet_xs.py",
    "chars": 86859,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/downsampling.py",
    "chars": 15828,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/embeddings.py",
    "chars": 60815,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/embeddings_flax.py",
    "chars": 3445,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/lora.py",
    "chars": 18829,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/model_loading_utils.py",
    "chars": 8534,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n# Copyright (c) 2022, NVIDIA CORPORATION.  All rights reserve"
  },
  {
    "path": "src/diffusers/models/modeling_flax_pytorch_utils.py",
    "chars": 5332,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "src/diffusers/models/modeling_flax_utils.py",
    "chars": 26955,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "src/diffusers/models/modeling_outputs.py",
    "chars": 1042,
    "preview": "from dataclasses import dataclass\n\nfrom ..utils import BaseOutput\n\n\n@dataclass\nclass AutoencoderKLOutput(BaseOutput):\n  "
  },
  {
    "path": "src/diffusers/models/modeling_pytorch_flax_utils.py",
    "chars": 6973,
    "preview": "# coding=utf-8\r\n# Copyright 2024 The HuggingFace Inc. team.\r\n#\r\n# Licensed under the Apache License, Version 2.0 (the \"L"
  },
  {
    "path": "src/diffusers/models/modeling_utils.py",
    "chars": 56536,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n# Copyright (c) 2022, NVIDIA CORPORATION.  All rights reserve"
  },
  {
    "path": "src/diffusers/models/normalization.py",
    "chars": 16805,
    "preview": "# coding=utf-8\n# Copyright 2024 HuggingFace Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# y"
  },
  {
    "path": "src/diffusers/models/resnet.py",
    "chars": 32241,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n# `TemporalConvLayer` Copyright 2024 Alibaba DAMO-VILAB, The"
  },
  {
    "path": "src/diffusers/models/resnet_flax.py",
    "chars": 4021,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/transformers/__init__.py",
    "chars": 953,
    "preview": "from ...utils import is_torch_available\n\n\nif is_torch_available():\n    from .auraflow_transformer_2d import AuraFlowTran"
  },
  {
    "path": "src/diffusers/models/transformers/auraflow_transformer_2d.py",
    "chars": 21792,
    "preview": "# Copyright 2024 AuraFlow Authors, The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Ver"
  },
  {
    "path": "src/diffusers/models/transformers/cogvideox_transformer_3d.py",
    "chars": 15027,
    "preview": "# Copyright 2024 The CogVideoX team, Tsinghua University & ZhipuAI and The HuggingFace Team.\n# All rights reserved.\n#\n# "
  },
  {
    "path": "src/diffusers/models/transformers/dit_transformer_2d.py",
    "chars": 11158,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/transformers/dual_transformer_2d.py",
    "chars": 7711,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/transformers/hunyuan_transformer_2d.py",
    "chars": 24228,
    "preview": "# Copyright 2024 HunyuanDiT Authors, Qixun Wang and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Ap"
  },
  {
    "path": "src/diffusers/models/transformers/latte_transformer_3d.py",
    "chars": 15485,
    "preview": "# Copyright 2024 the Latte Team and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Ve"
  },
  {
    "path": "src/diffusers/models/transformers/lumina_nextdit2d.py",
    "chars": 14393,
    "preview": "# Copyright 2024 Alpha-VLLM Authors and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License"
  },
  {
    "path": "src/diffusers/models/transformers/pixart_transformer_2d.py",
    "chars": 21223,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/transformers/prior_transformer.py",
    "chars": 17325,
    "preview": "from dataclasses import dataclass\nfrom typing import Dict, Optional, Union\n\nimport torch\nimport torch.nn.functional as F"
  },
  {
    "path": "src/diffusers/models/transformers/stable_audio_transformer.py",
    "chars": 19315,
    "preview": "# Copyright 2024 Stability AI and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Vers"
  },
  {
    "path": "src/diffusers/models/transformers/t5_film_transformer.py",
    "chars": 16024,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/transformers/transformer_2d.py",
    "chars": 28953,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/transformers/transformer_flux.py",
    "chars": 20124,
    "preview": "# Copyright 2024 Black Forest Labs, The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Ve"
  },
  {
    "path": "src/diffusers/models/transformers/transformer_sd3.py",
    "chars": 16815,
    "preview": "# Copyright 2024 Stability AI, The HuggingFace Team and The InstantX Team. All rights reserved.\n#\n# Licensed under the A"
  },
  {
    "path": "src/diffusers/models/transformers/transformer_temporal.py",
    "chars": 16934,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/__init__.py",
    "chars": 695,
    "preview": "from ...utils import is_flax_available, is_torch_available\n\n\nif is_torch_available():\n    from .unet_1d import UNet1DMod"
  },
  {
    "path": "src/diffusers/models/unets/unet_1d.py",
    "chars": 10787,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_1d_blocks.py",
    "chars": 26831,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_2d.py",
    "chars": 16569,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_2d_blocks.py",
    "chars": 147552,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_2d_blocks_flax.py",
    "chars": 15572,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_2d_condition.py",
    "chars": 67015,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_2d_condition_flax.py",
    "chars": 22281,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_3d_blocks.py",
    "chars": 55317,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_3d_condition.py",
    "chars": 34436,
    "preview": "# Copyright 2024 Alibaba DAMO-VILAB and The HuggingFace Team. All rights reserved.\n# Copyright 2024 The ModelScope Team."
  },
  {
    "path": "src/diffusers/models/unets/unet_i2vgen_xl.py",
    "chars": 32769,
    "preview": "# Copyright 2024 Alibaba DAMO-VILAB and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License"
  },
  {
    "path": "src/diffusers/models/unets/unet_kandinsky3.py",
    "chars": 20753,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_motion_model.py",
    "chars": 103710,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/unet_spatio_temporal_condition.py",
    "chars": 22072,
    "preview": "from dataclasses import dataclass\nfrom typing import Dict, Optional, Tuple, Union\n\nimport torch\nimport torch.nn as nn\n\nf"
  },
  {
    "path": "src/diffusers/models/unets/unet_stable_cascade.py",
    "chars": 28324,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/unets/uvit_2d.py",
    "chars": 17311,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "src/diffusers/models/upsampling.py",
    "chars": 19075,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/vae_flax.py",
    "chars": 31942,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/models/vq_model.py",
    "chars": 1524,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/optimization.py",
    "chars": 14744,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "src/diffusers/pipelines/README.md",
    "chars": 17571,
    "preview": "# 🧨 Diffusers Pipelines\n\nPipelines provide a simple way to run state-of-the-art diffusion models in inference.\nMost diff"
  },
  {
    "path": "src/diffusers/pipelines/__init__.py",
    "chars": 26963,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ..utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n "
  },
  {
    "path": "src/diffusers/pipelines/amused/__init__.py",
    "chars": 1793,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/amused/pipeline_amused.py",
    "chars": 15624,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/amused/pipeline_amused_img2img.py",
    "chars": 17102,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/amused/pipeline_amused_inpaint.py",
    "chars": 18788,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/animatediff/__init__.py",
    "chars": 2100,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/animatediff/pipeline_animatediff.py",
    "chars": 41227,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/animatediff/pipeline_animatediff_controlnet.py",
    "chars": 54750,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py",
    "chars": 65298,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/animatediff/pipeline_animatediff_sparsectrl.py",
    "chars": 51067,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py",
    "chars": 50363,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/animatediff/pipeline_output.py",
    "chars": 729,
    "preview": "from dataclasses import dataclass\nfrom typing import List, Union\n\nimport numpy as np\nimport PIL.Image\nimport torch\n\nfrom"
  },
  {
    "path": "src/diffusers/pipelines/audioldm/__init__.py",
    "chars": 1419,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/audioldm/pipeline_audioldm.py",
    "chars": 26001,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/audioldm2/__init__.py",
    "chars": 1605,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/audioldm2/modeling_audioldm2.py",
    "chars": 72790,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py",
    "chars": 53244,
    "preview": "# Copyright 2024 CVSSP, ByteDance and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, "
  },
  {
    "path": "src/diffusers/pipelines/aura_flow/__init__.py",
    "chars": 1296,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/aura_flow/pipeline_aura_flow.py",
    "chars": 29023,
    "preview": "# Copyright 2024 AuraFlow Authors and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, "
  },
  {
    "path": "src/diffusers/pipelines/auto_pipeline.py",
    "chars": 53780,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "src/diffusers/pipelines/blip_diffusion/__init__.py",
    "chars": 697,
    "preview": "from dataclasses import dataclass\nfrom typing import List, Optional, Union\n\nimport numpy as np\nimport PIL\nfrom PIL impor"
  },
  {
    "path": "src/diffusers/pipelines/blip_diffusion/blip_image_processing.py",
    "chars": 16742,
    "preview": "# coding=utf-8\n# Copyright 2024 The HuggingFace Inc. team. All rights reserved.\n#\n# Licensed under the Apache License, V"
  },
  {
    "path": "src/diffusers/pipelines/blip_diffusion/modeling_blip2.py",
    "chars": 27283,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/blip_diffusion/modeling_ctx_clip.py",
    "chars": 9002,
    "preview": "# Copyright 2024 Salesforce.com, inc.\n# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the"
  },
  {
    "path": "src/diffusers/pipelines/blip_diffusion/pipeline_blip_diffusion.py",
    "chars": 15001,
    "preview": "# Copyright 2024 Salesforce.com, inc.\n# Copyright 2024 The HuggingFace Team. All rights reserved.#\n# Licensed under the "
  },
  {
    "path": "src/diffusers/pipelines/cogvideo/__init__.py",
    "chars": 1298,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py",
    "chars": 33529,
    "preview": "# Copyright 2024 The CogVideoX team, Tsinghua University & ZhipuAI and The HuggingFace Team.\n# All rights reserved.\n#\n# "
  },
  {
    "path": "src/diffusers/pipelines/consistency_models/__init__.py",
    "chars": 484,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    _LazyModule,\n)\n\n\n_import_structu"
  },
  {
    "path": "src/diffusers/pipelines/consistency_models/pipeline_consistency_models.py",
    "chars": 12368,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/__init__.py",
    "chars": 3483,
    "preview": "from typing import TYPE_CHECKING\r\n\r\nfrom ...utils import (\r\n    DIFFUSERS_SLOW_IMPORT,\r\n    OptionalDependencyNotAvailab"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/multicontrolnet.py",
    "chars": 9431,
    "preview": "import os\nfrom typing import Any, Callable, Dict, List, Optional, Tuple, Union\n\nimport torch\nfrom torch import nn\n\nfrom "
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_controlnet.py",
    "chars": 68776,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_controlnet_blip_diffusion.py",
    "chars": 17363,
    "preview": "# Copyright 2024 Salesforce.com, inc.\n# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py",
    "chars": 67034,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py",
    "chars": 75953,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py",
    "chars": 93724,
    "preview": "# Copyright 2024 Harutatsu Akiyama, Jinbin Bai, and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Ap"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py",
    "chars": 81939,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py",
    "chars": 86509,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet/pipeline_flax_controlnet.py",
    "chars": 22659,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet_hunyuandit/__init__.py",
    "chars": 1344,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py",
    "chars": 50061,
    "preview": "# Copyright 2024 HunyuanDiT Authors and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License"
  },
  {
    "path": "src/diffusers/pipelines/controlnet_sd3/__init__.py",
    "chars": 1647,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py",
    "chars": 54827,
    "preview": "# Copyright 2024 Stability AI, The HuggingFace Team and The InstantX Team. All rights reserved.\n#\n# Licensed under the A"
  },
  {
    "path": "src/diffusers/pipelines/controlnet_xs/__init__.py",
    "chars": 2403,
    "preview": "from typing import TYPE_CHECKING\r\n\r\nfrom ...utils import (\r\n    DIFFUSERS_SLOW_IMPORT,\r\n    OptionalDependencyNotAvailab"
  },
  {
    "path": "src/diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs.py",
    "chars": 45628,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/controlnet_xs/pipeline_controlnet_xs_sd_xl.py",
    "chars": 56754,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/dance_diffusion/__init__.py",
    "chars": 453,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\"pipeli"
  },
  {
    "path": "src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py",
    "chars": 6322,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/ddim/__init__.py",
    "chars": 411,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\"pipeli"
  },
  {
    "path": "src/diffusers/pipelines/ddim/pipeline_ddim.py",
    "chars": 6601,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/ddpm/__init__.py",
    "chars": 425,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    _LazyModule,\n)\n\n\n_import_structu"
  },
  {
    "path": "src/diffusers/pipelines/ddpm/pipeline_ddpm.py",
    "chars": 4959,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/__init__.py",
    "chars": 2975,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/pipeline_if.py",
    "chars": 35284,
    "preview": "import html\nimport inspect\nimport re\nimport urllib.parse as ul\nfrom typing import Any, Callable, Dict, List, Optional, U"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py",
    "chars": 39693,
    "preview": "import html\nimport inspect\nimport re\nimport urllib.parse as ul\nfrom typing import Any, Callable, Dict, List, Optional, U"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py",
    "chars": 44695,
    "preview": "import html\nimport inspect\nimport re\nimport urllib.parse as ul\nfrom typing import Any, Callable, Dict, List, Optional, U"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py",
    "chars": 44891,
    "preview": "import html\nimport inspect\nimport re\nimport urllib.parse as ul\nfrom typing import Any, Callable, Dict, List, Optional, U"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py",
    "chars": 49692,
    "preview": "import html\nimport inspect\nimport re\nimport urllib.parse as ul\nfrom typing import Any, Callable, Dict, List, Optional, U"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py",
    "chars": 39537,
    "preview": "import html\nimport inspect\nimport re\nimport urllib.parse as ul\nfrom typing import Any, Callable, Dict, List, Optional, U"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/pipeline_output.py",
    "chars": 1140,
    "preview": "from dataclasses import dataclass\nfrom typing import List, Optional, Union\n\nimport numpy as np\nimport PIL.Image\n\nfrom .."
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/safety_checker.py",
    "chars": 2117,
    "preview": "import numpy as np\nimport torch\nimport torch.nn as nn\nfrom transformers import CLIPConfig, CLIPVisionModelWithProjection"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/timesteps.py",
    "chars": 5164,
    "preview": "fast27_timesteps = [\n    999,\n    800,\n    799,\n    600,\n    599,\n    500,\n    400,\n    399,\n    377,\n    355,\n    333,\n"
  },
  {
    "path": "src/diffusers/pipelines/deepfloyd_if/watermark.py",
    "chars": 1601,
    "preview": "from typing import List\n\nimport PIL.Image\nimport torch\nfrom PIL import Image\n\nfrom ...configuration_utils import ConfigM"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/README.md",
    "chars": 267,
    "preview": "# Deprecated Pipelines\n\nThis folder contains pipelines that have very low usage as measured by model downloads, issues a"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/__init__.py",
    "chars": 5470,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ...utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,\n"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/alt_diffusion/__init__.py",
    "chars": 1783,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/alt_diffusion/modeling_roberta_series.py",
    "chars": 5530,
    "preview": "from dataclasses import dataclass\nfrom typing import Optional, Tuple\n\nimport torch\nfrom torch import nn\nfrom transformer"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py",
    "chars": 49520,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py",
    "chars": 52812,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_output.py",
    "chars": 928,
    "preview": "from dataclasses import dataclass\nfrom typing import List, Optional, Union\n\nimport numpy as np\nimport PIL.Image\n\nfrom .."
  },
  {
    "path": "src/diffusers/pipelines/deprecated/audio_diffusion/__init__.py",
    "chars": 507,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\n    \""
  },
  {
    "path": "src/diffusers/pipelines/deprecated/audio_diffusion/mel.py",
    "chars": 5764,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/audio_diffusion/pipeline_audio_diffusion.py",
    "chars": 13230,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py",
    "chars": 448,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\"pipel"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py",
    "chars": 5381,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/pndm/__init__.py",
    "chars": 412,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\"pipel"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/pndm/pipeline_pndm.py",
    "chars": 4658,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/repaint/__init__.py",
    "chars": 425,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\"pipel"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/repaint/pipeline_repaint.py",
    "chars": 10039,
    "preview": "# Copyright 2024 ETH Zurich Computer Vision Lab and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Ap"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/score_sde_ve/__init__.py",
    "chars": 441,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\"pipel"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/score_sde_ve/pipeline_score_sde_ve.py",
    "chars": 4390,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/spectrogram_diffusion/__init__.py",
    "chars": 2588,
    "preview": "# flake8: noqa\nfrom typing import TYPE_CHECKING\nfrom ....utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    _LazyModule,\n    "
  },
  {
    "path": "src/diffusers/pipelines/deprecated/spectrogram_diffusion/continuous_encoder.py",
    "chars": 3100,
    "preview": "# Copyright 2022 The Music Spectrogram Diffusion Authors.\n# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/spectrogram_diffusion/midi_utils.py",
    "chars": 25096,
    "preview": "# Copyright 2022 The Music Spectrogram Diffusion Authors.\n# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/spectrogram_diffusion/notes_encoder.py",
    "chars": 2923,
    "preview": "# Copyright 2022 The Music Spectrogram Diffusion Authors.\n# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/spectrogram_diffusion/pipeline_spectrogram_diffusion.py",
    "chars": 11528,
    "preview": "# Copyright 2022 The Music Spectrogram Diffusion Authors.\n# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stable_diffusion_variants/__init__.py",
    "chars": 2111,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import (\n    DIFFUSERS_SLOW_IMPORT,\n    OptionalDependencyNotAvailable,"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py",
    "chars": 47872,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_onnx_stable_diffusion_inpaint_legacy.py",
    "chars": 27814,
    "preview": "import inspect\nfrom typing import Callable, List, Optional, Union\n\nimport numpy as np\nimport PIL.Image\nimport torch\nfrom"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py",
    "chars": 42397,
    "preview": "# Copyright 2024 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lic"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_model_editing.py",
    "chars": 41436,
    "preview": "# Copyright 2024 TIME Authors and The HuggingFace Team. All rights reserved.\"\n# Licensed under the Apache License, Versi"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_paradigms.py",
    "chars": 41156,
    "preview": "# Copyright 2024 ParaDiGMS authors and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License,"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py",
    "chars": 63457,
    "preview": "# Copyright 2024 Pix2Pix Zero Authors and The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache Licen"
  },
  {
    "path": "src/diffusers/pipelines/deprecated/stochastic_karras_ve/__init__.py",
    "chars": 453,
    "preview": "from typing import TYPE_CHECKING\n\nfrom ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule\n\n\n_import_structure = {\"pipel"
  }
]

// ... and 278 more files (download for full content)

About this extraction

This page contains the full source code of the snap-research/stable-flow GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 478 files (10.6 MB), approximately 2.8M tokens, and a symbol index with 6563 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!