├── README.md ├── requirements.txt ├── setup.sh └── src ├── configs └── ti2i_jdb1M.json ├── diffusers ├── .gitignore ├── CITATION.cff ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── Makefile ├── PHILOSOPHY.md ├── README.md ├── _typos.toml ├── benchmarks │ ├── base_classes.py │ ├── benchmark_controlnet.py │ ├── benchmark_ip_adapters.py │ ├── benchmark_sd_img.py │ ├── benchmark_sd_inpainting.py │ ├── benchmark_t2i_adapter.py │ ├── benchmark_t2i_lcm_lora.py │ ├── benchmark_text_to_image.py │ ├── push_results.py │ ├── run_all.py │ └── utils.py ├── docker │ ├── diffusers-doc-builder │ │ └── Dockerfile │ ├── diffusers-flax-cpu │ │ └── Dockerfile │ ├── diffusers-flax-tpu │ │ └── Dockerfile │ ├── diffusers-onnxruntime-cpu │ │ └── Dockerfile │ ├── diffusers-onnxruntime-cuda │ │ └── Dockerfile │ ├── diffusers-pytorch-compile-cuda │ │ └── Dockerfile │ ├── diffusers-pytorch-cpu │ │ └── Dockerfile │ ├── diffusers-pytorch-cuda │ │ └── Dockerfile │ └── diffusers-pytorch-xformers-cuda │ │ └── Dockerfile ├── docs │ ├── README.md │ ├── TRANSLATING.md │ └── source │ │ ├── _config.py │ │ ├── en │ │ ├── _toctree.yml │ │ ├── advanced_inference │ │ │ └── outpaint.md │ │ ├── api │ │ │ ├── activations.md │ │ │ ├── attnprocessor.md │ │ │ ├── configuration.md │ │ │ ├── image_processor.md │ │ │ ├── internal_classes_overview.md │ │ │ ├── loaders │ │ │ │ ├── ip_adapter.md │ │ │ │ ├── lora.md │ │ │ │ ├── peft.md │ │ │ │ ├── single_file.md │ │ │ │ ├── textual_inversion.md │ │ │ │ ├── transformer_sd3.md │ │ │ │ └── unet.md │ │ │ ├── logging.md │ │ │ ├── models │ │ │ │ ├── allegro_transformer3d.md │ │ │ │ ├── asymmetricautoencoderkl.md │ │ │ │ ├── aura_flow_transformer2d.md │ │ │ │ ├── autoencoder_dc.md │ │ │ │ ├── autoencoder_kl_hunyuan_video.md │ │ │ │ ├── autoencoder_oobleck.md │ │ │ │ ├── autoencoder_tiny.md │ │ │ │ ├── autoencoderkl.md │ │ │ │ ├── autoencoderkl_allegro.md │ │ │ │ ├── autoencoderkl_cogvideox.md │ │ │ │ ├── autoencoderkl_ltx_video.md │ │ │ │ ├── autoencoderkl_mochi.md │ │ │ │ ├── cogvideox_transformer3d.md │ │ │ │ ├── cogview3plus_transformer2d.md │ │ │ │ ├── consistency_decoder_vae.md │ │ │ │ ├── controlnet.md │ │ │ │ ├── controlnet_flux.md │ │ │ │ ├── controlnet_hunyuandit.md │ │ │ │ ├── controlnet_sd3.md │ │ │ │ ├── controlnet_sparsectrl.md │ │ │ │ ├── controlnet_union.md │ │ │ │ ├── dit_transformer2d.md │ │ │ │ ├── flux_transformer.md │ │ │ │ ├── hunyuan_transformer2d.md │ │ │ │ ├── hunyuan_video_transformer_3d.md │ │ │ │ ├── latte_transformer3d.md │ │ │ │ ├── ltx_video_transformer3d.md │ │ │ │ ├── lumina_nextdit2d.md │ │ │ │ ├── mochi_transformer3d.md │ │ │ │ ├── overview.md │ │ │ │ ├── pixart_transformer2d.md │ │ │ │ ├── prior_transformer.md │ │ │ │ ├── sana_transformer2d.md │ │ │ │ ├── sd3_transformer2d.md │ │ │ │ ├── stable_audio_transformer.md │ │ │ │ ├── stable_cascade_unet.md │ │ │ │ ├── transformer2d.md │ │ │ │ ├── transformer_temporal.md │ │ │ │ ├── unet-motion.md │ │ │ │ ├── unet.md │ │ │ │ ├── unet2d-cond.md │ │ │ │ ├── unet2d.md │ │ │ │ ├── unet3d-cond.md │ │ │ │ ├── uvit2d.md │ │ │ │ └── vq.md │ │ │ ├── normalization.md │ │ │ ├── outputs.md │ │ │ ├── pipelines │ │ │ │ ├── allegro.md │ │ │ │ ├── amused.md │ │ │ │ ├── animatediff.md │ │ │ │ ├── attend_and_excite.md │ │ │ │ ├── audioldm.md │ │ │ │ ├── audioldm2.md │ │ │ │ ├── aura_flow.md │ │ │ │ ├── auto_pipeline.md │ │ │ │ ├── blip_diffusion.md │ │ │ │ ├── cogvideox.md │ │ │ │ ├── cogview3.md │ │ │ │ ├── consistency_models.md │ │ │ │ ├── control_flux_inpaint.md │ │ │ │ ├── controlnet.md │ │ │ │ ├── controlnet_flux.md │ │ │ │ ├── controlnet_hunyuandit.md │ │ │ │ ├── controlnet_sd3.md │ │ │ │ ├── controlnet_sdxl.md │ │ │ │ ├── controlnet_union.md │ │ │ │ ├── controlnetxs.md │ │ │ │ ├── controlnetxs_sdxl.md │ │ │ │ ├── dance_diffusion.md │ │ │ │ ├── ddim.md │ │ │ │ ├── ddpm.md │ │ │ │ ├── deepfloyd_if.md │ │ │ │ ├── diffedit.md │ │ │ │ ├── dit.md │ │ │ │ ├── flux.md │ │ │ │ ├── hunyuan_video.md │ │ │ │ ├── hunyuandit.md │ │ │ │ ├── i2vgenxl.md │ │ │ │ ├── kandinsky.md │ │ │ │ ├── kandinsky3.md │ │ │ │ ├── kandinsky_v22.md │ │ │ │ ├── kolors.md │ │ │ │ ├── latent_consistency_models.md │ │ │ │ ├── latent_diffusion.md │ │ │ │ ├── latte.md │ │ │ │ ├── ledits_pp.md │ │ │ │ ├── ltx_video.md │ │ │ │ ├── lumina.md │ │ │ │ ├── marigold.md │ │ │ │ ├── mochi.md │ │ │ │ ├── musicldm.md │ │ │ │ ├── overview.md │ │ │ │ ├── pag.md │ │ │ │ ├── paint_by_example.md │ │ │ │ ├── panorama.md │ │ │ │ ├── pia.md │ │ │ │ ├── pix2pix.md │ │ │ │ ├── pixart.md │ │ │ │ ├── pixart_sigma.md │ │ │ │ ├── sana.md │ │ │ │ ├── self_attention_guidance.md │ │ │ │ ├── semantic_stable_diffusion.md │ │ │ │ ├── shap_e.md │ │ │ │ ├── stable_audio.md │ │ │ │ ├── stable_cascade.md │ │ │ │ ├── stable_diffusion │ │ │ │ │ ├── adapter.md │ │ │ │ │ ├── depth2img.md │ │ │ │ │ ├── gligen.md │ │ │ │ │ ├── image_variation.md │ │ │ │ │ ├── img2img.md │ │ │ │ │ ├── inpaint.md │ │ │ │ │ ├── k_diffusion.md │ │ │ │ │ ├── latent_upscale.md │ │ │ │ │ ├── ldm3d_diffusion.md │ │ │ │ │ ├── overview.md │ │ │ │ │ ├── sdxl_turbo.md │ │ │ │ │ ├── stable_diffusion_2.md │ │ │ │ │ ├── stable_diffusion_3.md │ │ │ │ │ ├── stable_diffusion_safe.md │ │ │ │ │ ├── stable_diffusion_xl.md │ │ │ │ │ ├── svd.md │ │ │ │ │ ├── text2img.md │ │ │ │ │ └── upscale.md │ │ │ │ ├── stable_unclip.md │ │ │ │ ├── text_to_video.md │ │ │ │ ├── text_to_video_zero.md │ │ │ │ ├── unclip.md │ │ │ │ ├── unidiffuser.md │ │ │ │ ├── value_guided_sampling.md │ │ │ │ └── wuerstchen.md │ │ │ ├── quantization.md │ │ │ ├── schedulers │ │ │ │ ├── cm_stochastic_iterative.md │ │ │ │ ├── consistency_decoder.md │ │ │ │ ├── cosine_dpm.md │ │ │ │ ├── ddim.md │ │ │ │ ├── ddim_inverse.md │ │ │ │ ├── ddpm.md │ │ │ │ ├── deis.md │ │ │ │ ├── dpm_discrete.md │ │ │ │ ├── dpm_discrete_ancestral.md │ │ │ │ ├── dpm_sde.md │ │ │ │ ├── edm_euler.md │ │ │ │ ├── edm_multistep_dpm_solver.md │ │ │ │ ├── euler.md │ │ │ │ ├── euler_ancestral.md │ │ │ │ ├── flow_match_euler_discrete.md │ │ │ │ ├── flow_match_heun_discrete.md │ │ │ │ ├── heun.md │ │ │ │ ├── ipndm.md │ │ │ │ ├── lcm.md │ │ │ │ ├── lms_discrete.md │ │ │ │ ├── multistep_dpm_solver.md │ │ │ │ ├── multistep_dpm_solver_inverse.md │ │ │ │ ├── overview.md │ │ │ │ ├── pndm.md │ │ │ │ ├── repaint.md │ │ │ │ ├── score_sde_ve.md │ │ │ │ ├── score_sde_vp.md │ │ │ │ ├── singlestep_dpm_solver.md │ │ │ │ ├── stochastic_karras_ve.md │ │ │ │ ├── tcd.md │ │ │ │ ├── unipc.md │ │ │ │ └── vq_diffusion.md │ │ │ ├── utilities.md │ │ │ └── video_processor.md │ │ ├── community_projects.md │ │ ├── conceptual │ │ │ ├── contribution.md │ │ │ ├── ethical_guidelines.md │ │ │ ├── evaluation.md │ │ │ └── philosophy.md │ │ ├── imgs │ │ │ ├── access_request.png │ │ │ └── diffusers_library.jpg │ │ ├── index.md │ │ ├── installation.md │ │ ├── optimization │ │ │ ├── coreml.md │ │ │ ├── deepcache.md │ │ │ ├── fp16.md │ │ │ ├── habana.md │ │ │ ├── memory.md │ │ │ ├── mps.md │ │ │ ├── neuron.md │ │ │ ├── onnx.md │ │ │ ├── open_vino.md │ │ │ ├── tgate.md │ │ │ ├── tome.md │ │ │ ├── torch2.0.md │ │ │ ├── xdit.md │ │ │ └── xformers.md │ │ ├── quantization │ │ │ ├── bitsandbytes.md │ │ │ ├── gguf.md │ │ │ ├── overview.md │ │ │ └── torchao.md │ │ ├── quicktour.md │ │ ├── stable_diffusion.md │ │ ├── training │ │ │ ├── adapt_a_model.md │ │ │ ├── cogvideox.md │ │ │ ├── controlnet.md │ │ │ ├── create_dataset.md │ │ │ ├── custom_diffusion.md │ │ │ ├── ddpo.md │ │ │ ├── distributed_inference.md │ │ │ ├── dreambooth.md │ │ │ ├── instructpix2pix.md │ │ │ ├── kandinsky.md │ │ │ ├── lcm_distill.md │ │ │ ├── lora.md │ │ │ ├── overview.md │ │ │ ├── sdxl.md │ │ │ ├── t2i_adapters.md │ │ │ ├── text2image.md │ │ │ ├── text_inversion.md │ │ │ ├── unconditional_training.md │ │ │ └── wuerstchen.md │ │ ├── tutorials │ │ │ ├── autopipeline.md │ │ │ ├── basic_training.md │ │ │ ├── fast_diffusion.md │ │ │ ├── inference_with_big_models.md │ │ │ ├── tutorial_overview.md │ │ │ └── using_peft_for_inference.md │ │ └── using-diffusers │ │ │ ├── callback.md │ │ │ ├── cogvideox.md │ │ │ ├── conditional_image_generation.md │ │ │ ├── controlling_generation.md │ │ │ ├── controlnet.md │ │ │ ├── create_a_server.md │ │ │ ├── custom_pipeline_overview.md │ │ │ ├── depth2img.md │ │ │ ├── diffedit.md │ │ │ ├── image_quality.md │ │ │ ├── img2img.md │ │ │ ├── inference_with_lcm.md │ │ │ ├── inference_with_tcd_lora.md │ │ │ ├── inpaint.md │ │ │ ├── ip_adapter.md │ │ │ ├── kandinsky.md │ │ │ ├── loading.md │ │ │ ├── loading_adapters.md │ │ │ ├── marigold_usage.md │ │ │ ├── merge_loras.md │ │ │ ├── other-formats.md │ │ │ ├── overview_techniques.md │ │ │ ├── pag.md │ │ │ ├── push_to_hub.md │ │ │ ├── reusing_seeds.md │ │ │ ├── scheduler_features.md │ │ │ ├── schedulers.md │ │ │ ├── sdxl.md │ │ │ ├── sdxl_turbo.md │ │ │ ├── shap-e.md │ │ │ ├── stable_diffusion_jax_how_to.md │ │ │ ├── svd.md │ │ │ ├── t2i_adapter.md │ │ │ ├── text-img2vid.md │ │ │ ├── textual_inversion_inference.md │ │ │ ├── unconditional_image_generation.md │ │ │ ├── weighted_prompts.md │ │ │ └── write_own_pipeline.md │ │ ├── ja │ │ ├── _toctree.yml │ │ ├── index.md │ │ ├── installation.md │ │ ├── quicktour.md │ │ ├── stable_diffusion.md │ │ └── tutorials │ │ │ ├── autopipeline.md │ │ │ └── tutorial_overview.md │ │ ├── ko │ │ ├── _toctree.yml │ │ ├── api │ │ │ └── pipelines │ │ │ │ └── stable_diffusion │ │ │ │ └── stable_diffusion_xl.md │ │ ├── conceptual │ │ │ ├── contribution.md │ │ │ ├── ethical_guidelines.md │ │ │ ├── evaluation.md │ │ │ └── philosophy.md │ │ ├── in_translation.md │ │ ├── index.md │ │ ├── installation.md │ │ ├── optimization │ │ │ ├── coreml.md │ │ │ ├── fp16.md │ │ │ ├── habana.md │ │ │ ├── mps.md │ │ │ ├── onnx.md │ │ │ ├── open_vino.md │ │ │ ├── tome.md │ │ │ ├── torch2.0.md │ │ │ └── xformers.md │ │ ├── quicktour.md │ │ ├── stable_diffusion.md │ │ ├── training │ │ │ ├── adapt_a_model.md │ │ │ ├── controlnet.md │ │ │ ├── create_dataset.md │ │ │ ├── custom_diffusion.md │ │ │ ├── distributed_inference.md │ │ │ ├── dreambooth.md │ │ │ ├── instructpix2pix.md │ │ │ ├── lora.md │ │ │ ├── overview.md │ │ │ ├── text2image.md │ │ │ ├── text_inversion.md │ │ │ └── unconditional_training.md │ │ ├── tutorials │ │ │ ├── basic_training.md │ │ │ └── tutorial_overview.md │ │ └── using-diffusers │ │ │ ├── conditional_image_generation.md │ │ │ ├── controlling_generation.md │ │ │ ├── custom_pipeline_overview.md │ │ │ ├── depth2img.md │ │ │ ├── diffedit.md │ │ │ ├── img2img.md │ │ │ ├── inpaint.md │ │ │ ├── kandinsky.md │ │ │ ├── loading.md │ │ │ ├── loading_adapters.md │ │ │ ├── other-formats.md │ │ │ ├── push_to_hub.md │ │ │ ├── schedulers.md │ │ │ ├── sdxl_turbo.md │ │ │ ├── shap-e.md │ │ │ ├── stable_diffusion_jax_how_to.md │ │ │ ├── svd.md │ │ │ ├── textual_inversion_inference.md │ │ │ ├── unconditional_image_generation.md │ │ │ ├── weighted_prompts.md │ │ │ └── write_own_pipeline.md │ │ ├── pt │ │ ├── _toctree.yml │ │ ├── index.md │ │ ├── installation.md │ │ └── quicktour.md │ │ └── zh │ │ ├── _toctree.yml │ │ ├── index.md │ │ ├── installation.md │ │ ├── quicktour.md │ │ └── stable_diffusion.md ├── examples │ ├── README.md │ ├── advanced_diffusion_training │ │ ├── README.md │ │ ├── README_flux.md │ │ ├── requirements.txt │ │ ├── requirements_flux.txt │ │ ├── test_dreambooth_lora_flux_advanced.py │ │ ├── train_dreambooth_lora_flux_advanced.py │ │ ├── train_dreambooth_lora_sd15_advanced.py │ │ └── train_dreambooth_lora_sdxl_advanced.py │ ├── amused │ │ ├── README.md │ │ └── train_amused.py │ ├── cogvideo │ │ ├── README.md │ │ ├── requirements.txt │ │ ├── train_cogvideox_image_to_video_lora.py │ │ └── train_cogvideox_lora.py │ ├── community │ │ ├── README.md │ │ ├── README_community_scripts.md │ │ ├── adaptive_mask_inpainting.py │ │ ├── bit_diffusion.py │ │ ├── checkpoint_merger.py │ │ ├── clip_guided_images_mixing_stable_diffusion.py │ │ ├── clip_guided_stable_diffusion.py │ │ ├── clip_guided_stable_diffusion_img2img.py │ │ ├── composable_stable_diffusion.py │ │ ├── ddim_noise_comparative_analysis.py │ │ ├── dps_pipeline.py │ │ ├── edict_pipeline.py │ │ ├── fresco_v2v.py │ │ ├── gluegen.py │ │ ├── hd_painter.py │ │ ├── iadb.py │ │ ├── imagic_stable_diffusion.py │ │ ├── img2img_inpainting.py │ │ ├── instaflow_one_step.py │ │ ├── interpolate_stable_diffusion.py │ │ ├── ip_adapter_face_id.py │ │ ├── kohya_hires_fix.py │ │ ├── latent_consistency_img2img.py │ │ ├── latent_consistency_interpolate.py │ │ ├── latent_consistency_txt2img.py │ │ ├── llm_grounded_diffusion.py │ │ ├── lpw_stable_diffusion.py │ │ ├── lpw_stable_diffusion_onnx.py │ │ ├── lpw_stable_diffusion_xl.py │ │ ├── magic_mix.py │ │ ├── marigold_depth_estimation.py │ │ ├── masked_stable_diffusion_img2img.py │ │ ├── masked_stable_diffusion_xl_img2img.py │ │ ├── matryoshka.py │ │ ├── mixture_canvas.py │ │ ├── mixture_tiling.py │ │ ├── multilingual_stable_diffusion.py │ │ ├── one_step_unet.py │ │ ├── pipeline_animatediff_controlnet.py │ │ ├── pipeline_animatediff_img2video.py │ │ ├── pipeline_animatediff_ipex.py │ │ ├── pipeline_demofusion_sdxl.py │ │ ├── pipeline_fabric.py │ │ ├── pipeline_flux_differential_img2img.py │ │ ├── pipeline_flux_rf_inversion.py │ │ ├── pipeline_flux_with_cfg.py │ │ ├── pipeline_hunyuandit_differential_img2img.py │ │ ├── pipeline_kolors_differential_img2img.py │ │ ├── pipeline_null_text_inversion.py │ │ ├── pipeline_prompt2prompt.py │ │ ├── pipeline_sdxl_style_aligned.py │ │ ├── pipeline_stable_diffusion_3_differential_img2img.py │ │ ├── pipeline_stable_diffusion_boxdiff.py │ │ ├── pipeline_stable_diffusion_pag.py │ │ ├── pipeline_stable_diffusion_upscale_ldm3d.py │ │ ├── pipeline_stable_diffusion_xl_controlnet_adapter.py │ │ ├── pipeline_stable_diffusion_xl_controlnet_adapter_inpaint.py │ │ ├── pipeline_stable_diffusion_xl_differential_img2img.py │ │ ├── pipeline_stable_diffusion_xl_instandid_img2img.py │ │ ├── pipeline_stable_diffusion_xl_instantid.py │ │ ├── pipeline_stable_diffusion_xl_ipex.py │ │ ├── pipeline_zero1to3.py │ │ ├── regional_prompting_stable_diffusion.py │ │ ├── rerender_a_video.py │ │ ├── run_onnx_controlnet.py │ │ ├── run_tensorrt_controlnet.py │ │ ├── scheduling_ufogen.py │ │ ├── sd_text2img_k_diffusion.py │ │ ├── sde_drag.py │ │ ├── seed_resize_stable_diffusion.py │ │ ├── speech_to_image_diffusion.py │ │ ├── stable_diffusion_comparison.py │ │ ├── stable_diffusion_controlnet_img2img.py │ │ ├── stable_diffusion_controlnet_inpaint.py │ │ ├── stable_diffusion_controlnet_inpaint_img2img.py │ │ ├── stable_diffusion_controlnet_reference.py │ │ ├── stable_diffusion_ipex.py │ │ ├── stable_diffusion_mega.py │ │ ├── stable_diffusion_reference.py │ │ ├── stable_diffusion_repaint.py │ │ ├── stable_diffusion_tensorrt_img2img.py │ │ ├── stable_diffusion_tensorrt_inpaint.py │ │ ├── stable_diffusion_tensorrt_txt2img.py │ │ ├── stable_diffusion_xl_controlnet_reference.py │ │ ├── stable_diffusion_xl_reference.py │ │ ├── stable_unclip.py │ │ ├── text_inpainting.py │ │ ├── tiled_upscaling.py │ │ ├── unclip_image_interpolation.py │ │ ├── unclip_text_interpolation.py │ │ └── wildcard_stable_diffusion.py │ ├── conftest.py │ ├── consistency_distillation │ │ ├── README.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── test_lcm_lora.py │ │ ├── train_lcm_distill_lora_sd_wds.py │ │ ├── train_lcm_distill_lora_sdxl.py │ │ ├── train_lcm_distill_lora_sdxl_wds.py │ │ ├── train_lcm_distill_sd_wds.py │ │ └── train_lcm_distill_sdxl_wds.py │ ├── controlnet │ │ ├── README.md │ │ ├── README_flux.md │ │ ├── README_sd3.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── requirements_flax.txt │ │ ├── requirements_flux.txt │ │ ├── requirements_sd3.txt │ │ ├── requirements_sdxl.txt │ │ ├── test_controlnet.py │ │ ├── train_controlnet.py │ │ ├── train_controlnet_flax.py │ │ ├── train_controlnet_flux.py │ │ ├── train_controlnet_sd3.py │ │ └── train_controlnet_sdxl.py │ ├── custom_diffusion │ │ ├── README.md │ │ ├── requirements.txt │ │ ├── retrieve.py │ │ ├── test_custom_diffusion.py │ │ └── train_custom_diffusion.py │ ├── dreambooth │ │ ├── README.md │ │ ├── README_flux.md │ │ ├── README_sana.md │ │ ├── README_sd3.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── requirements_flax.txt │ │ ├── requirements_flux.txt │ │ ├── requirements_sana.txt │ │ ├── requirements_sd3.txt │ │ ├── requirements_sdxl.txt │ │ ├── test_dreambooth.py │ │ ├── test_dreambooth_flux.py │ │ ├── test_dreambooth_lora.py │ │ ├── test_dreambooth_lora_edm.py │ │ ├── test_dreambooth_lora_flux.py │ │ ├── test_dreambooth_lora_sana.py │ │ ├── test_dreambooth_lora_sd3.py │ │ ├── test_dreambooth_sd3.py │ │ ├── train_dreambooth.py │ │ ├── train_dreambooth_flax.py │ │ ├── train_dreambooth_flux.py │ │ ├── train_dreambooth_lora.py │ │ ├── train_dreambooth_lora_flux.py │ │ ├── train_dreambooth_lora_sana.py │ │ ├── train_dreambooth_lora_sd3.py │ │ ├── train_dreambooth_lora_sdxl.py │ │ └── train_dreambooth_sd3.py │ ├── flux-control │ │ ├── README.md │ │ ├── requirements.txt │ │ ├── train_control_flux.py │ │ └── train_control_lora_flux.py │ ├── inference │ │ ├── README.md │ │ ├── image_to_image.py │ │ └── inpainting.py │ ├── instruct_pix2pix │ │ ├── README.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── test_instruct_pix2pix.py │ │ ├── train_instruct_pix2pix.py │ │ └── train_instruct_pix2pix_sdxl.py │ ├── kandinsky2_2 │ │ └── text_to_image │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ ├── train_text_to_image_decoder.py │ │ │ ├── train_text_to_image_lora_decoder.py │ │ │ ├── train_text_to_image_lora_prior.py │ │ │ └── train_text_to_image_prior.py │ ├── model_search │ │ ├── README.md │ │ ├── pipeline_easy.py │ │ └── requirements.txt │ ├── reinforcement_learning │ │ ├── README.md │ │ ├── diffusion_policy.py │ │ └── run_diffuser_locomotion.py │ ├── research_projects │ │ ├── README.md │ │ ├── colossalai │ │ │ ├── README.md │ │ │ ├── inference.py │ │ │ ├── requirement.txt │ │ │ └── train_dreambooth_colossalai.py │ │ ├── consistency_training │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ └── train_cm_ct_unconditional.py │ │ ├── controlnet │ │ │ └── train_controlnet_webdataset.py │ │ ├── diffusion_dpo │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ ├── train_diffusion_dpo.py │ │ │ └── train_diffusion_dpo_sdxl.py │ │ ├── diffusion_orpo │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ ├── train_diffusion_orpo_sdxl_lora.py │ │ │ └── train_diffusion_orpo_sdxl_lora_wds.py │ │ ├── dreambooth_inpaint │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ ├── train_dreambooth_inpaint.py │ │ │ └── train_dreambooth_inpaint_lora.py │ │ ├── flux_lora_quantization │ │ │ ├── README.md │ │ │ ├── accelerate.yaml │ │ │ ├── compute_embeddings.py │ │ │ ├── ds2.yaml │ │ │ └── train_dreambooth_lora_flux_miniature.py │ │ ├── geodiff │ │ │ ├── README.md │ │ │ └── geodiff_molecule_conformation.ipynb │ │ ├── gligen │ │ │ ├── README.md │ │ │ ├── dataset.py │ │ │ ├── demo.ipynb │ │ │ ├── generated-images-100000-00.png │ │ │ ├── make_datasets.py │ │ │ ├── requirements.txt │ │ │ └── train_gligen_text.py │ │ ├── instructpix2pix_lora │ │ │ ├── README.md │ │ │ └── train_instruct_pix2pix_lora.py │ │ ├── intel_opts │ │ │ ├── README.md │ │ │ ├── inference_bf16.py │ │ │ ├── textual_inversion │ │ │ │ ├── README.md │ │ │ │ ├── requirements.txt │ │ │ │ └── textual_inversion_bf16.py │ │ │ └── textual_inversion_dfq │ │ │ │ ├── README.md │ │ │ │ ├── requirements.txt │ │ │ │ ├── text2images.py │ │ │ │ └── textual_inversion.py │ │ ├── ip_adapter │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ ├── tutorial_train_faceid.py │ │ │ ├── tutorial_train_ip-adapter.py │ │ │ ├── tutorial_train_plus.py │ │ │ └── tutorial_train_sdxl.py │ │ ├── lora │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ └── train_text_to_image_lora.py │ │ ├── multi_subject_dreambooth │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ └── train_multi_subject_dreambooth.py │ │ ├── multi_subject_dreambooth_inpainting │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ └── train_multi_subject_dreambooth_inpainting.py │ │ ├── multi_token_textual_inversion │ │ │ ├── README.md │ │ │ ├── multi_token_clip.py │ │ │ ├── requirements.txt │ │ │ ├── requirements_flax.txt │ │ │ ├── textual_inversion.py │ │ │ └── textual_inversion_flax.py │ │ ├── onnxruntime │ │ │ ├── README.md │ │ │ ├── text_to_image │ │ │ │ ├── README.md │ │ │ │ ├── requirements.txt │ │ │ │ └── train_text_to_image.py │ │ │ ├── textual_inversion │ │ │ │ ├── README.md │ │ │ │ ├── requirements.txt │ │ │ │ └── textual_inversion.py │ │ │ └── unconditional_image_generation │ │ │ │ ├── README.md │ │ │ │ ├── requirements.txt │ │ │ │ └── train_unconditional.py │ │ ├── pixart │ │ │ ├── .gitignore │ │ │ ├── controlnet_pixart_alpha.py │ │ │ ├── pipeline_pixart_alpha_controlnet.py │ │ │ ├── requirements.txt │ │ │ ├── run_pixart_alpha_controlnet_pipeline.py │ │ │ ├── train_controlnet_hf_diffusers.sh │ │ │ └── train_pixart_controlnet_hf.py │ │ ├── promptdiffusion │ │ │ ├── README.md │ │ │ ├── convert_original_promptdiffusion_to_diffusers.py │ │ │ ├── pipeline_prompt_diffusion.py │ │ │ └── promptdiffusioncontrolnet.py │ │ ├── pytorch_xla │ │ │ ├── README.md │ │ │ ├── requirements.txt │ │ │ └── train_text_to_image_xla.py │ │ ├── rdm │ │ │ ├── README.md │ │ │ ├── pipeline_rdm.py │ │ │ └── retriever.py │ │ ├── realfill │ │ │ ├── README.md │ │ │ ├── infer.py │ │ │ ├── requirements.txt │ │ │ └── train_realfill.py │ │ ├── scheduled_huber_loss_training │ │ │ ├── README.md │ │ │ ├── dreambooth │ │ │ │ ├── train_dreambooth.py │ │ │ │ ├── train_dreambooth_lora.py │ │ │ │ └── train_dreambooth_lora_sdxl.py │ │ │ └── text_to_image │ │ │ │ ├── train_text_to_image.py │ │ │ │ ├── train_text_to_image_lora.py │ │ │ │ ├── train_text_to_image_lora_sdxl.py │ │ │ │ └── train_text_to_image_sdxl.py │ │ ├── sd3_lora_colab │ │ │ ├── README.md │ │ │ ├── compute_embeddings.py │ │ │ ├── sd3_dreambooth_lora_16gb.ipynb │ │ │ └── train_dreambooth_lora_sd3_miniature.py │ │ ├── sdxl_flax │ │ │ ├── README.md │ │ │ ├── sdxl_single.py │ │ │ └── sdxl_single_aot.py │ │ ├── vae │ │ │ ├── README.md │ │ │ └── vae_roundtrip.py │ │ └── wuerstchen │ │ │ └── text_to_image │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── modeling_efficient_net_encoder.py │ │ │ ├── requirements.txt │ │ │ ├── train_text_to_image_lora_prior.py │ │ │ └── train_text_to_image_prior.py │ ├── server │ │ ├── README.md │ │ ├── requirements.in │ │ ├── requirements.txt │ │ └── server.py │ ├── t2i_adapter │ │ ├── README.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── test_t2i_adapter.py │ │ └── train_t2i_adapter_sdxl.py │ ├── test_examples_utils.py │ ├── text_to_image │ │ ├── README.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── requirements_flax.txt │ │ ├── requirements_sdxl.txt │ │ ├── test_text_to_image.py │ │ ├── test_text_to_image_lora.py │ │ ├── train_text_to_image.py │ │ ├── train_text_to_image_flax.py │ │ ├── train_text_to_image_lora.py │ │ ├── train_text_to_image_lora_sdxl.py │ │ └── train_text_to_image_sdxl.py │ ├── textual_inversion │ │ ├── README.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── requirements_flax.txt │ │ ├── test_textual_inversion.py │ │ ├── test_textual_inversion_sdxl.py │ │ ├── textual_inversion.py │ │ ├── textual_inversion_flax.py │ │ └── textual_inversion_sdxl.py │ ├── unconditional_image_generation │ │ ├── README.md │ │ ├── requirements.txt │ │ ├── test_unconditional.py │ │ └── train_unconditional.py │ └── vqgan │ │ ├── README.md │ │ ├── discriminator.py │ │ ├── requirements.txt │ │ ├── test_vqgan.py │ │ └── train_vqgan.py ├── pyproject.toml ├── scripts │ ├── __init__.py │ ├── change_naming_configs_and_checkpoints.py │ ├── conversion_ldm_uncond.py │ ├── convert_amused.py │ ├── convert_animatediff_motion_lora_to_diffusers.py │ ├── convert_animatediff_motion_module_to_diffusers.py │ ├── convert_animatediff_sparsectrl_to_diffusers.py │ ├── convert_asymmetric_vqgan_to_diffusers.py │ ├── convert_aura_flow_to_diffusers.py │ ├── convert_blipdiffusion_to_diffusers.py │ ├── convert_cogvideox_to_diffusers.py │ ├── convert_cogview3_to_diffusers.py │ ├── convert_consistency_decoder.py │ ├── convert_consistency_to_diffusers.py │ ├── convert_dance_diffusion_to_diffusers.py │ ├── convert_dcae_to_diffusers.py │ ├── convert_ddpm_original_checkpoint_to_diffusers.py │ ├── convert_diffusers_sdxl_lora_to_webui.py │ ├── convert_diffusers_to_original_sdxl.py │ ├── convert_diffusers_to_original_stable_diffusion.py │ ├── convert_dit_to_diffusers.py │ ├── convert_flux_to_diffusers.py │ ├── convert_flux_xlabs_ipadapter_to_diffusers.py │ ├── convert_gligen_to_diffusers.py │ ├── convert_hunyuan_video_to_diffusers.py │ ├── convert_hunyuandit_controlnet_to_diffusers.py │ ├── convert_hunyuandit_to_diffusers.py │ ├── convert_i2vgen_to_diffusers.py │ ├── convert_if.py │ ├── convert_k_upscaler_to_diffusers.py │ ├── convert_kakao_brain_unclip_to_diffusers.py │ ├── convert_kandinsky3_unet.py │ ├── convert_kandinsky_to_diffusers.py │ ├── convert_ldm_original_checkpoint_to_diffusers.py │ ├── convert_lora_safetensor_to_diffusers.py │ ├── convert_ltx_to_diffusers.py │ ├── convert_lumina_to_diffusers.py │ ├── convert_mochi_to_diffusers.py │ ├── convert_models_diffuser_to_diffusers.py │ ├── convert_ms_text_to_video_to_diffusers.py │ ├── convert_music_spectrogram_to_diffusers.py │ ├── convert_ncsnpp_original_checkpoint_to_diffusers.py │ ├── convert_original_audioldm2_to_diffusers.py │ ├── convert_original_audioldm_to_diffusers.py │ ├── convert_original_controlnet_to_diffusers.py │ ├── convert_original_musicldm_to_diffusers.py │ ├── convert_original_stable_diffusion_to_diffusers.py │ ├── convert_original_t2i_adapter.py │ ├── convert_pixart_alpha_to_diffusers.py │ ├── convert_pixart_sigma_to_diffusers.py │ ├── convert_sana_to_diffusers.py │ ├── convert_sd3_controlnet_to_diffusers.py │ ├── convert_sd3_to_diffusers.py │ ├── convert_shap_e_to_diffusers.py │ ├── convert_stable_audio.py │ ├── convert_stable_cascade.py │ ├── convert_stable_cascade_lite.py │ ├── convert_stable_diffusion_checkpoint_to_onnx.py │ ├── convert_stable_diffusion_controlnet_to_onnx.py │ ├── convert_stable_diffusion_controlnet_to_tensorrt.py │ ├── convert_svd_to_diffusers.py │ ├── convert_tiny_autoencoder_to_diffusers.py │ ├── convert_unclip_txt2img_to_image_variation.py │ ├── convert_unidiffuser_to_diffusers.py │ ├── convert_vae_diff_to_onnx.py │ ├── convert_vae_pt_to_diffusers.py │ ├── convert_versatile_diffusion_to_diffusers.py │ ├── convert_vq_diffusion_to_diffusers.py │ ├── convert_wuerstchen.py │ ├── convert_zero123_to_diffusers.py │ └── generate_logits.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 │ │ ├── transformer_flux.py │ │ ├── transformer_sd3.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_dc.py │ │ │ ├── autoencoder_kl.py │ │ │ ├── autoencoder_kl_allegro.py │ │ │ ├── autoencoder_kl_cogvideox.py │ │ │ ├── autoencoder_kl_hunyuan_video.py │ │ │ ├── autoencoder_kl_ltx.py │ │ │ ├── autoencoder_kl_mochi.py │ │ │ ├── autoencoder_kl_temporal_decoder.py │ │ │ ├── autoencoder_oobleck.py │ │ │ ├── autoencoder_tiny.py │ │ │ ├── consistency_decoder_vae.py │ │ │ ├── vae.py │ │ │ └── vq_model.py │ │ ├── controlnet.py │ │ ├── controlnet_flux.py │ │ ├── controlnet_sd3.py │ │ ├── controlnet_sparsectrl.py │ │ ├── controlnets │ │ │ ├── __init__.py │ │ │ ├── controlnet.py │ │ │ ├── controlnet_flax.py │ │ │ ├── controlnet_flux.py │ │ │ ├── controlnet_hunyuan.py │ │ │ ├── controlnet_sd3.py │ │ │ ├── controlnet_sparsectrl.py │ │ │ ├── controlnet_union.py │ │ │ ├── controlnet_xs.py │ │ │ └── multicontrolnet.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 │ │ │ ├── sana_transformer.py │ │ │ ├── stable_audio_transformer.py │ │ │ ├── t5_film_transformer.py │ │ │ ├── transformer_2d.py │ │ │ ├── transformer_allegro.py │ │ │ ├── transformer_cogview3plus.py │ │ │ ├── transformer_flux.py │ │ │ ├── transformer_hunyuan_video.py │ │ │ ├── transformer_ltx.py │ │ │ ├── transformer_mochi.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 │ │ ├── allegro │ │ │ ├── __init__.py │ │ │ ├── pipeline_allegro.py │ │ │ └── pipeline_output.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_animatediff_video2video_controlnet.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 │ │ │ ├── pipeline_cogvideox_fun_control.py │ │ │ ├── pipeline_cogvideox_image2video.py │ │ │ ├── pipeline_cogvideox_video2video.py │ │ │ └── pipeline_output.py │ │ ├── cogview3 │ │ │ ├── __init__.py │ │ │ ├── pipeline_cogview3plus.py │ │ │ └── pipeline_output.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_controlnet_union_inpaint_sd_xl.py │ │ │ ├── pipeline_controlnet_union_sd_xl.py │ │ │ ├── pipeline_controlnet_union_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 │ │ │ └── pipeline_stable_diffusion_3_controlnet_inpainting.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 │ │ │ ├── modeling_flux.py │ │ │ ├── pipeline_flux.py │ │ │ ├── pipeline_flux_control.py │ │ │ ├── pipeline_flux_control_img2img.py │ │ │ ├── pipeline_flux_control_inpaint.py │ │ │ ├── pipeline_flux_controlnet.py │ │ │ ├── pipeline_flux_controlnet_image_to_image.py │ │ │ ├── pipeline_flux_controlnet_inpainting.py │ │ │ ├── pipeline_flux_fill.py │ │ │ ├── pipeline_flux_img2img.py │ │ │ ├── pipeline_flux_inpaint.py │ │ │ ├── pipeline_flux_prior_redux.py │ │ │ └── pipeline_output.py │ │ ├── free_init_utils.py │ │ ├── free_noise_utils.py │ │ ├── hunyuan_video │ │ │ ├── __init__.py │ │ │ ├── pipeline_hunyuan_video.py │ │ │ └── pipeline_output.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 │ │ ├── ltx │ │ │ ├── __init__.py │ │ │ ├── pipeline_ltx.py │ │ │ ├── pipeline_ltx_image2video.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 │ │ ├── mochi │ │ │ ├── __init__.py │ │ │ ├── pipeline_mochi.py │ │ │ └── pipeline_output.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_inpaint.py │ │ │ ├── pipeline_pag_controlnet_sd_xl.py │ │ │ ├── pipeline_pag_controlnet_sd_xl_img2img.py │ │ │ ├── pipeline_pag_hunyuandit.py │ │ │ ├── pipeline_pag_kolors.py │ │ │ ├── pipeline_pag_pixart_sigma.py │ │ │ ├── pipeline_pag_sana.py │ │ │ ├── pipeline_pag_sd.py │ │ │ ├── pipeline_pag_sd_3.py │ │ │ ├── pipeline_pag_sd_3_img2img.py │ │ │ ├── pipeline_pag_sd_animatediff.py │ │ │ ├── pipeline_pag_sd_img2img.py │ │ │ ├── pipeline_pag_sd_inpaint.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 │ │ ├── sana │ │ │ ├── __init__.py │ │ │ ├── pipeline_output.py │ │ │ └── pipeline_sana.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_qwen_vl_stable_diffusion_3.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 │ │ ├── quantizers │ │ ├── __init__.py │ │ ├── auto.py │ │ ├── base.py │ │ ├── bitsandbytes │ │ │ ├── __init__.py │ │ │ ├── bnb_quantizer.py │ │ │ └── utils.py │ │ ├── gguf │ │ │ ├── __init__.py │ │ │ ├── gguf_quantizer.py │ │ │ └── utils.py │ │ ├── quantization_config.py │ │ └── torchao │ │ │ ├── __init__.py │ │ │ └── torchao_quantizer.py │ │ ├── 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 ├── tests │ ├── __init__.py │ ├── conftest.py │ ├── fixtures │ │ ├── custom_pipeline │ │ │ ├── pipeline.py │ │ │ └── what_ever.py │ │ └── elise_format0.mid │ ├── lora │ │ ├── test_deprecated_utilities.py │ │ ├── test_lora_layers_cogvideox.py │ │ ├── test_lora_layers_flux.py │ │ ├── test_lora_layers_hunyuanvideo.py │ │ ├── test_lora_layers_ltx_video.py │ │ ├── test_lora_layers_mochi.py │ │ ├── test_lora_layers_sana.py │ │ ├── test_lora_layers_sd.py │ │ ├── test_lora_layers_sd3.py │ │ ├── test_lora_layers_sdxl.py │ │ └── utils.py │ ├── models │ │ ├── __init__.py │ │ ├── autoencoders │ │ │ ├── __init__.py │ │ │ ├── test_models_asymmetric_autoencoder_kl.py │ │ │ ├── test_models_autoencoder_dc.py │ │ │ ├── test_models_autoencoder_hunyuan_video.py │ │ │ ├── test_models_autoencoder_kl.py │ │ │ ├── test_models_autoencoder_kl_cogvideox.py │ │ │ ├── test_models_autoencoder_kl_temporal_decoder.py │ │ │ ├── test_models_autoencoder_ltx_video.py │ │ │ ├── test_models_autoencoder_oobleck.py │ │ │ ├── test_models_autoencoder_tiny.py │ │ │ ├── test_models_consistency_decoder_vae.py │ │ │ ├── test_models_vae_flax.py │ │ │ ├── test_models_vq.py │ │ │ └── vae.py │ │ ├── test_activations.py │ │ ├── test_attention_processor.py │ │ ├── test_layers_utils.py │ │ ├── test_modeling_common.py │ │ ├── test_modeling_common_flax.py │ │ ├── transformers │ │ │ ├── __init__.py │ │ │ ├── test_models_dit_transformer2d.py │ │ │ ├── test_models_pixart_transformer2d.py │ │ │ ├── test_models_prior.py │ │ │ ├── test_models_transformer_allegro.py │ │ │ ├── test_models_transformer_aura_flow.py │ │ │ ├── test_models_transformer_cogvideox.py │ │ │ ├── test_models_transformer_cogview3plus.py │ │ │ ├── test_models_transformer_flux.py │ │ │ ├── test_models_transformer_hunyuan_dit.py │ │ │ ├── test_models_transformer_hunyuan_video.py │ │ │ ├── test_models_transformer_latte.py │ │ │ ├── test_models_transformer_ltx.py │ │ │ ├── test_models_transformer_lumina.py │ │ │ ├── test_models_transformer_mochi.py │ │ │ ├── test_models_transformer_sana.py │ │ │ ├── test_models_transformer_sd3.py │ │ │ └── test_models_transformer_temporal.py │ │ └── unets │ │ │ ├── __init__.py │ │ │ ├── test_models_unet_1d.py │ │ │ ├── test_models_unet_2d.py │ │ │ ├── test_models_unet_2d_condition.py │ │ │ ├── test_models_unet_2d_flax.py │ │ │ ├── test_models_unet_3d_condition.py │ │ │ ├── test_models_unet_controlnetxs.py │ │ │ ├── test_models_unet_motion.py │ │ │ ├── test_models_unet_spatiotemporal.py │ │ │ ├── test_unet_2d_blocks.py │ │ │ └── test_unet_blocks_common.py │ ├── others │ │ ├── test_check_copies.py │ │ ├── test_check_dummies.py │ │ ├── test_config.py │ │ ├── test_dependencies.py │ │ ├── test_ema.py │ │ ├── test_hub_utils.py │ │ ├── test_image_processor.py │ │ ├── test_outputs.py │ │ ├── test_training.py │ │ ├── test_utils.py │ │ └── test_video_processor.py │ ├── pipelines │ │ ├── __init__.py │ │ ├── allegro │ │ │ ├── __init__.py │ │ │ └── test_allegro.py │ │ ├── amused │ │ │ ├── __init__.py │ │ │ ├── test_amused.py │ │ │ ├── test_amused_img2img.py │ │ │ └── test_amused_inpaint.py │ │ ├── animatediff │ │ │ ├── __init__.py │ │ │ ├── test_animatediff.py │ │ │ ├── test_animatediff_controlnet.py │ │ │ ├── test_animatediff_sdxl.py │ │ │ ├── test_animatediff_sparsectrl.py │ │ │ ├── test_animatediff_video2video.py │ │ │ └── test_animatediff_video2video_controlnet.py │ │ ├── audioldm │ │ │ ├── __init__.py │ │ │ └── test_audioldm.py │ │ ├── audioldm2 │ │ │ ├── __init__.py │ │ │ └── test_audioldm2.py │ │ ├── aura_flow │ │ │ ├── __init__.py │ │ │ └── test_pipeline_aura_flow.py │ │ ├── blipdiffusion │ │ │ ├── __init__.py │ │ │ └── test_blipdiffusion.py │ │ ├── cogvideo │ │ │ ├── __init__.py │ │ │ ├── test_cogvideox.py │ │ │ ├── test_cogvideox_fun_control.py │ │ │ ├── test_cogvideox_image2video.py │ │ │ └── test_cogvideox_video2video.py │ │ ├── cogview3 │ │ │ ├── __init__.py │ │ │ └── test_cogview3plus.py │ │ ├── consistency_models │ │ │ ├── __init__.py │ │ │ └── test_consistency_models.py │ │ ├── controlnet │ │ │ ├── __init__.py │ │ │ ├── test_controlnet.py │ │ │ ├── test_controlnet_blip_diffusion.py │ │ │ ├── test_controlnet_img2img.py │ │ │ ├── test_controlnet_inpaint.py │ │ │ ├── test_controlnet_inpaint_sdxl.py │ │ │ ├── test_controlnet_sdxl.py │ │ │ ├── test_controlnet_sdxl_img2img.py │ │ │ └── test_flax_controlnet.py │ │ ├── controlnet_flux │ │ │ ├── __init__.py │ │ │ ├── test_controlnet_flux.py │ │ │ ├── test_controlnet_flux_img2img.py │ │ │ └── test_controlnet_flux_inpaint.py │ │ ├── controlnet_hunyuandit │ │ │ ├── __init__.py │ │ │ └── test_controlnet_hunyuandit.py │ │ ├── controlnet_sd3 │ │ │ ├── __init__.py │ │ │ ├── test_controlnet_inpaint_sd3.py │ │ │ └── test_controlnet_sd3.py │ │ ├── controlnet_xs │ │ │ ├── __init__.py │ │ │ ├── test_controlnetxs.py │ │ │ └── test_controlnetxs_sdxl.py │ │ ├── dance_diffusion │ │ │ ├── __init__.py │ │ │ └── test_dance_diffusion.py │ │ ├── ddim │ │ │ ├── __init__.py │ │ │ └── test_ddim.py │ │ ├── ddpm │ │ │ ├── __init__.py │ │ │ └── test_ddpm.py │ │ ├── deepfloyd_if │ │ │ ├── __init__.py │ │ │ ├── test_if.py │ │ │ ├── test_if_img2img.py │ │ │ ├── test_if_img2img_superresolution.py │ │ │ ├── test_if_inpainting.py │ │ │ ├── test_if_inpainting_superresolution.py │ │ │ └── test_if_superresolution.py │ │ ├── dit │ │ │ ├── __init__.py │ │ │ └── test_dit.py │ │ ├── flux │ │ │ ├── __init__.py │ │ │ ├── test_pipeline_flux.py │ │ │ ├── test_pipeline_flux_control.py │ │ │ ├── test_pipeline_flux_control_img2img.py │ │ │ ├── test_pipeline_flux_control_inpaint.py │ │ │ ├── test_pipeline_flux_fill.py │ │ │ ├── test_pipeline_flux_img2img.py │ │ │ ├── test_pipeline_flux_inpaint.py │ │ │ └── test_pipeline_flux_redux.py │ │ ├── hunyuan_dit │ │ │ ├── __init__.py │ │ │ └── test_hunyuan_dit.py │ │ ├── hunyuan_video │ │ │ ├── __init__.py │ │ │ └── test_hunyuan_video.py │ │ ├── i2vgen_xl │ │ │ ├── __init__.py │ │ │ └── test_i2vgenxl.py │ │ ├── ip_adapters │ │ │ └── test_ip_adapter_stable_diffusion.py │ │ ├── kandinsky │ │ │ ├── __init__.py │ │ │ ├── test_kandinsky.py │ │ │ ├── test_kandinsky_combined.py │ │ │ ├── test_kandinsky_img2img.py │ │ │ ├── test_kandinsky_inpaint.py │ │ │ └── test_kandinsky_prior.py │ │ ├── kandinsky2_2 │ │ │ ├── __init__.py │ │ │ ├── test_kandinsky.py │ │ │ ├── test_kandinsky_combined.py │ │ │ ├── test_kandinsky_controlnet.py │ │ │ ├── test_kandinsky_controlnet_img2img.py │ │ │ ├── test_kandinsky_img2img.py │ │ │ ├── test_kandinsky_inpaint.py │ │ │ ├── test_kandinsky_prior.py │ │ │ └── test_kandinsky_prior_emb2emb.py │ │ ├── kandinsky3 │ │ │ ├── __init__.py │ │ │ ├── test_kandinsky3.py │ │ │ └── test_kandinsky3_img2img.py │ │ ├── kolors │ │ │ ├── __init__.py │ │ │ ├── test_kolors.py │ │ │ └── test_kolors_img2img.py │ │ ├── latent_consistency_models │ │ │ ├── __init__.py │ │ │ ├── test_latent_consistency_models.py │ │ │ └── test_latent_consistency_models_img2img.py │ │ ├── latent_diffusion │ │ │ ├── __init__.py │ │ │ ├── test_latent_diffusion.py │ │ │ └── test_latent_diffusion_superresolution.py │ │ ├── latte │ │ │ ├── __init__.py │ │ │ └── test_latte.py │ │ ├── ledits_pp │ │ │ ├── __init__.py │ │ │ ├── test_ledits_pp_stable_diffusion.py │ │ │ └── test_ledits_pp_stable_diffusion_xl.py │ │ ├── ltx │ │ │ ├── __init__.py │ │ │ ├── test_ltx.py │ │ │ └── test_ltx_image2video.py │ │ ├── lumina │ │ │ ├── __init__.py │ │ │ └── test_lumina_nextdit.py │ │ ├── marigold │ │ │ ├── __init__.py │ │ │ ├── test_marigold_depth.py │ │ │ └── test_marigold_normals.py │ │ ├── mochi │ │ │ ├── __init__.py │ │ │ └── test_mochi.py │ │ ├── musicldm │ │ │ ├── __init__.py │ │ │ └── test_musicldm.py │ │ ├── pag │ │ │ ├── __init__.py │ │ │ ├── test_pag_animatediff.py │ │ │ ├── test_pag_controlnet_sd.py │ │ │ ├── test_pag_controlnet_sd_inpaint.py │ │ │ ├── test_pag_controlnet_sdxl.py │ │ │ ├── test_pag_controlnet_sdxl_img2img.py │ │ │ ├── test_pag_hunyuan_dit.py │ │ │ ├── test_pag_kolors.py │ │ │ ├── test_pag_pixart_sigma.py │ │ │ ├── test_pag_sana.py │ │ │ ├── test_pag_sd.py │ │ │ ├── test_pag_sd3.py │ │ │ ├── test_pag_sd3_img2img.py │ │ │ ├── test_pag_sd_img2img.py │ │ │ ├── test_pag_sd_inpaint.py │ │ │ ├── test_pag_sdxl.py │ │ │ ├── test_pag_sdxl_img2img.py │ │ │ └── test_pag_sdxl_inpaint.py │ │ ├── paint_by_example │ │ │ ├── __init__.py │ │ │ └── test_paint_by_example.py │ │ ├── pia │ │ │ ├── __init__.py │ │ │ └── test_pia.py │ │ ├── pipeline_params.py │ │ ├── pixart_alpha │ │ │ ├── __init__.py │ │ │ └── test_pixart.py │ │ ├── pixart_sigma │ │ │ ├── __init__.py │ │ │ └── test_pixart.py │ │ ├── pndm │ │ │ ├── __init__.py │ │ │ └── test_pndm.py │ │ ├── sana │ │ │ ├── __init__.py │ │ │ └── test_sana.py │ │ ├── semantic_stable_diffusion │ │ │ ├── __init__.py │ │ │ └── test_semantic_diffusion.py │ │ ├── shap_e │ │ │ ├── __init__.py │ │ │ ├── test_shap_e.py │ │ │ └── test_shap_e_img2img.py │ │ ├── stable_audio │ │ │ ├── __init__.py │ │ │ └── test_stable_audio.py │ │ ├── stable_cascade │ │ │ ├── __init__.py │ │ │ ├── test_stable_cascade_combined.py │ │ │ ├── test_stable_cascade_decoder.py │ │ │ └── test_stable_cascade_prior.py │ │ ├── stable_diffusion │ │ │ ├── __init__.py │ │ │ ├── test_onnx_stable_diffusion.py │ │ │ ├── test_onnx_stable_diffusion_img2img.py │ │ │ ├── test_onnx_stable_diffusion_inpaint.py │ │ │ ├── test_onnx_stable_diffusion_upscale.py │ │ │ ├── test_stable_diffusion.py │ │ │ ├── test_stable_diffusion_img2img.py │ │ │ ├── test_stable_diffusion_inpaint.py │ │ │ └── test_stable_diffusion_instruction_pix2pix.py │ │ ├── stable_diffusion_2 │ │ │ ├── __init__.py │ │ │ ├── test_stable_diffusion.py │ │ │ ├── test_stable_diffusion_attend_and_excite.py │ │ │ ├── test_stable_diffusion_depth.py │ │ │ ├── test_stable_diffusion_diffedit.py │ │ │ ├── test_stable_diffusion_flax.py │ │ │ ├── test_stable_diffusion_flax_inpaint.py │ │ │ ├── test_stable_diffusion_inpaint.py │ │ │ ├── test_stable_diffusion_latent_upscale.py │ │ │ ├── test_stable_diffusion_upscale.py │ │ │ └── test_stable_diffusion_v_pred.py │ │ ├── stable_diffusion_3 │ │ │ ├── __init__.py │ │ │ ├── test_pipeline_stable_diffusion_3.py │ │ │ ├── test_pipeline_stable_diffusion_3_img2img.py │ │ │ └── test_pipeline_stable_diffusion_3_inpaint.py │ │ ├── stable_diffusion_adapter │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_adapter.py │ │ ├── stable_diffusion_gligen │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_gligen.py │ │ ├── stable_diffusion_gligen_text_image │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_gligen_text_image.py │ │ ├── stable_diffusion_image_variation │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_image_variation.py │ │ ├── stable_diffusion_k_diffusion │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_k_diffusion.py │ │ ├── stable_diffusion_ldm3d │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_ldm3d.py │ │ ├── stable_diffusion_panorama │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_panorama.py │ │ ├── stable_diffusion_safe │ │ │ ├── __init__.py │ │ │ └── test_safe_diffusion.py │ │ ├── stable_diffusion_sag │ │ │ ├── __init__.py │ │ │ └── test_stable_diffusion_sag.py │ │ ├── stable_diffusion_xl │ │ │ ├── __init__.py │ │ │ ├── test_stable_diffusion_xl.py │ │ │ ├── test_stable_diffusion_xl_adapter.py │ │ │ ├── test_stable_diffusion_xl_img2img.py │ │ │ ├── test_stable_diffusion_xl_inpaint.py │ │ │ ├── test_stable_diffusion_xl_instruction_pix2pix.py │ │ │ └── test_stable_diffusion_xl_k_diffusion.py │ │ ├── stable_unclip │ │ │ ├── __init__.py │ │ │ ├── test_stable_unclip.py │ │ │ └── test_stable_unclip_img2img.py │ │ ├── stable_video_diffusion │ │ │ ├── __init__.py │ │ │ └── test_stable_video_diffusion.py │ │ ├── test_pipeline_utils.py │ │ ├── test_pipelines.py │ │ ├── test_pipelines_auto.py │ │ ├── test_pipelines_combined.py │ │ ├── test_pipelines_common.py │ │ ├── test_pipelines_flax.py │ │ ├── test_pipelines_onnx_common.py │ │ ├── text_to_video_synthesis │ │ │ ├── __init__.py │ │ │ ├── test_text_to_video.py │ │ │ ├── test_text_to_video_zero.py │ │ │ ├── test_text_to_video_zero_sdxl.py │ │ │ └── test_video_to_video.py │ │ ├── unclip │ │ │ ├── __init__.py │ │ │ ├── test_unclip.py │ │ │ └── test_unclip_image_variation.py │ │ ├── unidiffuser │ │ │ ├── __init__.py │ │ │ └── test_unidiffuser.py │ │ └── wuerstchen │ │ │ ├── __init__.py │ │ │ ├── test_wuerstchen_combined.py │ │ │ ├── test_wuerstchen_decoder.py │ │ │ └── test_wuerstchen_prior.py │ ├── quantization │ │ ├── bnb │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── test_4bit.py │ │ │ └── test_mixed_int8.py │ │ ├── gguf │ │ │ └── test_gguf.py │ │ └── torchao │ │ │ ├── README.md │ │ │ └── test_torchao.py │ ├── schedulers │ │ ├── __init__.py │ │ ├── test_scheduler_consistency_model.py │ │ ├── test_scheduler_ddim.py │ │ ├── test_scheduler_ddim_inverse.py │ │ ├── test_scheduler_ddim_parallel.py │ │ ├── test_scheduler_ddpm.py │ │ ├── test_scheduler_ddpm_parallel.py │ │ ├── test_scheduler_deis.py │ │ ├── test_scheduler_dpm_multi.py │ │ ├── test_scheduler_dpm_multi_inverse.py │ │ ├── test_scheduler_dpm_sde.py │ │ ├── test_scheduler_dpm_single.py │ │ ├── test_scheduler_edm_dpmsolver_multistep.py │ │ ├── test_scheduler_edm_euler.py │ │ ├── test_scheduler_euler.py │ │ ├── test_scheduler_euler_ancestral.py │ │ ├── test_scheduler_flax.py │ │ ├── test_scheduler_heun.py │ │ ├── test_scheduler_ipndm.py │ │ ├── test_scheduler_kdpm2_ancestral.py │ │ ├── test_scheduler_kdpm2_discrete.py │ │ ├── test_scheduler_lcm.py │ │ ├── test_scheduler_lms.py │ │ ├── test_scheduler_pndm.py │ │ ├── test_scheduler_sasolver.py │ │ ├── test_scheduler_score_sde_ve.py │ │ ├── test_scheduler_tcd.py │ │ ├── test_scheduler_unclip.py │ │ ├── test_scheduler_unipc.py │ │ ├── test_scheduler_vq_diffusion.py │ │ └── test_schedulers.py │ └── single_file │ │ ├── __init__.py │ │ ├── single_file_testing_utils.py │ │ ├── test_model_autoencoder_dc_single_file.py │ │ ├── test_model_controlnet_single_file.py │ │ ├── test_model_motion_adapter_single_file.py │ │ ├── test_model_sd_cascade_unet_single_file.py │ │ ├── test_model_vae_single_file.py │ │ ├── test_stable_diffusion_controlnet_img2img_single_file.py │ │ ├── test_stable_diffusion_controlnet_inpaint_single_file.py │ │ ├── test_stable_diffusion_controlnet_single_file.py │ │ ├── test_stable_diffusion_img2img_single_file.py │ │ ├── test_stable_diffusion_inpaint_single_file.py │ │ ├── test_stable_diffusion_single_file.py │ │ ├── test_stable_diffusion_upscale_single_file.py │ │ ├── test_stable_diffusion_xl_adapter_single_file.py │ │ ├── test_stable_diffusion_xl_controlnet_single_file.py │ │ ├── test_stable_diffusion_xl_img2img_single_file.py │ │ ├── test_stable_diffusion_xl_instruct_pix2pix.py │ │ └── test_stable_diffusion_xl_single_file.py └── utils │ ├── check_config_docstrings.py │ ├── check_copies.py │ ├── check_doc_toc.py │ ├── check_dummies.py │ ├── check_inits.py │ ├── check_repo.py │ ├── check_table.py │ ├── custom_init_isort.py │ ├── fetch_latest_release_branch.py │ ├── fetch_torch_cuda_pipeline_test_matrix.py │ ├── get_modified_files.py │ ├── log_reports.py │ ├── notify_benchmarking_status.py │ ├── notify_community_pipelines_mirror.py │ ├── notify_slack_about_release.py │ ├── overwrite_expected_slice.py │ ├── print_env.py │ ├── release.py │ ├── stale.py │ ├── tests_fetcher.py │ └── update_metadata.py └── scripts ├── eval ├── 1665_Girl_with_a_Pearl_Earring.jpg ├── demo.py ├── forest.png └── orange_cat.png └── train ├── train.py ├── train_S2_edit.sh ├── train_S2_object.sh └── train_TI2I_alignment_deepspeed.sh /requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.31.0 2 | torchvision 3 | transformers>=4.41.2 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft==0.11.1 8 | sentencepiece 9 | qwen_vl_utils 10 | wandb 11 | datasets 12 | gradio 13 | matplotlib -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | cd ./src/diffusers 2 | pip install -e . 3 | 4 | cd ../.. 5 | pip install -r requirements.txt 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/configs/ti2i_jdb1M.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"type": "jsonl","path":"./datasets/jsonl_dataset/jdb_train_with_prompt.jsonl","task":"I2I","number":1000000,"image_column":"image","text_column":null}, 3 | {"type": "jsonl","path":"./datasets/jsonl_dataset/jdb_train_with_prompt.jsonl","task":"T2I","number":1000000,"image_column":"image","text_column":"prompt"} 4 | ] -------------------------------------------------------------------------------- /src/diffusers/CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | title: 'Diffusers: State-of-the-art diffusion models' 3 | message: >- 4 | If you use this software, please cite it using the 5 | metadata from this file. 6 | type: software 7 | authors: 8 | - given-names: Patrick 9 | family-names: von Platen 10 | - given-names: Suraj 11 | family-names: Patil 12 | - given-names: Anton 13 | family-names: Lozhkov 14 | - given-names: Pedro 15 | family-names: Cuenca 16 | - given-names: Nathan 17 | family-names: Lambert 18 | - given-names: Kashif 19 | family-names: Rasul 20 | - given-names: Mishig 21 | family-names: Davaadorj 22 | - given-names: Dhruv 23 | family-names: Nair 24 | - given-names: Sayak 25 | family-names: Paul 26 | - given-names: Steven 27 | family-names: Liu 28 | - given-names: William 29 | family-names: Berman 30 | - given-names: Yiyi 31 | family-names: Xu 32 | - given-names: Thomas 33 | family-names: Wolf 34 | repository-code: 'https://github.com/huggingface/diffusers' 35 | abstract: >- 36 | Diffusers provides pretrained diffusion models across 37 | multiple modalities, such as vision and audio, and serves 38 | as a modular toolbox for inference and training of 39 | diffusion models. 40 | keywords: 41 | - deep-learning 42 | - pytorch 43 | - image-generation 44 | - hacktoberfest 45 | - diffusion 46 | - text2image 47 | - image2image 48 | - score-based-generative-modeling 49 | - stable-diffusion 50 | - stable-diffusion-diffusers 51 | license: Apache-2.0 52 | version: 0.12.1 53 | -------------------------------------------------------------------------------- /src/diffusers/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include src/diffusers/utils/model_card_template.md 3 | -------------------------------------------------------------------------------- /src/diffusers/_typos.toml: -------------------------------------------------------------------------------- 1 | # Files for typos 2 | # Instruction: https://github.com/marketplace/actions/typos-action#getting-started 3 | 4 | [default.extend-identifiers] 5 | 6 | [default.extend-words] 7 | NIN="NIN" # NIN is used in scripts/convert_ncsnpp_original_checkpoint_to_diffusers.py 8 | nd="np" # nd may be np (numpy) 9 | parms="parms" # parms is used in scripts/convert_original_stable_diffusion_to_diffusers.py 10 | 11 | 12 | [files] 13 | extend-exclude = ["_typos.toml"] 14 | -------------------------------------------------------------------------------- /src/diffusers/benchmarks/benchmark_controlnet.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | 4 | 5 | sys.path.append(".") 6 | from base_classes import ControlNetBenchmark, ControlNetSDXLBenchmark # noqa: E402 7 | 8 | 9 | if __name__ == "__main__": 10 | parser = argparse.ArgumentParser() 11 | parser.add_argument( 12 | "--ckpt", 13 | type=str, 14 | default="lllyasviel/sd-controlnet-canny", 15 | choices=["lllyasviel/sd-controlnet-canny", "diffusers/controlnet-canny-sdxl-1.0"], 16 | ) 17 | parser.add_argument("--batch_size", type=int, default=1) 18 | parser.add_argument("--num_inference_steps", type=int, default=50) 19 | parser.add_argument("--model_cpu_offload", action="store_true") 20 | parser.add_argument("--run_compile", action="store_true") 21 | args = parser.parse_args() 22 | 23 | benchmark_pipe = ( 24 | ControlNetBenchmark(args) if args.ckpt == "lllyasviel/sd-controlnet-canny" else ControlNetSDXLBenchmark(args) 25 | ) 26 | benchmark_pipe.benchmark(args) 27 | -------------------------------------------------------------------------------- /src/diffusers/benchmarks/benchmark_ip_adapters.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | 4 | 5 | sys.path.append(".") 6 | from base_classes import IPAdapterTextToImageBenchmark # noqa: E402 7 | 8 | 9 | IP_ADAPTER_CKPTS = { 10 | # because original SD v1.5 has been taken down. 11 | "Lykon/DreamShaper": ("h94/IP-Adapter", "ip-adapter_sd15.bin"), 12 | "stabilityai/stable-diffusion-xl-base-1.0": ("h94/IP-Adapter", "ip-adapter_sdxl.bin"), 13 | } 14 | 15 | 16 | if __name__ == "__main__": 17 | parser = argparse.ArgumentParser() 18 | parser.add_argument( 19 | "--ckpt", 20 | type=str, 21 | default="rstabilityai/stable-diffusion-xl-base-1.0", 22 | choices=list(IP_ADAPTER_CKPTS.keys()), 23 | ) 24 | parser.add_argument("--batch_size", type=int, default=1) 25 | parser.add_argument("--num_inference_steps", type=int, default=50) 26 | parser.add_argument("--model_cpu_offload", action="store_true") 27 | parser.add_argument("--run_compile", action="store_true") 28 | args = parser.parse_args() 29 | 30 | args.ip_adapter_id = IP_ADAPTER_CKPTS[args.ckpt] 31 | benchmark_pipe = IPAdapterTextToImageBenchmark(args) 32 | args.ckpt = f"{args.ckpt} (IP-Adapter)" 33 | benchmark_pipe.benchmark(args) 34 | -------------------------------------------------------------------------------- /src/diffusers/benchmarks/benchmark_sd_img.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | 4 | 5 | sys.path.append(".") 6 | from base_classes import ImageToImageBenchmark, TurboImageToImageBenchmark # noqa: E402 7 | 8 | 9 | if __name__ == "__main__": 10 | parser = argparse.ArgumentParser() 11 | parser.add_argument( 12 | "--ckpt", 13 | type=str, 14 | default="Lykon/DreamShaper", 15 | choices=[ 16 | "Lykon/DreamShaper", 17 | "stabilityai/stable-diffusion-2-1", 18 | "stabilityai/stable-diffusion-xl-refiner-1.0", 19 | "stabilityai/sdxl-turbo", 20 | ], 21 | ) 22 | parser.add_argument("--batch_size", type=int, default=1) 23 | parser.add_argument("--num_inference_steps", type=int, default=50) 24 | parser.add_argument("--model_cpu_offload", action="store_true") 25 | parser.add_argument("--run_compile", action="store_true") 26 | args = parser.parse_args() 27 | 28 | benchmark_pipe = ImageToImageBenchmark(args) if "turbo" not in args.ckpt else TurboImageToImageBenchmark(args) 29 | benchmark_pipe.benchmark(args) 30 | -------------------------------------------------------------------------------- /src/diffusers/benchmarks/benchmark_sd_inpainting.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | 4 | 5 | sys.path.append(".") 6 | from base_classes import InpaintingBenchmark # noqa: E402 7 | 8 | 9 | if __name__ == "__main__": 10 | parser = argparse.ArgumentParser() 11 | parser.add_argument( 12 | "--ckpt", 13 | type=str, 14 | default="Lykon/DreamShaper", 15 | choices=[ 16 | "Lykon/DreamShaper", 17 | "stabilityai/stable-diffusion-2-1", 18 | "stabilityai/stable-diffusion-xl-base-1.0", 19 | ], 20 | ) 21 | parser.add_argument("--batch_size", type=int, default=1) 22 | parser.add_argument("--num_inference_steps", type=int, default=50) 23 | parser.add_argument("--model_cpu_offload", action="store_true") 24 | parser.add_argument("--run_compile", action="store_true") 25 | args = parser.parse_args() 26 | 27 | benchmark_pipe = InpaintingBenchmark(args) 28 | benchmark_pipe.benchmark(args) 29 | -------------------------------------------------------------------------------- /src/diffusers/benchmarks/benchmark_t2i_adapter.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | 4 | 5 | sys.path.append(".") 6 | from base_classes import T2IAdapterBenchmark, T2IAdapterSDXLBenchmark # noqa: E402 7 | 8 | 9 | if __name__ == "__main__": 10 | parser = argparse.ArgumentParser() 11 | parser.add_argument( 12 | "--ckpt", 13 | type=str, 14 | default="TencentARC/t2iadapter_canny_sd14v1", 15 | choices=["TencentARC/t2iadapter_canny_sd14v1", "TencentARC/t2i-adapter-canny-sdxl-1.0"], 16 | ) 17 | parser.add_argument("--batch_size", type=int, default=1) 18 | parser.add_argument("--num_inference_steps", type=int, default=50) 19 | parser.add_argument("--model_cpu_offload", action="store_true") 20 | parser.add_argument("--run_compile", action="store_true") 21 | args = parser.parse_args() 22 | 23 | benchmark_pipe = ( 24 | T2IAdapterBenchmark(args) 25 | if args.ckpt == "TencentARC/t2iadapter_canny_sd14v1" 26 | else T2IAdapterSDXLBenchmark(args) 27 | ) 28 | benchmark_pipe.benchmark(args) 29 | -------------------------------------------------------------------------------- /src/diffusers/benchmarks/benchmark_t2i_lcm_lora.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | 4 | 5 | sys.path.append(".") 6 | from base_classes import LCMLoRATextToImageBenchmark # noqa: E402 7 | 8 | 9 | if __name__ == "__main__": 10 | parser = argparse.ArgumentParser() 11 | parser.add_argument( 12 | "--ckpt", 13 | type=str, 14 | default="stabilityai/stable-diffusion-xl-base-1.0", 15 | ) 16 | parser.add_argument("--batch_size", type=int, default=1) 17 | parser.add_argument("--num_inference_steps", type=int, default=4) 18 | parser.add_argument("--model_cpu_offload", action="store_true") 19 | parser.add_argument("--run_compile", action="store_true") 20 | args = parser.parse_args() 21 | 22 | benchmark_pipe = LCMLoRATextToImageBenchmark(args) 23 | benchmark_pipe.benchmark(args) 24 | -------------------------------------------------------------------------------- /src/diffusers/benchmarks/benchmark_text_to_image.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | 4 | 5 | sys.path.append(".") 6 | from base_classes import TextToImageBenchmark, TurboTextToImageBenchmark # noqa: E402 7 | 8 | 9 | ALL_T2I_CKPTS = [ 10 | "Lykon/DreamShaper", 11 | "segmind/SSD-1B", 12 | "stabilityai/stable-diffusion-xl-base-1.0", 13 | "kandinsky-community/kandinsky-2-2-decoder", 14 | "warp-ai/wuerstchen", 15 | "stabilityai/sdxl-turbo", 16 | ] 17 | 18 | 19 | if __name__ == "__main__": 20 | parser = argparse.ArgumentParser() 21 | parser.add_argument( 22 | "--ckpt", 23 | type=str, 24 | default="Lykon/DreamShaper", 25 | choices=ALL_T2I_CKPTS, 26 | ) 27 | parser.add_argument("--batch_size", type=int, default=1) 28 | parser.add_argument("--num_inference_steps", type=int, default=50) 29 | parser.add_argument("--model_cpu_offload", action="store_true") 30 | parser.add_argument("--run_compile", action="store_true") 31 | args = parser.parse_args() 32 | 33 | benchmark_cls = None 34 | if "turbo" in args.ckpt: 35 | benchmark_cls = TurboTextToImageBenchmark 36 | else: 37 | benchmark_cls = TextToImageBenchmark 38 | 39 | benchmark_pipe = benchmark_cls(args) 40 | benchmark_pipe.benchmark(args) 41 | -------------------------------------------------------------------------------- /src/diffusers/docker/diffusers-pytorch-compile-cuda/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nvidia/cuda:12.1.0-runtime-ubuntu20.04 2 | LABEL maintainer="Hugging Face" 3 | LABEL repository="diffusers" 4 | 5 | ENV DEBIAN_FRONTEND=noninteractive 6 | 7 | RUN apt-get -y update \ 8 | && apt-get install -y software-properties-common \ 9 | && add-apt-repository ppa:deadsnakes/ppa 10 | 11 | RUN apt install -y bash \ 12 | build-essential \ 13 | git \ 14 | git-lfs \ 15 | curl \ 16 | ca-certificates \ 17 | libsndfile1-dev \ 18 | libgl1 \ 19 | python3.10 \ 20 | python3.10-dev \ 21 | python3-pip \ 22 | python3.10-venv && \ 23 | rm -rf /var/lib/apt/lists 24 | 25 | # make sure to use venv 26 | RUN python3.10 -m venv /opt/venv 27 | ENV PATH="/opt/venv/bin:$PATH" 28 | 29 | # pre-install the heavy dependencies (these can later be overridden by the deps from setup.py) 30 | RUN python3.10 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \ 31 | python3.10 -m uv pip install --no-cache-dir \ 32 | torch \ 33 | torchvision \ 34 | torchaudio \ 35 | invisible_watermark && \ 36 | python3.10 -m pip install --no-cache-dir \ 37 | accelerate \ 38 | datasets \ 39 | hf-doc-builder \ 40 | huggingface-hub \ 41 | hf_transfer \ 42 | Jinja2 \ 43 | librosa \ 44 | numpy==1.26.4 \ 45 | scipy \ 46 | tensorboard \ 47 | transformers \ 48 | hf_transfer 49 | 50 | CMD ["/bin/bash"] 51 | -------------------------------------------------------------------------------- /src/diffusers/docker/diffusers-pytorch-cuda/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nvidia/cuda:12.1.0-runtime-ubuntu20.04 2 | LABEL maintainer="Hugging Face" 3 | LABEL repository="diffusers" 4 | 5 | ENV DEBIAN_FRONTEND=noninteractive 6 | 7 | RUN apt-get -y update \ 8 | && apt-get install -y software-properties-common \ 9 | && add-apt-repository ppa:deadsnakes/ppa 10 | 11 | RUN apt install -y bash \ 12 | build-essential \ 13 | git \ 14 | git-lfs \ 15 | curl \ 16 | ca-certificates \ 17 | libsndfile1-dev \ 18 | libgl1 \ 19 | python3.10 \ 20 | python3.10-dev \ 21 | python3-pip \ 22 | python3.10-venv && \ 23 | rm -rf /var/lib/apt/lists 24 | 25 | # make sure to use venv 26 | RUN python3.10 -m venv /opt/venv 27 | ENV PATH="/opt/venv/bin:$PATH" 28 | 29 | # pre-install the heavy dependencies (these can later be overridden by the deps from setup.py) 30 | RUN python3.10 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \ 31 | python3.10 -m uv pip install --no-cache-dir \ 32 | torch \ 33 | torchvision \ 34 | torchaudio \ 35 | invisible_watermark && \ 36 | python3.10 -m pip install --no-cache-dir \ 37 | accelerate \ 38 | datasets \ 39 | hf-doc-builder \ 40 | huggingface-hub \ 41 | hf_transfer \ 42 | Jinja2 \ 43 | librosa \ 44 | numpy==1.26.4 \ 45 | scipy \ 46 | tensorboard \ 47 | transformers \ 48 | pytorch-lightning \ 49 | hf_transfer 50 | 51 | CMD ["/bin/bash"] 52 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/_config.py: -------------------------------------------------------------------------------- 1 | # docstyle-ignore 2 | INSTALL_CONTENT = """ 3 | # Diffusers installation 4 | ! pip install diffusers transformers datasets accelerate 5 | # To install from source instead of the last release, comment the command above and uncomment the following one. 6 | # ! pip install git+https://github.com/huggingface/diffusers.git 7 | """ 8 | 9 | notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}] 10 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/activations.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Activation functions 14 | 15 | Customized activation functions for supporting various models in 🤗 Diffusers. 16 | 17 | ## GELU 18 | 19 | [[autodoc]] models.activations.GELU 20 | 21 | ## GEGLU 22 | 23 | [[autodoc]] models.activations.GEGLU 24 | 25 | ## ApproximateGELU 26 | 27 | [[autodoc]] models.activations.ApproximateGELU 28 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/configuration.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Configuration 14 | 15 | Schedulers from [`~schedulers.scheduling_utils.SchedulerMixin`] and models from [`ModelMixin`] inherit from [`ConfigMixin`] which stores all the parameters that are passed to their respective `__init__` methods in a JSON-configuration file. 16 | 17 | 18 | 19 | To use private or [gated](https://huggingface.co/docs/hub/models-gated#gated-models) models, log-in with `huggingface-cli login`. 20 | 21 | 22 | 23 | ## ConfigMixin 24 | 25 | [[autodoc]] ConfigMixin 26 | - load_config 27 | - from_config 28 | - save_config 29 | - to_json_file 30 | - to_json_string 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/internal_classes_overview.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Overview 14 | 15 | The APIs in this section are more experimental and prone to breaking changes. Most of them are used internally for development, but they may also be useful to you if you're interested in building a diffusion model with some custom parts or if you're interested in some of our helper utilities for working with 🤗 Diffusers. 16 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/loaders/ip_adapter.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # IP-Adapter 14 | 15 | [IP-Adapter](https://hf.co/papers/2308.06721) is a lightweight adapter that enables prompting a diffusion model with an image. This method decouples the cross-attention layers of the image and text features. The image features are generated from an image encoder. 16 | 17 | 18 | 19 | Learn how to load an IP-Adapter checkpoint and image in the IP-Adapter [loading](../../using-diffusers/loading_adapters#ip-adapter) guide, and you can see how to use it in the [usage](../../using-diffusers/ip_adapter) guide. 20 | 21 | 22 | 23 | ## IPAdapterMixin 24 | 25 | [[autodoc]] loaders.ip_adapter.IPAdapterMixin 26 | 27 | ## SD3IPAdapterMixin 28 | 29 | [[autodoc]] loaders.ip_adapter.SD3IPAdapterMixin 30 | - all 31 | - is_ip_adapter_active 32 | 33 | ## IPAdapterMaskProcessor 34 | 35 | [[autodoc]] image_processor.IPAdapterMaskProcessor -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/loaders/peft.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # PEFT 14 | 15 | Diffusers supports loading adapters such as [LoRA](../../using-diffusers/loading_adapters) with the [PEFT](https://huggingface.co/docs/peft/index) library with the [`~loaders.peft.PeftAdapterMixin`] class. This allows modeling classes in Diffusers like [`UNet2DConditionModel`], [`SD3Transformer2DModel`] to operate with an adapter. 16 | 17 | 18 | 19 | Refer to the [Inference with PEFT](../../tutorials/using_peft_for_inference.md) tutorial for an overview of how to use PEFT in Diffusers for inference. 20 | 21 | 22 | 23 | ## PeftAdapterMixin 24 | 25 | [[autodoc]] loaders.peft.PeftAdapterMixin 26 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/loaders/textual_inversion.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Textual Inversion 14 | 15 | Textual Inversion is a training method for personalizing models by learning new text embeddings from a few example images. The file produced from training is extremely small (a few KBs) and the new embeddings can be loaded into the text encoder. 16 | 17 | [`TextualInversionLoaderMixin`] provides a function for loading Textual Inversion embeddings from Diffusers and Automatic1111 into the text encoder and loading a special token to activate the embeddings. 18 | 19 | 20 | 21 | To learn more about how to load Textual Inversion embeddings, see the [Textual Inversion](../../using-diffusers/loading_adapters#textual-inversion) loading guide. 22 | 23 | 24 | 25 | ## TextualInversionLoaderMixin 26 | 27 | [[autodoc]] loaders.textual_inversion.TextualInversionLoaderMixin -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/loaders/transformer_sd3.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # SD3Transformer2D 14 | 15 | This class is useful when *only* loading weights into a [`SD3Transformer2DModel`]. If you need to load weights into the text encoder or a text encoder and SD3Transformer2DModel, check [`SD3LoraLoaderMixin`](lora#diffusers.loaders.SD3LoraLoaderMixin) class instead. 16 | 17 | The [`SD3Transformer2DLoadersMixin`] class currently only loads IP-Adapter weights, but will be used in the future to save weights and load LoRAs. 18 | 19 | 20 | 21 | To learn more about how to load LoRA weights, see the [LoRA](../../using-diffusers/loading_adapters#lora) loading guide. 22 | 23 | 24 | 25 | ## SD3Transformer2DLoadersMixin 26 | 27 | [[autodoc]] loaders.transformer_sd3.SD3Transformer2DLoadersMixin 28 | - all 29 | - _load_ip_adapter_weights -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/allegro_transformer3d.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # AllegroTransformer3DModel 13 | 14 | A Diffusion Transformer model for 3D data from [Allegro](https://github.com/rhymes-ai/Allegro) was introduced in [Allegro: Open the Black Box of Commercial-Level Video Generation Model](https://huggingface.co/papers/2410.15458) by RhymesAI. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import AllegroTransformer3DModel 20 | 21 | vae = AllegroTransformer3DModel.from_pretrained("rhymes-ai/Allegro", subfolder="transformer", torch_dtype=torch.bfloat16).to("cuda") 22 | ``` 23 | 24 | ## AllegroTransformer3DModel 25 | 26 | [[autodoc]] AllegroTransformer3DModel 27 | 28 | ## Transformer2DModelOutput 29 | 30 | [[autodoc]] models.modeling_outputs.Transformer2DModelOutput 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/aura_flow_transformer2d.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # AuraFlowTransformer2DModel 14 | 15 | A Transformer model for image-like data from [AuraFlow](https://blog.fal.ai/auraflow/). 16 | 17 | ## AuraFlowTransformer2DModel 18 | 19 | [[autodoc]] AuraFlowTransformer2DModel 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/autoencoder_kl_hunyuan_video.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # AutoencoderKLHunyuanVideo 13 | 14 | The 3D variational autoencoder (VAE) model with KL loss used in [HunyuanVideo](https://github.com/Tencent/HunyuanVideo/), which was introduced in [HunyuanVideo: A Systematic Framework For Large Video Generative Models](https://huggingface.co/papers/2412.03603) by Tencent. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import AutoencoderKLHunyuanVideo 20 | 21 | vae = AutoencoderKLHunyuanVideo.from_pretrained("hunyuanvideo-community/HunyuanVideo", subfolder="vae", torch_dtype=torch.float16) 22 | ``` 23 | 24 | ## AutoencoderKLHunyuanVideo 25 | 26 | [[autodoc]] AutoencoderKLHunyuanVideo 27 | - decode 28 | - all 29 | 30 | ## DecoderOutput 31 | 32 | [[autodoc]] models.autoencoders.vae.DecoderOutput 33 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/autoencoderkl_ltx_video.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # AutoencoderKLLTXVideo 13 | 14 | The 3D variational autoencoder (VAE) model with KL loss used in [LTX](https://huggingface.co/Lightricks/LTX-Video) was introduced by Lightricks. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import AutoencoderKLLTXVideo 20 | 21 | vae = AutoencoderKLLTXVideo.from_pretrained("Lightricks/LTX-Video", subfolder="vae", torch_dtype=torch.float32).to("cuda") 22 | ``` 23 | 24 | ## AutoencoderKLLTXVideo 25 | 26 | [[autodoc]] AutoencoderKLLTXVideo 27 | - decode 28 | - encode 29 | - all 30 | 31 | ## AutoencoderKLOutput 32 | 33 | [[autodoc]] models.autoencoders.autoencoder_kl.AutoencoderKLOutput 34 | 35 | ## DecoderOutput 36 | 37 | [[autodoc]] models.autoencoders.vae.DecoderOutput 38 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/autoencoderkl_mochi.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # AutoencoderKLMochi 13 | 14 | The 3D variational autoencoder (VAE) model with KL loss used in [Mochi](https://github.com/genmoai/models) was introduced in [Mochi 1 Preview](https://huggingface.co/genmo/mochi-1-preview) by Tsinghua University & ZhipuAI. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import AutoencoderKLMochi 20 | 21 | vae = AutoencoderKLMochi.from_pretrained("genmo/mochi-1-preview", subfolder="vae", torch_dtype=torch.float32).to("cuda") 22 | ``` 23 | 24 | ## AutoencoderKLMochi 25 | 26 | [[autodoc]] AutoencoderKLMochi 27 | - decode 28 | - all 29 | 30 | ## DecoderOutput 31 | 32 | [[autodoc]] models.autoencoders.vae.DecoderOutput 33 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/cogvideox_transformer3d.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # CogVideoXTransformer3DModel 13 | 14 | A Diffusion Transformer model for 3D data from [CogVideoX](https://github.com/THUDM/CogVideo) was introduced in [CogVideoX: Text-to-Video Diffusion Models with An Expert Transformer](https://github.com/THUDM/CogVideo/blob/main/resources/CogVideoX.pdf) by Tsinghua University & ZhipuAI. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import CogVideoXTransformer3DModel 20 | 21 | vae = CogVideoXTransformer3DModel.from_pretrained("THUDM/CogVideoX-2b", subfolder="transformer", torch_dtype=torch.float16).to("cuda") 22 | ``` 23 | 24 | ## CogVideoXTransformer3DModel 25 | 26 | [[autodoc]] CogVideoXTransformer3DModel 27 | 28 | ## Transformer2DModelOutput 29 | 30 | [[autodoc]] models.modeling_outputs.Transformer2DModelOutput 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/cogview3plus_transformer2d.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # CogView3PlusTransformer2DModel 13 | 14 | A Diffusion Transformer model for 2D data from [CogView3Plus](https://github.com/THUDM/CogView3) was introduced in [CogView3: Finer and Faster Text-to-Image Generation via Relay Diffusion](https://huggingface.co/papers/2403.05121) by Tsinghua University & ZhipuAI. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import CogView3PlusTransformer2DModel 20 | 21 | vae = CogView3PlusTransformer2DModel.from_pretrained("THUDM/CogView3Plus-3b", subfolder="transformer", torch_dtype=torch.bfloat16).to("cuda") 22 | ``` 23 | 24 | ## CogView3PlusTransformer2DModel 25 | 26 | [[autodoc]] CogView3PlusTransformer2DModel 27 | 28 | ## Transformer2DModelOutput 29 | 30 | [[autodoc]] models.modeling_outputs.Transformer2DModelOutput 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/consistency_decoder_vae.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Consistency Decoder 14 | 15 | Consistency decoder can be used to decode the latents from the denoising UNet in the [`StableDiffusionPipeline`]. This decoder was introduced in the [DALL-E 3 technical report](https://openai.com/dall-e-3). 16 | 17 | The original codebase can be found at [openai/consistencydecoder](https://github.com/openai/consistencydecoder). 18 | 19 | 20 | 21 | Inference is only supported for 2 iterations as of now. 22 | 23 | 24 | 25 | The pipeline could not have been contributed without the help of [madebyollin](https://github.com/madebyollin) and [mrsteyk](https://github.com/mrsteyk) from [this issue](https://github.com/openai/consistencydecoder/issues/1). 26 | 27 | ## ConsistencyDecoderVAE 28 | [[autodoc]] ConsistencyDecoderVAE 29 | - all 30 | - decode 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/dit_transformer2d.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # DiTTransformer2DModel 14 | 15 | A Transformer model for image-like data from [DiT](https://huggingface.co/papers/2212.09748). 16 | 17 | ## DiTTransformer2DModel 18 | 19 | [[autodoc]] DiTTransformer2DModel 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/flux_transformer.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # FluxTransformer2DModel 14 | 15 | A Transformer model for image-like data from [Flux](https://blackforestlabs.ai/announcing-black-forest-labs/). 16 | 17 | ## FluxTransformer2DModel 18 | 19 | [[autodoc]] FluxTransformer2DModel 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/hunyuan_transformer2d.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # HunyuanDiT2DModel 14 | 15 | A Diffusion Transformer model for 2D data from [Hunyuan-DiT](https://github.com/Tencent/HunyuanDiT). 16 | 17 | ## HunyuanDiT2DModel 18 | 19 | [[autodoc]] HunyuanDiT2DModel 20 | 21 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/hunyuan_video_transformer_3d.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # HunyuanVideoTransformer3DModel 13 | 14 | A Diffusion Transformer model for 3D video-like data was introduced in [HunyuanVideo: A Systematic Framework For Large Video Generative Models](https://huggingface.co/papers/2412.03603) by Tencent. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import HunyuanVideoTransformer3DModel 20 | 21 | transformer = HunyuanVideoTransformer3DModel.from_pretrained("hunyuanvideo-community/HunyuanVideo", subfolder="transformer", torch_dtype=torch.bfloat16) 22 | ``` 23 | 24 | ## HunyuanVideoTransformer3DModel 25 | 26 | [[autodoc]] HunyuanVideoTransformer3DModel 27 | 28 | ## Transformer2DModelOutput 29 | 30 | [[autodoc]] models.modeling_outputs.Transformer2DModelOutput 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/latte_transformer3d.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | ## LatteTransformer3DModel 14 | 15 | A Diffusion Transformer model for 3D data from [Latte](https://github.com/Vchitect/Latte). 16 | 17 | ## LatteTransformer3DModel 18 | 19 | [[autodoc]] LatteTransformer3DModel 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/ltx_video_transformer3d.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # LTXVideoTransformer3DModel 13 | 14 | A Diffusion Transformer model for 3D data from [LTX](https://huggingface.co/Lightricks/LTX-Video) was introduced by Lightricks. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import LTXVideoTransformer3DModel 20 | 21 | transformer = LTXVideoTransformer3DModel.from_pretrained("Lightricks/LTX-Video", subfolder="transformer", torch_dtype=torch.bfloat16).to("cuda") 22 | ``` 23 | 24 | ## LTXVideoTransformer3DModel 25 | 26 | [[autodoc]] LTXVideoTransformer3DModel 27 | 28 | ## Transformer2DModelOutput 29 | 30 | [[autodoc]] models.modeling_outputs.Transformer2DModelOutput 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/lumina_nextdit2d.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # LuminaNextDiT2DModel 14 | 15 | A Next Version of Diffusion Transformer model for 2D data from [Lumina-T2X](https://github.com/Alpha-VLLM/Lumina-T2X). 16 | 17 | ## LuminaNextDiT2DModel 18 | 19 | [[autodoc]] LuminaNextDiT2DModel 20 | 21 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/mochi_transformer3d.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # MochiTransformer3DModel 13 | 14 | A Diffusion Transformer model for 3D video-like data was introduced in [Mochi-1 Preview](https://huggingface.co/genmo/mochi-1-preview) by Genmo. 15 | 16 | The model can be loaded with the following code snippet. 17 | 18 | ```python 19 | from diffusers import MochiTransformer3DModel 20 | 21 | vae = MochiTransformer3DModel.from_pretrained("genmo/mochi-1-preview", subfolder="transformer", torch_dtype=torch.float16).to("cuda") 22 | ``` 23 | 24 | ## MochiTransformer3DModel 25 | 26 | [[autodoc]] MochiTransformer3DModel 27 | 28 | ## Transformer2DModelOutput 29 | 30 | [[autodoc]] models.modeling_outputs.Transformer2DModelOutput 31 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/overview.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Models 14 | 15 | 🤗 Diffusers provides pretrained models for popular algorithms and modules to create custom diffusion systems. The primary function of models is to denoise an input sample as modeled by the distribution \\(p_{\theta}(x_{t-1}|x_{t})\\). 16 | 17 | All models are built from the base [`ModelMixin`] class which is a [`torch.nn.Module`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html) providing basic functionality for saving and loading models, locally and from the Hugging Face Hub. 18 | 19 | ## ModelMixin 20 | [[autodoc]] ModelMixin 21 | 22 | ## FlaxModelMixin 23 | 24 | [[autodoc]] FlaxModelMixin 25 | 26 | ## PushToHubMixin 27 | 28 | [[autodoc]] utils.PushToHubMixin 29 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/pixart_transformer2d.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # PixArtTransformer2DModel 14 | 15 | A Transformer model for image-like data from [PixArt-Alpha](https://huggingface.co/papers/2310.00426) and [PixArt-Sigma](https://huggingface.co/papers/2403.04692). 16 | 17 | ## PixArtTransformer2DModel 18 | 19 | [[autodoc]] PixArtTransformer2DModel 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/sd3_transformer2d.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # SD3 Transformer Model 14 | 15 | The Transformer model introduced in [Stable Diffusion 3](https://hf.co/papers/2403.03206). Its novelty lies in the MMDiT transformer block. 16 | 17 | ## SD3Transformer2DModel 18 | 19 | [[autodoc]] SD3Transformer2DModel -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/stable_audio_transformer.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # StableAudioDiTModel 14 | 15 | A Transformer model for audio waveforms from [Stable Audio Open](https://huggingface.co/papers/2407.14358). 16 | 17 | ## StableAudioDiTModel 18 | 19 | [[autodoc]] StableAudioDiTModel 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/stable_cascade_unet.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # StableCascadeUNet 14 | 15 | A UNet model from the [Stable Cascade pipeline](../pipelines/stable_cascade.md). 16 | 17 | ## StableCascadeUNet 18 | 19 | [[autodoc]] models.unets.unet_stable_cascade.StableCascadeUNet 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/models/transformer_temporal.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # TransformerTemporalModel 14 | 15 | A Transformer model for video-like data. 16 | 17 | ## TransformerTemporalModel 18 | 19 | [[autodoc]] models.transformers.transformer_temporal.TransformerTemporalModel 20 | 21 | ## TransformerTemporalModelOutput 22 | 23 | [[autodoc]] models.transformers.transformer_temporal.TransformerTemporalModelOutput 24 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/normalization.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Normalization layers 14 | 15 | Customized normalization layers for supporting various models in 🤗 Diffusers. 16 | 17 | ## AdaLayerNorm 18 | 19 | [[autodoc]] models.normalization.AdaLayerNorm 20 | 21 | ## AdaLayerNormZero 22 | 23 | [[autodoc]] models.normalization.AdaLayerNormZero 24 | 25 | ## AdaLayerNormSingle 26 | 27 | [[autodoc]] models.normalization.AdaLayerNormSingle 28 | 29 | ## AdaGroupNorm 30 | 31 | [[autodoc]] models.normalization.AdaGroupNorm 32 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/pipelines/aura_flow.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # AuraFlow 14 | 15 | AuraFlow is inspired by [Stable Diffusion 3](../pipelines/stable_diffusion/stable_diffusion_3.md) and is by far the largest text-to-image generation model that comes with an Apache 2.0 license. This model achieves state-of-the-art results on the [GenEval](https://github.com/djghosh13/geneval) benchmark. 16 | 17 | It was developed by the Fal team and more details about it can be found in [this blog post](https://blog.fal.ai/auraflow/). 18 | 19 | 20 | 21 | AuraFlow can be quite expensive to run on consumer hardware devices. However, you can perform a suite of optimizations to run it faster and in a more memory-friendly manner. Check out [this section](https://huggingface.co/blog/sd3#memory-optimizations-for-sd3) for more details. 22 | 23 | 24 | 25 | ## AuraFlowPipeline 26 | 27 | [[autodoc]] AuraFlowPipeline 28 | - all 29 | - __call__ -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/pipelines/auto_pipeline.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # AutoPipeline 14 | 15 | The `AutoPipeline` is designed to make it easy to load a checkpoint for a task without needing to know the specific pipeline class. Based on the task, the `AutoPipeline` automatically retrieves the correct pipeline class from the checkpoint `model_index.json` file. 16 | 17 | > [!TIP] 18 | > Check out the [AutoPipeline](../../tutorials/autopipeline) tutorial to learn how to use this API! 19 | 20 | ## AutoPipelineForText2Image 21 | 22 | [[autodoc]] AutoPipelineForText2Image 23 | - all 24 | - from_pretrained 25 | - from_pipe 26 | 27 | ## AutoPipelineForImage2Image 28 | 29 | [[autodoc]] AutoPipelineForImage2Image 30 | - all 31 | - from_pretrained 32 | - from_pipe 33 | 34 | ## AutoPipelineForInpainting 35 | 36 | [[autodoc]] AutoPipelineForInpainting 37 | - all 38 | - from_pretrained 39 | - from_pipe 40 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/pipelines/dance_diffusion.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Dance Diffusion 14 | 15 | [Dance Diffusion](https://github.com/Harmonai-org/sample-generator) is by Zach Evans. 16 | 17 | Dance Diffusion is the first in a suite of generative audio tools for producers and musicians released by [Harmonai](https://github.com/Harmonai-org). 18 | 19 | 20 | 21 | 22 | Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers) to learn how to explore the tradeoff between scheduler speed and quality, and see the [reuse components across pipelines](../../using-diffusers/loading#reuse-components-across-pipelines) section to learn how to efficiently load the same components into multiple pipelines. 23 | 24 | 25 | 26 | ## DanceDiffusionPipeline 27 | [[autodoc]] DanceDiffusionPipeline 28 | - all 29 | - __call__ 30 | 31 | ## AudioPipelineOutput 32 | [[autodoc]] pipelines.AudioPipelineOutput 33 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/pipelines/stable_diffusion/k_diffusion.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # K-Diffusion 14 | 15 | [k-diffusion](https://github.com/crowsonkb/k-diffusion) is a popular library created by [Katherine Crowson](https://github.com/crowsonkb/). We provide `StableDiffusionKDiffusionPipeline` and `StableDiffusionXLKDiffusionPipeline` that allow you to run Stable DIffusion with samplers from k-diffusion. 16 | 17 | Note that most the samplers from k-diffusion are implemented in Diffusers and we recommend using existing schedulers. You can find a mapping between k-diffusion samplers and schedulers in Diffusers [here](https://huggingface.co/docs/diffusers/api/schedulers/overview) 18 | 19 | 20 | ## StableDiffusionKDiffusionPipeline 21 | 22 | [[autodoc]] StableDiffusionKDiffusionPipeline 23 | 24 | 25 | ## StableDiffusionXLKDiffusionPipeline 26 | 27 | [[autodoc]] StableDiffusionXLKDiffusionPipeline -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/consistency_decoder.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # ConsistencyDecoderScheduler 14 | 15 | This scheduler is a part of the [`ConsistencyDecoderPipeline`] and was introduced in [DALL-E 3](https://openai.com/dall-e-3). 16 | 17 | The original codebase can be found at [openai/consistency_models](https://github.com/openai/consistency_models). 18 | 19 | 20 | ## ConsistencyDecoderScheduler 21 | [[autodoc]] schedulers.scheduling_consistency_decoder.ConsistencyDecoderScheduler 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/cosine_dpm.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # CosineDPMSolverMultistepScheduler 14 | 15 | The [`CosineDPMSolverMultistepScheduler`] is a variant of [`DPMSolverMultistepScheduler`] with cosine schedule, proposed by Nichol and Dhariwal (2021). 16 | It is being used in the [Stable Audio Open](https://arxiv.org/abs/2407.14358) paper and the [Stability-AI/stable-audio-tool](https://github.com/Stability-AI/stable-audio-tool) codebase. 17 | 18 | This scheduler was contributed by [Yoach Lacombe](https://huggingface.co/ylacombe). 19 | 20 | ## CosineDPMSolverMultistepScheduler 21 | [[autodoc]] CosineDPMSolverMultistepScheduler 22 | 23 | ## SchedulerOutput 24 | [[autodoc]] schedulers.scheduling_utils.SchedulerOutput 25 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/ddim_inverse.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # DDIMInverseScheduler 14 | 15 | `DDIMInverseScheduler` is the inverted scheduler from [Denoising Diffusion Implicit Models](https://huggingface.co/papers/2010.02502) (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon. 16 | The implementation is mostly based on the DDIM inversion definition from [Null-text Inversion for Editing Real Images using Guided Diffusion Models](https://huggingface.co/papers/2211.09794). 17 | 18 | ## DDIMInverseScheduler 19 | [[autodoc]] DDIMInverseScheduler 20 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/dpm_discrete.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # KDPM2DiscreteScheduler 14 | 15 | The `KDPM2DiscreteScheduler` is inspired by the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper, and the scheduler is ported from and created by [Katherine Crowson](https://github.com/crowsonkb/). 16 | 17 | The original codebase can be found at [crowsonkb/k-diffusion](https://github.com/crowsonkb/k-diffusion). 18 | 19 | ## KDPM2DiscreteScheduler 20 | [[autodoc]] KDPM2DiscreteScheduler 21 | 22 | ## SchedulerOutput 23 | [[autodoc]] schedulers.scheduling_utils.SchedulerOutput 24 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/dpm_discrete_ancestral.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # KDPM2AncestralDiscreteScheduler 14 | 15 | The `KDPM2DiscreteScheduler` with ancestral sampling is inspired by the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper, and the scheduler is ported from and created by [Katherine Crowson](https://github.com/crowsonkb/). 16 | 17 | The original codebase can be found at [crowsonkb/k-diffusion](https://github.com/crowsonkb/k-diffusion). 18 | 19 | ## KDPM2AncestralDiscreteScheduler 20 | [[autodoc]] KDPM2AncestralDiscreteScheduler 21 | 22 | ## SchedulerOutput 23 | [[autodoc]] schedulers.scheduling_utils.SchedulerOutput 24 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/dpm_sde.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # DPMSolverSDEScheduler 14 | 15 | The `DPMSolverSDEScheduler` is inspired by the stochastic sampler from the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper, and the scheduler is ported from and created by [Katherine Crowson](https://github.com/crowsonkb/). 16 | 17 | ## DPMSolverSDEScheduler 18 | [[autodoc]] DPMSolverSDEScheduler 19 | 20 | ## SchedulerOutput 21 | [[autodoc]] schedulers.scheduling_utils.SchedulerOutput 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/edm_euler.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # EDMEulerScheduler 14 | 15 | The Karras formulation of the Euler scheduler (Algorithm 2) from the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper by Karras et al. This is a fast scheduler which can often generate good outputs in 20-30 steps. The scheduler is based on the original [k-diffusion](https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51) implementation by [Katherine Crowson](https://github.com/crowsonkb/). 16 | 17 | 18 | ## EDMEulerScheduler 19 | [[autodoc]] EDMEulerScheduler 20 | 21 | ## EDMEulerSchedulerOutput 22 | [[autodoc]] schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput 23 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/euler.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # EulerDiscreteScheduler 14 | 15 | The Euler scheduler (Algorithm 2) is from the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper by Karras et al. This is a fast scheduler which can often generate good outputs in 20-30 steps. The scheduler is based on the original [k-diffusion](https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51) implementation by [Katherine Crowson](https://github.com/crowsonkb/). 16 | 17 | 18 | ## EulerDiscreteScheduler 19 | [[autodoc]] EulerDiscreteScheduler 20 | 21 | ## EulerDiscreteSchedulerOutput 22 | [[autodoc]] schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput 23 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/euler_ancestral.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # EulerAncestralDiscreteScheduler 14 | 15 | A scheduler that uses ancestral sampling with Euler method steps. This is a fast scheduler which can often generate good outputs in 20-30 steps. The scheduler is based on the original [k-diffusion](https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L72) implementation by [Katherine Crowson](https://github.com/crowsonkb/). 16 | 17 | ## EulerAncestralDiscreteScheduler 18 | [[autodoc]] EulerAncestralDiscreteScheduler 19 | 20 | ## EulerAncestralDiscreteSchedulerOutput 21 | [[autodoc]] schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/flow_match_euler_discrete.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # FlowMatchEulerDiscreteScheduler 14 | 15 | `FlowMatchEulerDiscreteScheduler` is based on the flow-matching sampling introduced in [Stable Diffusion 3](https://arxiv.org/abs/2403.03206). 16 | 17 | ## FlowMatchEulerDiscreteScheduler 18 | [[autodoc]] FlowMatchEulerDiscreteScheduler 19 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/flow_match_heun_discrete.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # FlowMatchHeunDiscreteScheduler 14 | 15 | `FlowMatchHeunDiscreteScheduler` is based on the flow-matching sampling introduced in [EDM](https://arxiv.org/abs/2403.03206). 16 | 17 | ## FlowMatchHeunDiscreteScheduler 18 | [[autodoc]] FlowMatchHeunDiscreteScheduler 19 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/heun.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # HeunDiscreteScheduler 14 | 15 | The Heun scheduler (Algorithm 1) is from the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper by Karras et al. The scheduler is ported from the [k-diffusion](https://github.com/crowsonkb/k-diffusion) library and created by [Katherine Crowson](https://github.com/crowsonkb/). 16 | 17 | ## HeunDiscreteScheduler 18 | [[autodoc]] HeunDiscreteScheduler 19 | 20 | ## SchedulerOutput 21 | [[autodoc]] schedulers.scheduling_utils.SchedulerOutput 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/ipndm.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # IPNDMScheduler 14 | 15 | `IPNDMScheduler` is a fourth-order Improved Pseudo Linear Multistep scheduler. The original implementation can be found at [crowsonkb/v-diffusion-pytorch](https://github.com/crowsonkb/v-diffusion-pytorch/blob/987f8985e38208345c1959b0ea767a625831cc9b/diffusion/sampling.py#L296). 16 | 17 | ## IPNDMScheduler 18 | [[autodoc]] IPNDMScheduler 19 | 20 | ## SchedulerOutput 21 | [[autodoc]] schedulers.scheduling_utils.SchedulerOutput 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/lcm.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Latent Consistency Model Multistep Scheduler 14 | 15 | ## Overview 16 | 17 | Multistep and onestep scheduler (Algorithm 3) introduced alongside latent consistency models in the paper [Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference](https://arxiv.org/abs/2310.04378) by Simian Luo, Yiqin Tan, Longbo Huang, Jian Li, and Hang Zhao. 18 | This scheduler should be able to generate good samples from [`LatentConsistencyModelPipeline`] in 1-8 steps. 19 | 20 | ## LCMScheduler 21 | [[autodoc]] LCMScheduler 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/lms_discrete.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # LMSDiscreteScheduler 14 | 15 | `LMSDiscreteScheduler` is a linear multistep scheduler for discrete beta schedules. The scheduler is ported from and created by [Katherine Crowson](https://github.com/crowsonkb/), and the original implementation can be found at [crowsonkb/k-diffusion](https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181). 16 | 17 | ## LMSDiscreteScheduler 18 | [[autodoc]] LMSDiscreteScheduler 19 | 20 | ## LMSDiscreteSchedulerOutput 21 | [[autodoc]] schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/pndm.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # PNDMScheduler 14 | 15 | `PNDMScheduler`, or pseudo numerical methods for diffusion models, uses more advanced ODE integration techniques like the Runge-Kutta and linear multi-step method. The original implementation can be found at [crowsonkb/k-diffusion](https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181). 16 | 17 | ## PNDMScheduler 18 | [[autodoc]] PNDMScheduler 19 | 20 | ## SchedulerOutput 21 | [[autodoc]] schedulers.scheduling_utils.SchedulerOutput 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/schedulers/stochastic_karras_ve.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # KarrasVeScheduler 14 | 15 | `KarrasVeScheduler` is a stochastic sampler tailored to variance-expanding (VE) models. It is based on the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) and [Score-based generative modeling through stochastic differential equations](https://huggingface.co/papers/2011.13456) papers. 16 | 17 | ## KarrasVeScheduler 18 | [[autodoc]] KarrasVeScheduler 19 | 20 | ## KarrasVeOutput 21 | [[autodoc]] schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/utilities.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Utilities 14 | 15 | Utility and helper functions for working with 🤗 Diffusers. 16 | 17 | ## numpy_to_pil 18 | 19 | [[autodoc]] utils.numpy_to_pil 20 | 21 | ## pt_to_pil 22 | 23 | [[autodoc]] utils.pt_to_pil 24 | 25 | ## load_image 26 | 27 | [[autodoc]] utils.load_image 28 | 29 | ## export_to_gif 30 | 31 | [[autodoc]] utils.export_to_gif 32 | 33 | ## export_to_video 34 | 35 | [[autodoc]] utils.export_to_video 36 | 37 | ## make_image_grid 38 | 39 | [[autodoc]] utils.make_image_grid 40 | 41 | ## randn_tensor 42 | 43 | [[autodoc]] utils.torch_utils.randn_tensor 44 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/api/video_processor.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Video Processor 14 | 15 | The [`VideoProcessor`] provides a unified API for video pipelines to prepare inputs for VAE encoding and post-processing outputs once they're decoded. The class inherits [`VaeImageProcessor`] so it includes transformations such as resizing, normalization, and conversion between PIL Image, PyTorch, and NumPy arrays. 16 | 17 | ## VideoProcessor 18 | 19 | [[autodoc]] video_processor.VideoProcessor.preprocess_video 20 | 21 | [[autodoc]] video_processor.VideoProcessor.postprocess_video 22 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/imgs/access_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/docs/source/en/imgs/access_request.png -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/imgs/diffusers_library.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/docs/source/en/imgs/diffusers_library.jpg -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/training/ddpo.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Reinforcement learning training with DDPO 14 | 15 | You can fine-tune Stable Diffusion on a reward function via reinforcement learning with the 🤗 TRL library and 🤗 Diffusers. This is done with the Denoising Diffusion Policy Optimization (DDPO) algorithm introduced by Black et al. in [Training Diffusion Models with Reinforcement Learning](https://arxiv.org/abs/2305.13301), which is implemented in 🤗 TRL with the [`~trl.DDPOTrainer`]. 16 | 17 | For more information, check out the [`~trl.DDPOTrainer`] API reference and the [Finetune Stable Diffusion Models with DDPO via TRL](https://huggingface.co/blog/trl-ddpo) blog post. -------------------------------------------------------------------------------- /src/diffusers/docs/source/en/using-diffusers/overview_techniques.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Overview 14 | 15 | The inference pipeline supports and enables a wide range of techniques that are divided into two categories: 16 | 17 | * Pipeline functionality: these techniques modify the pipeline or extend it for other applications. For example, pipeline callbacks add new features to a pipeline and a pipeline can also be extended for distributed inference. 18 | * Improve inference quality: these techniques increase the visual quality of the generated images. For example, you can enhance your prompts with GPT2 to create better images with lower effort. 19 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/ja/_toctree.yml: -------------------------------------------------------------------------------- 1 | - sections: 2 | - local: index 3 | title: 🧨 Diffusers 4 | - local: quicktour 5 | title: クイックツアー 6 | - local: stable_diffusion 7 | title: 有効で効率の良い拡散モデル 8 | - local: installation 9 | title: インストール 10 | title: はじめに 11 | - sections: 12 | - local: tutorials/tutorial_overview 13 | title: 概要 14 | - local: tutorials/autopipeline 15 | title: AutoPipeline 16 | title: チュートリアル -------------------------------------------------------------------------------- /src/diffusers/docs/source/ja/tutorials/tutorial_overview.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Overview 14 | 15 | ようこそ 🧨Diffusersへ!拡散モデル(diffusion models)や生成AIの初心者で、さらに学びたいのであれば、このチュートリアルが最適です。この初心者向けのチュートリアルは、拡散モデルについて丁寧に解説し、ライブラリの基礎(核となるコンポーネントと 🧨Diffusersの使用方法)を理解することを目的としています。 16 | 17 | まず、推論のためのパイプラインを使って、素早く生成する方法を学んでいきます。次に、独自の拡散システムを構築するためのモジュラーツールボックスとしてライブラリをどのように使えば良いかを理解するために、そのパイプラインを分解してみましょう。次のレッスンでは、あなたの欲しいものを生成できるように拡散モデルをトレーニングする方法を学びましょう。 18 | 19 | このチュートリアルがすべて完了したら、ライブラリを自分で調べ、自分のプロジェクトやアプリケーションにどのように使えるかを知るために必要なスキルを身につけることができます。 20 | 21 | そして、 [Discord](https://discord.com/invite/JfAtkvEtRb) や [forums](https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers/63) でDiffusersコミュニティに参加してユーザーや開発者と繋がって協力していきましょう。 22 | 23 | さあ、「拡散」をはじめていきましょう!🧨 -------------------------------------------------------------------------------- /src/diffusers/docs/source/ko/in_translation.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # 번역중 14 | 15 | 열심히 번역을 진행중입니다. 조금만 기다려주세요. 16 | 감사합니다! -------------------------------------------------------------------------------- /src/diffusers/docs/source/ko/tutorials/tutorial_overview.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # Overview 14 | 15 | 🧨 Diffusers에 오신 걸 환영합니다! 여러분이 diffusion 모델과 생성 AI를 처음 접하고, 더 많은 걸 배우고 싶으셨다면 제대로 찾아오셨습니다. 이 튜토리얼은 diffusion model을 여러분에게 젠틀하게 소개하고, 라이브러리의 기본 사항(핵심 구성요소와 🧨 Diffusers 사용법)을 이해하는 데 도움이 되도록 설계되었습니다. 16 | 17 | 여러분은 이 튜토리얼을 통해 빠르게 생성하기 위해선 추론 파이프라인을 어떻게 사용해야 하는지, 그리고 라이브러리를 modular toolbox처럼 이용해서 여러분만의 diffusion system을 구축할 수 있도록 파이프라인을 분해하는 법을 배울 수 있습니다. 다음 단원에서는 여러분이 원하는 것을 생성하기 위해 자신만의 diffusion model을 학습하는 방법을 배우게 됩니다. 18 | 19 | 튜토리얼을 완료한다면 여러분은 라이브러리를 직접 탐색하고, 자신의 프로젝트와 애플리케이션에 적용할 스킬들을 습득할 수 있을 겁니다. 20 | 21 | [Discord](https://discord.com/invite/JfAtkvEtRb)나 [포럼](https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers/63) 커뮤니티에 자유롭게 참여해서 다른 사용자와 개발자들과 교류하고 협업해 보세요! 22 | 23 | 자 지금부터 diffusing을 시작해 보겠습니다! 🧨 -------------------------------------------------------------------------------- /src/diffusers/docs/source/pt/_toctree.yml: -------------------------------------------------------------------------------- 1 | - sections: 2 | - local: index 3 | title: 🧨 Diffusers 4 | - local: quicktour 5 | title: Tour rápido 6 | - local: installation 7 | title: Instalação 8 | title: Primeiros passos 9 | -------------------------------------------------------------------------------- /src/diffusers/docs/source/zh/_toctree.yml: -------------------------------------------------------------------------------- 1 | - sections: 2 | - local: index 3 | title: 🧨 Diffusers 4 | - local: quicktour 5 | title: 快速入门 6 | - local: stable_diffusion 7 | title: 有效和高效的扩散 8 | - local: installation 9 | title: 安装 10 | title: 开始 11 | -------------------------------------------------------------------------------- /src/diffusers/examples/advanced_diffusion_training/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft==0.7.0 -------------------------------------------------------------------------------- /src/diffusers/examples/advanced_diffusion_training/requirements_flux.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.31.0 2 | torchvision 3 | transformers>=4.41.2 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft>=0.11.1 8 | sentencepiece -------------------------------------------------------------------------------- /src/diffusers/examples/cogvideo/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.31.0 2 | torchvision 3 | transformers>=4.41.2 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft>=0.11.1 8 | sentencepiece 9 | decord>=0.6.0 10 | imageio-ffmpeg -------------------------------------------------------------------------------- /src/diffusers/examples/community/one_step_unet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import torch 3 | 4 | from diffusers import DiffusionPipeline 5 | 6 | 7 | class UnetSchedulerOneForwardPipeline(DiffusionPipeline): 8 | def __init__(self, unet, scheduler): 9 | super().__init__() 10 | 11 | self.register_modules(unet=unet, scheduler=scheduler) 12 | 13 | def __call__(self): 14 | image = torch.randn( 15 | (1, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size), 16 | ) 17 | timestep = 1 18 | 19 | model_output = self.unet(image, timestep).sample 20 | scheduler_output = self.scheduler.step(model_output, timestep, image).prev_sample 21 | 22 | result = scheduler_output - scheduler_output + torch.ones_like(scheduler_output) 23 | 24 | return result 25 | -------------------------------------------------------------------------------- /src/diffusers/examples/consistency_distillation/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | webdataset -------------------------------------------------------------------------------- /src/diffusers/examples/controlnet/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | datasets 7 | -------------------------------------------------------------------------------- /src/diffusers/examples/controlnet/requirements_flax.txt: -------------------------------------------------------------------------------- 1 | transformers>=4.25.1 2 | datasets 3 | flax 4 | optax 5 | torch 6 | torchvision 7 | ftfy 8 | tensorboard 9 | Jinja2 10 | -------------------------------------------------------------------------------- /src/diffusers/examples/controlnet/requirements_flux.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | datasets 8 | wandb 9 | SentencePiece -------------------------------------------------------------------------------- /src/diffusers/examples/controlnet/requirements_sd3.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | datasets 8 | wandb 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/controlnet/requirements_sdxl.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | datasets 8 | wandb 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/custom_diffusion/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | -------------------------------------------------------------------------------- /src/diffusers/examples/dreambooth/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft==0.7.0 -------------------------------------------------------------------------------- /src/diffusers/examples/dreambooth/requirements_flax.txt: -------------------------------------------------------------------------------- 1 | transformers>=4.25.1 2 | flax 3 | optax 4 | torch 5 | torchvision 6 | ftfy 7 | tensorboard 8 | Jinja2 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/dreambooth/requirements_flux.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.31.0 2 | torchvision 3 | transformers>=4.41.2 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft>=0.11.1 8 | sentencepiece -------------------------------------------------------------------------------- /src/diffusers/examples/dreambooth/requirements_sana.txt: -------------------------------------------------------------------------------- 1 | accelerate>=1.0.0 2 | torchvision 3 | transformers>=4.47.0 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft>=0.14.0 8 | sentencepiece -------------------------------------------------------------------------------- /src/diffusers/examples/dreambooth/requirements_sd3.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.31.0 2 | torchvision 3 | transformers>=4.41.2 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft==0.11.1 8 | sentencepiece -------------------------------------------------------------------------------- /src/diffusers/examples/dreambooth/requirements_sdxl.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft==0.7.0 -------------------------------------------------------------------------------- /src/diffusers/examples/flux-control/requirements.txt: -------------------------------------------------------------------------------- 1 | transformers==4.47.0 2 | wandb 3 | torch 4 | torchvision 5 | accelerate==1.2.0 6 | peft>=0.14.0 7 | -------------------------------------------------------------------------------- /src/diffusers/examples/inference/README.md: -------------------------------------------------------------------------------- 1 | # Inference Examples 2 | 3 | **The inference examples folder is deprecated and will be removed in a future version**. 4 | **Officially supported inference examples can be found in the [Pipelines folder](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines)**. 5 | 6 | - For `Image-to-Image text-guided generation with Stable Diffusion`, please have a look at the official [Pipeline examples](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines#examples) 7 | - For `In-painting using Stable Diffusion`, please have a look at the official [Pipeline examples](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines#examples) 8 | - For `Tweak prompts reusing seeds and latents`, please have a look at the official [Pipeline examples](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines#examples) 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/inference/image_to_image.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | 3 | from diffusers import StableDiffusionImg2ImgPipeline # noqa F401 4 | 5 | 6 | warnings.warn( 7 | "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" 8 | " StableDiffusionImg2ImgPipeline` instead." 9 | ) 10 | -------------------------------------------------------------------------------- /src/diffusers/examples/inference/inpainting.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | 3 | from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 4 | 5 | 6 | warnings.warn( 7 | "The `inpainting.py` script is outdated. Please use directly `from diffusers import" 8 | " StableDiffusionInpaintPipeline` instead." 9 | ) 10 | -------------------------------------------------------------------------------- /src/diffusers/examples/instruct_pix2pix/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets 5 | ftfy 6 | tensorboard -------------------------------------------------------------------------------- /src/diffusers/examples/kandinsky2_2/text_to_image/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets 5 | ftfy 6 | tensorboard 7 | Jinja2 8 | -------------------------------------------------------------------------------- /src/diffusers/examples/model_search/requirements.txt: -------------------------------------------------------------------------------- 1 | huggingface-hub>=0.26.2 2 | -------------------------------------------------------------------------------- /src/diffusers/examples/reinforcement_learning/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Diffusion-based Policy Learning for RL 3 | 4 | `diffusion_policy` implements [Diffusion Policy](https://diffusion-policy.cs.columbia.edu/), a diffusion model that predicts robot action sequences in reinforcement learning tasks. 5 | 6 | This example implements a robot control model for pushing a T-shaped block into a target area. The model takes in current state observations as input, and outputs a trajectory of subsequent steps to follow. 7 | 8 | To execute the script, run `diffusion_policy.py` 9 | 10 | ## Diffuser Locomotion 11 | 12 | These examples show how to run [Diffuser](https://arxiv.org/abs/2205.09991) in Diffusers. 13 | There are two ways to use the script, `run_diffuser_locomotion.py`. 14 | 15 | The key option is a change of the variable `n_guide_steps`. 16 | When `n_guide_steps=0`, the trajectories are sampled from the diffusion model, but not fine-tuned to maximize reward in the environment. 17 | By default, `n_guide_steps=2` to match the original implementation. 18 | 19 | 20 | You will need some RL specific requirements to run the examples: 21 | 22 | ```sh 23 | pip install -f https://download.pytorch.org/whl/torch_stable.html \ 24 | free-mujoco-py \ 25 | einops \ 26 | gym==0.24.1 \ 27 | protobuf==3.20.1 \ 28 | git+https://github.com/rail-berkeley/d4rl.git \ 29 | mediapy \ 30 | Pillow==9.0.0 31 | ``` 32 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/README.md: -------------------------------------------------------------------------------- 1 | # Research projects 2 | 3 | This folder contains various research projects using 🧨 Diffusers. 4 | They are not really maintained by the core maintainers of this library and often require a specific version of Diffusers that is indicated in the requirements file of each folder. 5 | Updating them to the most recent version of the library will require some work. 6 | 7 | To use any of them, just run the command 8 | 9 | ```sh 10 | pip install -r requirements.txt 11 | ``` 12 | inside the folder of your choice. 13 | 14 | If you need help with any of those, please open an issue where you directly ping the author(s), as indicated at the top of the README of each folder. 15 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/colossalai/inference.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | from diffusers import StableDiffusionPipeline 4 | 5 | 6 | model_id = "path-to-your-trained-model" 7 | pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda") 8 | 9 | prompt = "A photo of sks dog in a bucket" 10 | image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0] 11 | 12 | image.save("dog-bucket.png") 13 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/colossalai/requirement.txt: -------------------------------------------------------------------------------- 1 | diffusers 2 | torch 3 | torchvision 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | transformers -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/consistency_training/README.md: -------------------------------------------------------------------------------- 1 | # Consistency Training 2 | 3 | `train_cm_ct_unconditional.py` trains a consistency model (CM) from scratch following the consistency training (CT) algorithm introduced in [Consistency Models](https://arxiv.org/abs/2303.01469) and refined in [Improved Techniques for Training Consistency Models](https://arxiv.org/abs/2310.14189). Both unconditional and class-conditional training are supported. 4 | 5 | A usage example is as follows: 6 | 7 | ```bash 8 | accelerate launch examples/research_projects/consistency_training/train_cm_ct_unconditional.py \ 9 | --dataset_name="cifar10" \ 10 | --dataset_image_column_name="img" \ 11 | --output_dir="/path/to/output/dir" \ 12 | --mixed_precision=fp16 \ 13 | --resolution=32 \ 14 | --max_train_steps=1000 --max_train_samples=10000 \ 15 | --dataloader_num_workers=8 \ 16 | --noise_precond_type="cm" --input_precond_type="cm" \ 17 | --train_batch_size=4 \ 18 | --learning_rate=1e-04 --lr_scheduler="constant" --lr_warmup_steps=0 \ 19 | --use_8bit_adam \ 20 | --use_ema \ 21 | --validation_steps=100 --eval_batch_size=4 \ 22 | --checkpointing_steps=100 --checkpoints_total_limit=10 \ 23 | --class_conditional --num_classes=10 \ 24 | ``` -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/consistency_training/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/diffusion_dpo/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | peft 8 | wandb -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/diffusion_orpo/README.md: -------------------------------------------------------------------------------- 1 | This project has a new home now: [https://mapo-t2i.github.io/](https://mapo-t2i.github.io/). We formally studied the use of ORPO in the context of diffusion models and open-sourced our codebase, models, and datasets. We released our paper too! 2 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/diffusion_orpo/requirements.txt: -------------------------------------------------------------------------------- 1 | datasets 2 | accelerate 3 | transformers 4 | torchvision 5 | wandb 6 | peft 7 | webdataset -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/dreambooth_inpaint/requirements.txt: -------------------------------------------------------------------------------- 1 | diffusers==0.9.0 2 | accelerate>=0.16.0 3 | torchvision 4 | transformers>=4.21.0 5 | ftfy 6 | tensorboard 7 | Jinja2 8 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/flux_lora_quantization/accelerate.yaml: -------------------------------------------------------------------------------- 1 | compute_environment: LOCAL_MACHINE 2 | debug: false 3 | distributed_type: NO 4 | downcast_bf16: 'no' 5 | enable_cpu_affinity: true 6 | gpu_ids: all 7 | machine_rank: 0 8 | main_training_function: main 9 | mixed_precision: bf16 10 | num_machines: 1 11 | num_processes: 1 12 | rdzv_backend: static 13 | same_network: true 14 | tpu_env: [] 15 | tpu_use_cluster: false 16 | tpu_use_sudo: false 17 | use_cpu: false 18 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/flux_lora_quantization/ds2.yaml: -------------------------------------------------------------------------------- 1 | compute_environment: LOCAL_MACHINE 2 | debug: false 3 | deepspeed_config: 4 | gradient_accumulation_steps: 1 5 | gradient_clipping: 1.0 6 | offload_optimizer_device: cpu 7 | offload_param_device: cpu 8 | zero3_init_flag: false 9 | zero_stage: 2 10 | distributed_type: DEEPSPEED 11 | downcast_bf16: 'no' 12 | enable_cpu_affinity: false 13 | machine_rank: 0 14 | main_training_function: main 15 | mixed_precision: 'no' 16 | num_machines: 1 17 | num_processes: 1 18 | rdzv_backend: static 19 | same_network: true 20 | tpu_env: [] 21 | tpu_use_cluster: false 22 | tpu_use_sudo: false 23 | use_cpu: false -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/geodiff/README.md: -------------------------------------------------------------------------------- 1 | # GeoDiff 2 | 3 | > [!TIP] 4 | > This notebook is not actively maintained by the Diffusers team. For any questions or comments, please contact [natolambert](https://twitter.com/natolambert). 5 | 6 | This is an experimental research notebook demonstrating how to generate stable 3D structures of molecules with [GeoDiff](https://github.com/MinkaiXu/GeoDiff) and Diffusers. 7 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/gligen/generated-images-100000-00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/examples/research_projects/gligen/generated-images-100000-00.png -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/gligen/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | diffusers 8 | scipy 9 | timm 10 | fairscale 11 | wandb -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/intel_opts/textual_inversion/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.21.0 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | intel_extension_for_pytorch>=1.13 8 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/intel_opts/textual_inversion_dfq/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate 2 | torchvision 3 | transformers>=4.25.0 4 | ftfy 5 | tensorboard 6 | modelcards 7 | neural-compressor -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/ip_adapter/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate 2 | torchvision 3 | transformers>=4.25.1 4 | ip_adapter 5 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/lora/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets 5 | ftfy 6 | tensorboard 7 | Jinja2 8 | git+https://github.com/huggingface/peft.git -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/multi_subject_dreambooth/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/multi_subject_dreambooth_inpainting/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets>=2.16.0 5 | wandb>=0.16.1 6 | ftfy 7 | tensorboard 8 | Jinja2 -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/multi_token_textual_inversion/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/multi_token_textual_inversion/requirements_flax.txt: -------------------------------------------------------------------------------- 1 | transformers>=4.25.1 2 | flax 3 | optax 4 | torch 5 | torchvision 6 | ftfy 7 | tensorboard 8 | Jinja2 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/onnxruntime/README.md: -------------------------------------------------------------------------------- 1 | ## Diffusers examples with ONNXRuntime optimizations 2 | 3 | **This research project is not actively maintained by the diffusers team. For any questions or comments, please contact Prathik Rao (prathikr), Sunghoon Choi (hanbitmyths), Ashwini Khade (askhade), or Peng Wang (pengwa) on github with any questions.** 4 | 5 | This aims to provide diffusers examples with ONNXRuntime optimizations for training/fine-tuning unconditional image generation, text to image, and textual inversion. Please see individual directories for more details on how to run each task using ONNXRuntime. 6 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/onnxruntime/text_to_image/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets 5 | ftfy 6 | tensorboard 7 | modelcards 8 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/onnxruntime/textual_inversion/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | modelcards 7 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/onnxruntime/unconditional_image_generation/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | datasets 4 | tensorboard -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/pixart/.gitignore: -------------------------------------------------------------------------------- 1 | images/ 2 | output/ -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/pixart/requirements.txt: -------------------------------------------------------------------------------- 1 | transformers 2 | SentencePiece 3 | torchvision 4 | controlnet-aux 5 | datasets 6 | # wandb -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/pixart/train_controlnet_hf_diffusers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # run 4 | # accelerate config 5 | 6 | # check with 7 | # accelerate env 8 | 9 | export MODEL_DIR="PixArt-alpha/PixArt-XL-2-512x512" 10 | export OUTPUT_DIR="output/pixart-controlnet-hf-diffusers-test" 11 | 12 | accelerate launch ./train_pixart_controlnet_hf.py --mixed_precision="fp16" \ 13 | --pretrained_model_name_or_path=$MODEL_DIR \ 14 | --output_dir=$OUTPUT_DIR \ 15 | --dataset_name=fusing/fill50k \ 16 | --resolution=512 \ 17 | --learning_rate=1e-5 \ 18 | --train_batch_size=1 \ 19 | --gradient_accumulation_steps=4 \ 20 | --report_to="wandb" \ 21 | --seed=42 \ 22 | --dataloader_num_workers=8 23 | # --lr_scheduler="cosine" --lr_warmup_steps=0 \ 24 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/pytorch_xla/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets>=2.19.1 5 | ftfy 6 | tensorboard 7 | Jinja2 8 | peft==0.7.0 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/rdm/README.md: -------------------------------------------------------------------------------- 1 | ## Diffusers examples with ONNXRuntime optimizations 2 | 3 | **This research project is not actively maintained by the diffusers team. For any questions or comments, please contact Isamu Isozaki(isamu-isozaki) on github with any questions.** 4 | 5 | The aim of this project is to provide retrieval augmented diffusion models to diffusers! -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/realfill/requirements.txt: -------------------------------------------------------------------------------- 1 | diffusers==0.20.1 2 | accelerate==0.23.0 3 | transformers==4.38.0 4 | peft==0.5.0 5 | torch==2.2.0 6 | torchvision>=0.16 7 | ftfy==6.1.1 8 | tensorboard==2.14.0 9 | Jinja2==3.1.4 10 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/scheduled_huber_loss_training/README.md: -------------------------------------------------------------------------------- 1 | # Scheduled Pseudo-Huber Loss for Diffusers 2 | 3 | These are the modifications of to include the possibility of training text2image models with Scheduled Pseudo Huber loss, introduced in https://arxiv.org/abs/2403.16728. (https://github.com/kabachuha/SPHL-for-stable-diffusion) 4 | 5 | ## Why this might be useful? 6 | 7 | - If you suspect that the part of the training dataset might be corrupted, and you don't want these outliers to distort the model's supposed output 8 | 9 | - If you want to improve the aesthetic quality of pictures by helping the model disentangle concepts and be less influenced by another sorts of pictures. 10 | 11 | See https://github.com/huggingface/diffusers/issues/7488 for the detailed description. 12 | 13 | ## Instructions 14 | 15 | The same usage as in the case of the corresponding vanilla Diffusers scripts https://github.com/huggingface/diffusers/tree/main/examples 16 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/vae/README.md: -------------------------------------------------------------------------------- 1 | # VAE 2 | 3 | `vae_roundtrip.py` Demonstrates the use of a VAE by roundtripping an image through the encoder and decoder. Original and reconstructed images are displayed side by side. 4 | 5 | ``` 6 | cd examples/research_projects/vae 7 | python vae_roundtrip.py \ 8 | --pretrained_model_name_or_path="stable-diffusion-v1-5/stable-diffusion-v1-5" \ 9 | --subfolder="vae" \ 10 | --input_image="/path/to/your/input.png" 11 | ``` 12 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/wuerstchen/text_to_image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/examples/research_projects/wuerstchen/text_to_image/__init__.py -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/wuerstchen/text_to_image/modeling_efficient_net_encoder.py: -------------------------------------------------------------------------------- 1 | import torch.nn as nn 2 | from torchvision.models import efficientnet_v2_l, efficientnet_v2_s 3 | 4 | from diffusers.configuration_utils import ConfigMixin, register_to_config 5 | from diffusers.models.modeling_utils import ModelMixin 6 | 7 | 8 | class EfficientNetEncoder(ModelMixin, ConfigMixin): 9 | @register_to_config 10 | def __init__(self, c_latent=16, c_cond=1280, effnet="efficientnet_v2_s"): 11 | super().__init__() 12 | 13 | if effnet == "efficientnet_v2_s": 14 | self.backbone = efficientnet_v2_s(weights="DEFAULT").features 15 | else: 16 | self.backbone = efficientnet_v2_l(weights="DEFAULT").features 17 | self.mapper = nn.Sequential( 18 | nn.Conv2d(c_cond, c_latent, kernel_size=1, bias=False), 19 | nn.BatchNorm2d(c_latent), # then normalize them to have mean 0 and std 1 20 | ) 21 | 22 | def forward(self, x): 23 | return self.mapper(self.backbone(x)) 24 | -------------------------------------------------------------------------------- /src/diffusers/examples/research_projects/wuerstchen/text_to_image/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | wandb 5 | bitsandbytes 6 | deepspeed 7 | peft>=0.6.0 8 | -------------------------------------------------------------------------------- /src/diffusers/examples/server/requirements.in: -------------------------------------------------------------------------------- 1 | torch~=2.4.0 2 | transformers==4.46.1 3 | sentencepiece 4 | aiohttp 5 | py-consul 6 | prometheus_client >= 0.18.0 7 | prometheus-fastapi-instrumentator >= 7.0.0 8 | fastapi 9 | uvicorn -------------------------------------------------------------------------------- /src/diffusers/examples/t2i_adapter/README.md: -------------------------------------------------------------------------------- 1 | We don't yet support training T2I-Adapters on Stable Diffusion yet. For training T2I-Adapters on Stable Diffusion XL, refer [here](./README_sdxl.md). -------------------------------------------------------------------------------- /src/diffusers/examples/t2i_adapter/requirements.txt: -------------------------------------------------------------------------------- 1 | transformers>=4.25.1 2 | accelerate>=0.16.0 3 | safetensors 4 | datasets 5 | torchvision 6 | ftfy 7 | tensorboard 8 | wandb -------------------------------------------------------------------------------- /src/diffusers/examples/text_to_image/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets>=2.19.1 5 | ftfy 6 | tensorboard 7 | Jinja2 8 | peft==0.7.0 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/text_to_image/requirements_flax.txt: -------------------------------------------------------------------------------- 1 | transformers>=4.25.1 2 | datasets 3 | flax 4 | optax 5 | torch 6 | torchvision 7 | ftfy 8 | tensorboard 9 | Jinja2 10 | -------------------------------------------------------------------------------- /src/diffusers/examples/text_to_image/requirements_sdxl.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.22.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | datasets 8 | peft==0.7.0 -------------------------------------------------------------------------------- /src/diffusers/examples/textual_inversion/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | -------------------------------------------------------------------------------- /src/diffusers/examples/textual_inversion/requirements_flax.txt: -------------------------------------------------------------------------------- 1 | transformers>=4.25.1 2 | flax 3 | optax 4 | torch 5 | torchvision 6 | ftfy 7 | tensorboard 8 | Jinja2 9 | -------------------------------------------------------------------------------- /src/diffusers/examples/unconditional_image_generation/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | datasets 4 | -------------------------------------------------------------------------------- /src/diffusers/examples/vqgan/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets 5 | timm 6 | numpy 7 | tqdm 8 | tensorboard -------------------------------------------------------------------------------- /src/diffusers/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.ruff] 2 | line-length = 119 3 | 4 | [tool.ruff.lint] 5 | # Never enforce `E501` (line length violations). 6 | ignore = ["C901", "E501", "E741", "F402", "F823"] 7 | select = ["C", "E", "F", "I", "W"] 8 | 9 | # Ignore import violations in all `__init__.py` files. 10 | [tool.ruff.lint.per-file-ignores] 11 | "__init__.py" = ["E402", "F401", "F403", "F811"] 12 | "src/diffusers/utils/dummy_*.py" = ["F401"] 13 | 14 | [tool.ruff.lint.isort] 15 | lines-after-imports = 2 16 | known-first-party = ["diffusers"] 17 | 18 | [tool.ruff.format] 19 | # Like Black, use double quotes for strings. 20 | quote-style = "double" 21 | 22 | # Like Black, indent with spaces, rather than tabs. 23 | indent-style = "space" 24 | 25 | # Like Black, respect magic trailing commas. 26 | skip-magic-trailing-comma = false 27 | 28 | # Like Black, automatically detect the appropriate line ending. 29 | line-ending = "auto" 30 | -------------------------------------------------------------------------------- /src/diffusers/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/scripts/__init__.py -------------------------------------------------------------------------------- /src/diffusers/scripts/convert_unclip_txt2img_to_image_variation.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection 4 | 5 | from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline 6 | 7 | 8 | if __name__ == "__main__": 9 | parser = argparse.ArgumentParser() 10 | 11 | parser.add_argument("--dump_path", default=None, type=str, required=True, help="Path to the output model.") 12 | 13 | parser.add_argument( 14 | "--txt2img_unclip", 15 | default="kakaobrain/karlo-v1-alpha", 16 | type=str, 17 | required=False, 18 | help="The pretrained txt2img unclip.", 19 | ) 20 | 21 | args = parser.parse_args() 22 | 23 | txt2img = UnCLIPPipeline.from_pretrained(args.txt2img_unclip) 24 | 25 | feature_extractor = CLIPImageProcessor() 26 | image_encoder = CLIPVisionModelWithProjection.from_pretrained("openai/clip-vit-large-patch14") 27 | 28 | img2img = UnCLIPImageVariationPipeline( 29 | decoder=txt2img.decoder, 30 | text_encoder=txt2img.text_encoder, 31 | tokenizer=txt2img.tokenizer, 32 | text_proj=txt2img.text_proj, 33 | feature_extractor=feature_extractor, 34 | image_encoder=image_encoder, 35 | super_res_first=txt2img.super_res_first, 36 | super_res_last=txt2img.super_res_last, 37 | decoder_scheduler=txt2img.decoder_scheduler, 38 | super_res_scheduler=txt2img.super_res_scheduler, 39 | ) 40 | 41 | img2img.save_pretrained(args.dump_path) 42 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/commands/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 The HuggingFace Team. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from abc import ABC, abstractmethod 16 | from argparse import ArgumentParser 17 | 18 | 19 | class BaseDiffusersCLICommand(ABC): 20 | @staticmethod 21 | @abstractmethod 22 | def register_subcommand(parser: ArgumentParser): 23 | raise NotImplementedError() 24 | 25 | @abstractmethod 26 | def run(self): 27 | raise NotImplementedError() 28 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/commands/diffusers_cli.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright 2024 The HuggingFace Team. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | from argparse import ArgumentParser 17 | 18 | from .env import EnvironmentCommand 19 | from .fp16_safetensors import FP16SafetensorsCommand 20 | 21 | 22 | def main(): 23 | parser = ArgumentParser("Diffusers CLI tool", usage="diffusers-cli []") 24 | commands_parser = parser.add_subparsers(help="diffusers-cli command helpers") 25 | 26 | # Register commands 27 | EnvironmentCommand.register_subcommand(commands_parser) 28 | FP16SafetensorsCommand.register_subcommand(commands_parser) 29 | 30 | # Let's go 31 | args = parser.parse_args() 32 | 33 | if not hasattr(args, "func"): 34 | parser.print_help() 35 | exit(1) 36 | 37 | # Run 38 | service = args.func(args) 39 | service.run() 40 | 41 | 42 | if __name__ == "__main__": 43 | main() 44 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/dependency_versions_check.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 The HuggingFace Team. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .dependency_versions_table import deps 16 | from .utils.versions import require_version, require_version_core 17 | 18 | 19 | # define which module versions we always want to check at run time 20 | # (usually the ones defined in `install_requires` in setup.py) 21 | # 22 | # order specific notes: 23 | # - tqdm must be checked before tokenizers 24 | 25 | pkgs_to_check_at_runtime = "python requests filelock numpy".split() 26 | for pkg in pkgs_to_check_at_runtime: 27 | if pkg in deps: 28 | require_version_core(deps[pkg]) 29 | else: 30 | raise ValueError(f"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py") 31 | 32 | 33 | def dep_version_check(pkg, hint=None): 34 | require_version(deps[pkg], hint) 35 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/experimental/README.md: -------------------------------------------------------------------------------- 1 | # 🧨 Diffusers Experimental 2 | 3 | We are adding experimental code to support novel applications and usages of the Diffusers library. 4 | Currently, the following experiments are supported: 5 | * Reinforcement learning via an implementation of the [Diffuser](https://arxiv.org/abs/2205.09991) model. -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/experimental/__init__.py: -------------------------------------------------------------------------------- 1 | from .rl import ValueGuidedRLPipeline 2 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/experimental/rl/__init__.py: -------------------------------------------------------------------------------- 1 | from .value_guided_sampling import ValueGuidedRLPipeline 2 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/models/README.md: -------------------------------------------------------------------------------- 1 | # Models 2 | 3 | For more detail on the models, please refer to the [docs](https://huggingface.co/docs/diffusers/api/models/overview). -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/models/autoencoders/__init__.py: -------------------------------------------------------------------------------- 1 | from .autoencoder_asym_kl import AsymmetricAutoencoderKL 2 | from .autoencoder_dc import AutoencoderDC 3 | from .autoencoder_kl import AutoencoderKL 4 | from .autoencoder_kl_allegro import AutoencoderKLAllegro 5 | from .autoencoder_kl_cogvideox import AutoencoderKLCogVideoX 6 | from .autoencoder_kl_hunyuan_video import AutoencoderKLHunyuanVideo 7 | from .autoencoder_kl_ltx import AutoencoderKLLTXVideo 8 | from .autoencoder_kl_mochi import AutoencoderKLMochi 9 | from .autoencoder_kl_temporal_decoder import AutoencoderKLTemporalDecoder 10 | from .autoencoder_oobleck import AutoencoderOobleck 11 | from .autoencoder_tiny import AutoencoderTiny 12 | from .consistency_decoder_vae import ConsistencyDecoderVAE 13 | from .vq_model import VQModel 14 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/models/controlnets/__init__.py: -------------------------------------------------------------------------------- 1 | from ...utils import is_flax_available, is_torch_available 2 | 3 | 4 | if is_torch_available(): 5 | from .controlnet import ControlNetModel, ControlNetOutput 6 | from .controlnet_flux import FluxControlNetModel, FluxControlNetOutput, FluxMultiControlNetModel 7 | from .controlnet_hunyuan import ( 8 | HunyuanControlNetOutput, 9 | HunyuanDiT2DControlNetModel, 10 | HunyuanDiT2DMultiControlNetModel, 11 | ) 12 | from .controlnet_sd3 import SD3ControlNetModel, SD3ControlNetOutput, SD3MultiControlNetModel 13 | from .controlnet_sparsectrl import ( 14 | SparseControlNetConditioningEmbedding, 15 | SparseControlNetModel, 16 | SparseControlNetOutput, 17 | ) 18 | from .controlnet_union import ControlNetUnionModel 19 | from .controlnet_xs import ControlNetXSAdapter, ControlNetXSOutput, UNetControlNetXSModel 20 | from .multicontrolnet import MultiControlNetModel 21 | 22 | if is_flax_available(): 23 | from .controlnet_flax import FlaxControlNetModel 24 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/models/modeling_outputs.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from ..utils import BaseOutput 4 | 5 | 6 | @dataclass 7 | class AutoencoderKLOutput(BaseOutput): 8 | """ 9 | Output of AutoencoderKL encoding method. 10 | 11 | Args: 12 | latent_dist (`DiagonalGaussianDistribution`): 13 | Encoded outputs of `Encoder` represented as the mean and logvar of `DiagonalGaussianDistribution`. 14 | `DiagonalGaussianDistribution` allows for sampling latents from the distribution. 15 | """ 16 | 17 | latent_dist: "DiagonalGaussianDistribution" # noqa: F821 18 | 19 | 20 | @dataclass 21 | class Transformer2DModelOutput(BaseOutput): 22 | """ 23 | The output of [`Transformer2DModel`]. 24 | 25 | Args: 26 | sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` or `(batch size, num_vector_embeds - 1, num_latent_pixels)` if [`Transformer2DModel`] is discrete): 27 | The hidden states output conditioned on the `encoder_hidden_states` input. If discrete, returns probability 28 | distributions for the unnoised latent pixels. 29 | """ 30 | 31 | sample: "torch.Tensor" # noqa: F821 32 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/models/transformers/__init__.py: -------------------------------------------------------------------------------- 1 | from ...utils import is_torch_available 2 | 3 | 4 | if is_torch_available(): 5 | from .auraflow_transformer_2d import AuraFlowTransformer2DModel 6 | from .cogvideox_transformer_3d import CogVideoXTransformer3DModel 7 | from .dit_transformer_2d import DiTTransformer2DModel 8 | from .dual_transformer_2d import DualTransformer2DModel 9 | from .hunyuan_transformer_2d import HunyuanDiT2DModel 10 | from .latte_transformer_3d import LatteTransformer3DModel 11 | from .lumina_nextdit2d import LuminaNextDiT2DModel 12 | from .pixart_transformer_2d import PixArtTransformer2DModel 13 | from .prior_transformer import PriorTransformer 14 | from .sana_transformer import SanaTransformer2DModel 15 | from .stable_audio_transformer import StableAudioDiTModel 16 | from .t5_film_transformer import T5FilmDecoder 17 | from .transformer_2d import Transformer2DModel 18 | from .transformer_allegro import AllegroTransformer3DModel 19 | from .transformer_cogview3plus import CogView3PlusTransformer2DModel 20 | from .transformer_flux import FluxTransformer2DModel 21 | from .transformer_hunyuan_video import HunyuanVideoTransformer3DModel 22 | from .transformer_ltx import LTXVideoTransformer3DModel 23 | from .transformer_mochi import MochiTransformer3DModel 24 | from .transformer_sd3 import SD3Transformer2DModel 25 | from .transformer_temporal import TransformerTemporalModel 26 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/models/unets/__init__.py: -------------------------------------------------------------------------------- 1 | from ...utils import is_flax_available, is_torch_available 2 | 3 | 4 | if is_torch_available(): 5 | from .unet_1d import UNet1DModel 6 | from .unet_2d import UNet2DModel 7 | from .unet_2d_condition import UNet2DConditionModel 8 | from .unet_3d_condition import UNet3DConditionModel 9 | from .unet_i2vgen_xl import I2VGenXLUNet 10 | from .unet_kandinsky3 import Kandinsky3UNet 11 | from .unet_motion_model import MotionAdapter, UNetMotionModel 12 | from .unet_spatio_temporal_condition import UNetSpatioTemporalConditionModel 13 | from .unet_stable_cascade import StableCascadeUNet 14 | from .uvit_2d import UVit2DModel 15 | 16 | 17 | if is_flax_available(): 18 | from .unet_2d_condition_flax import FlaxUNet2DConditionModel 19 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/allegro/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | 17 | try: 18 | if not (is_transformers_available() and is_torch_available()): 19 | raise OptionalDependencyNotAvailable() 20 | except OptionalDependencyNotAvailable: 21 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 22 | 23 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 24 | else: 25 | _import_structure["pipeline_allegro"] = ["AllegroPipeline"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_torch_and_transformers_objects import * 34 | else: 35 | from .pipeline_allegro import AllegroPipeline 36 | 37 | else: 38 | import sys 39 | 40 | sys.modules[__name__] = _LazyModule( 41 | __name__, 42 | globals()["__file__"], 43 | _import_structure, 44 | module_spec=__spec__, 45 | ) 46 | 47 | for name, value in _dummy_objects.items(): 48 | setattr(sys.modules[__name__], name, value) 49 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/allegro/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL 6 | import torch 7 | 8 | from diffusers.utils import BaseOutput 9 | 10 | 11 | @dataclass 12 | class AllegroPipelineOutput(BaseOutput): 13 | r""" 14 | Output class for Allegro pipelines. 15 | 16 | Args: 17 | frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): 18 | List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing 19 | denoised PIL image sequences of length `num_frames.` It can also be a NumPy array or Torch tensor of shape 20 | `(batch_size, num_frames, channels, height, width)`. 21 | """ 22 | 23 | frames: Union[torch.Tensor, np.ndarray, List[List[PIL.Image.Image]]] 24 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/animatediff/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | import torch 7 | 8 | from ...utils import BaseOutput 9 | 10 | 11 | @dataclass 12 | class AnimateDiffPipelineOutput(BaseOutput): 13 | r""" 14 | Output class for AnimateDiff pipelines. 15 | 16 | Args: 17 | frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): 18 | List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing 19 | denoised 20 | PIL image sequences of length `num_frames.` It can also be a NumPy array or Torch tensor of shape 21 | `(batch_size, num_frames, channels, height, width)` 22 | """ 23 | 24 | frames: Union[torch.Tensor, np.ndarray, List[List[PIL.Image.Image]]] 25 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/aura_flow/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | 17 | try: 18 | if not (is_transformers_available() and is_torch_available()): 19 | raise OptionalDependencyNotAvailable() 20 | except OptionalDependencyNotAvailable: 21 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 22 | 23 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 24 | else: 25 | _import_structure["pipeline_aura_flow"] = ["AuraFlowPipeline"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_torch_and_transformers_objects import * 34 | else: 35 | from .pipeline_aura_flow import AuraFlowPipeline 36 | 37 | else: 38 | import sys 39 | 40 | sys.modules[__name__] = _LazyModule( 41 | __name__, 42 | globals()["__file__"], 43 | _import_structure, 44 | module_spec=__spec__, 45 | ) 46 | 47 | for name, value in _dummy_objects.items(): 48 | setattr(sys.modules[__name__], name, value) 49 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/blip_diffusion/__init__.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Optional, Union 3 | 4 | import numpy as np 5 | import PIL 6 | from PIL import Image 7 | 8 | from ...utils import OptionalDependencyNotAvailable, is_torch_available, is_transformers_available 9 | 10 | 11 | try: 12 | if not (is_transformers_available() and is_torch_available()): 13 | raise OptionalDependencyNotAvailable() 14 | except OptionalDependencyNotAvailable: 15 | from ...utils.dummy_torch_and_transformers_objects import ShapEPipeline 16 | else: 17 | from .blip_image_processing import BlipImageProcessor 18 | from .modeling_blip2 import Blip2QFormerModel 19 | from .modeling_ctx_clip import ContextCLIPTextModel 20 | from .pipeline_blip_diffusion import BlipDiffusionPipeline 21 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/cogvideo/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | import torch 4 | 5 | from diffusers.utils import BaseOutput 6 | 7 | 8 | @dataclass 9 | class CogVideoXPipelineOutput(BaseOutput): 10 | r""" 11 | Output class for CogVideo pipelines. 12 | 13 | Args: 14 | frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): 15 | List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing 16 | denoised PIL image sequences of length `num_frames.` It can also be a NumPy array or Torch tensor of shape 17 | `(batch_size, num_frames, channels, height, width)`. 18 | """ 19 | 20 | frames: torch.Tensor 21 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/cogview3/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ...utils import BaseOutput 8 | 9 | 10 | @dataclass 11 | class CogView3PipelineOutput(BaseOutput): 12 | """ 13 | Output class for CogView3 pipelines. 14 | 15 | Args: 16 | images (`List[PIL.Image.Image]` or `np.ndarray`) 17 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 18 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 19 | """ 20 | 21 | images: Union[List[PIL.Image.Image], np.ndarray] 22 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/consistency_models/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | _LazyModule, 6 | ) 7 | 8 | 9 | _import_structure = { 10 | "pipeline_consistency_models": ["ConsistencyModelPipeline"], 11 | } 12 | 13 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 14 | from .pipeline_consistency_models import ConsistencyModelPipeline 15 | 16 | else: 17 | import sys 18 | 19 | sys.modules[__name__] = _LazyModule( 20 | __name__, 21 | globals()["__file__"], 22 | _import_structure, 23 | module_spec=__spec__, 24 | ) 25 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/controlnet/multicontrolnet.py: -------------------------------------------------------------------------------- 1 | from ...models.controlnets.multicontrolnet import MultiControlNetModel 2 | from ...utils import deprecate, logging 3 | 4 | 5 | logger = logging.get_logger(__name__) 6 | 7 | 8 | class MultiControlNetModel(MultiControlNetModel): 9 | def __init__(self, *args, **kwargs): 10 | deprecation_message = "Importing `MultiControlNetModel` from `diffusers.pipelines.controlnet.multicontrolnet` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.multicontrolnet import MultiControlNetModel`, instead." 11 | deprecate("diffusers.pipelines.controlnet.multicontrolnet.MultiControlNetModel", "0.34", deprecation_message) 12 | super().__init__(*args, **kwargs) 13 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/dance_diffusion/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_dance_diffusion": ["DanceDiffusionPipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_dance_diffusion import DanceDiffusionPipeline 10 | else: 11 | import sys 12 | 13 | sys.modules[__name__] = _LazyModule( 14 | __name__, 15 | globals()["__file__"], 16 | _import_structure, 17 | module_spec=__spec__, 18 | ) 19 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/ddim/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_ddim": ["DDIMPipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_ddim import DDIMPipeline 10 | else: 11 | import sys 12 | 13 | sys.modules[__name__] = _LazyModule( 14 | __name__, 15 | globals()["__file__"], 16 | _import_structure, 17 | module_spec=__spec__, 18 | ) 19 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/ddpm/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | _LazyModule, 6 | ) 7 | 8 | 9 | _import_structure = {"pipeline_ddpm": ["DDPMPipeline"]} 10 | 11 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 12 | from .pipeline_ddpm import DDPMPipeline 13 | 14 | else: 15 | import sys 16 | 17 | sys.modules[__name__] = _LazyModule( 18 | __name__, 19 | globals()["__file__"], 20 | _import_structure, 21 | module_spec=__spec__, 22 | ) 23 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deepfloyd_if/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Optional, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ...utils import BaseOutput 8 | 9 | 10 | @dataclass 11 | class IFPipelineOutput(BaseOutput): 12 | r""" 13 | Output class for Stable Diffusion pipelines. 14 | 15 | Args: 16 | images (`List[PIL.Image.Image]` or `np.ndarray`): 17 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 18 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 19 | nsfw_detected (`List[bool]`): 20 | List of flags denoting whether the corresponding generated image likely represents "not-safe-for-work" 21 | (nsfw) content or a watermark. `None` if safety checking could not be performed. 22 | watermark_detected (`List[bool]`): 23 | List of flags denoting whether the corresponding generated image likely has a watermark. `None` if safety 24 | checking could not be performed. 25 | """ 26 | 27 | images: Union[List[PIL.Image.Image], np.ndarray] 28 | nsfw_detected: Optional[List[bool]] 29 | watermark_detected: Optional[List[bool]] 30 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/README.md: -------------------------------------------------------------------------------- 1 | # Deprecated Pipelines 2 | 3 | This folder contains pipelines that have very low usage as measured by model downloads, issues and PRs. While you can still use the pipelines just as before, we will stop testing the pipelines and will not accept any changes to existing files. -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Optional, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ....utils import ( 8 | BaseOutput, 9 | ) 10 | 11 | 12 | @dataclass 13 | # Copied from diffusers.pipelines.stable_diffusion.pipeline_output.StableDiffusionPipelineOutput with Stable->Alt 14 | class AltDiffusionPipelineOutput(BaseOutput): 15 | """ 16 | Output class for Alt Diffusion pipelines. 17 | 18 | Args: 19 | images (`List[PIL.Image.Image]` or `np.ndarray`) 20 | List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width, 21 | num_channels)`. 22 | nsfw_content_detected (`List[bool]`) 23 | List indicating whether the corresponding generated image contains "not-safe-for-work" (nsfw) content or 24 | `None` if safety checking could not be performed. 25 | """ 26 | 27 | images: Union[List[PIL.Image.Image], np.ndarray] 28 | nsfw_content_detected: Optional[List[bool]] 29 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/audio_diffusion/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = { 7 | "mel": ["Mel"], 8 | "pipeline_audio_diffusion": ["AudioDiffusionPipeline"], 9 | } 10 | 11 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 12 | from .mel import Mel 13 | from .pipeline_audio_diffusion import AudioDiffusionPipeline 14 | 15 | else: 16 | import sys 17 | 18 | sys.modules[__name__] = _LazyModule( 19 | __name__, 20 | globals()["__file__"], 21 | _import_structure, 22 | module_spec=__spec__, 23 | ) 24 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_latent_diffusion_uncond": ["LDMPipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_latent_diffusion_uncond import LDMPipeline 10 | else: 11 | import sys 12 | 13 | sys.modules[__name__] = _LazyModule( 14 | __name__, 15 | globals()["__file__"], 16 | _import_structure, 17 | module_spec=__spec__, 18 | ) 19 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/pndm/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_pndm": ["PNDMPipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_pndm import PNDMPipeline 10 | else: 11 | import sys 12 | 13 | sys.modules[__name__] = _LazyModule( 14 | __name__, 15 | globals()["__file__"], 16 | _import_structure, 17 | module_spec=__spec__, 18 | ) 19 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/repaint/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_repaint": ["RePaintPipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_repaint import RePaintPipeline 10 | 11 | else: 12 | import sys 13 | 14 | sys.modules[__name__] = _LazyModule( 15 | __name__, 16 | globals()["__file__"], 17 | _import_structure, 18 | module_spec=__spec__, 19 | ) 20 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/score_sde_ve/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_score_sde_ve": ["ScoreSdeVePipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_score_sde_ve import ScoreSdeVePipeline 10 | 11 | else: 12 | import sys 13 | 14 | sys.modules[__name__] = _LazyModule( 15 | __name__, 16 | globals()["__file__"], 17 | _import_structure, 18 | module_spec=__spec__, 19 | ) 20 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/deprecated/stochastic_karras_ve/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_stochastic_karras_ve": ["KarrasVePipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_stochastic_karras_ve import KarrasVePipeline 10 | 11 | else: 12 | import sys 13 | 14 | sys.modules[__name__] = _LazyModule( 15 | __name__, 16 | globals()["__file__"], 17 | _import_structure, 18 | module_spec=__spec__, 19 | ) 20 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/dit/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import DIFFUSERS_SLOW_IMPORT, _LazyModule 4 | 5 | 6 | _import_structure = {"pipeline_dit": ["DiTPipeline"]} 7 | 8 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 9 | from .pipeline_dit import DiTPipeline 10 | 11 | else: 12 | import sys 13 | 14 | sys.modules[__name__] = _LazyModule( 15 | __name__, 16 | globals()["__file__"], 17 | _import_structure, 18 | module_spec=__spec__, 19 | ) 20 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/flux/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | import torch 7 | 8 | from ...utils import BaseOutput 9 | 10 | 11 | @dataclass 12 | class FluxPipelineOutput(BaseOutput): 13 | """ 14 | Output class for Stable Diffusion pipelines. 15 | 16 | Args: 17 | images (`List[PIL.Image.Image]` or `np.ndarray`) 18 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 19 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 20 | """ 21 | 22 | images: Union[List[PIL.Image.Image], np.ndarray] 23 | 24 | 25 | @dataclass 26 | class FluxPriorReduxPipelineOutput(BaseOutput): 27 | """ 28 | Output class for Flux Prior Redux pipelines. 29 | 30 | Args: 31 | images (`List[PIL.Image.Image]` or `np.ndarray`) 32 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 33 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 34 | """ 35 | 36 | prompt_embeds: torch.Tensor 37 | pooled_prompt_embeds: torch.Tensor 38 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/hunyuan_video/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | import torch 4 | 5 | from diffusers.utils import BaseOutput 6 | 7 | 8 | @dataclass 9 | class HunyuanVideoPipelineOutput(BaseOutput): 10 | r""" 11 | Output class for HunyuanVideo pipelines. 12 | 13 | Args: 14 | frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): 15 | List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing 16 | denoised PIL image sequences of length `num_frames.` It can also be a NumPy array or Torch tensor of shape 17 | `(batch_size, num_frames, channels, height, width)`. 18 | """ 19 | 20 | frames: torch.Tensor 21 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/hunyuandit/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | 17 | try: 18 | if not (is_transformers_available() and is_torch_available()): 19 | raise OptionalDependencyNotAvailable() 20 | except OptionalDependencyNotAvailable: 21 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 22 | 23 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 24 | else: 25 | _import_structure["pipeline_hunyuandit"] = ["HunyuanDiTPipeline"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_torch_and_transformers_objects import * 34 | else: 35 | from .pipeline_hunyuandit import HunyuanDiTPipeline 36 | 37 | else: 38 | import sys 39 | 40 | sys.modules[__name__] = _LazyModule( 41 | __name__, 42 | globals()["__file__"], 43 | _import_structure, 44 | module_spec=__spec__, 45 | ) 46 | 47 | for name, value in _dummy_objects.items(): 48 | setattr(sys.modules[__name__], name, value) 49 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/i2vgen_xl/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | try: 17 | if not (is_transformers_available() and is_torch_available()): 18 | raise OptionalDependencyNotAvailable() 19 | except OptionalDependencyNotAvailable: 20 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 21 | 22 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 23 | else: 24 | _import_structure["pipeline_i2vgen_xl"] = ["I2VGenXLPipeline"] 25 | 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | except OptionalDependencyNotAvailable: 32 | from ...utils.dummy_torch_and_transformers_objects import * # noqa F403 33 | else: 34 | from .pipeline_i2vgen_xl import I2VGenXLPipeline 35 | 36 | else: 37 | import sys 38 | 39 | sys.modules[__name__] = _LazyModule( 40 | __name__, 41 | globals()["__file__"], 42 | _import_structure, 43 | module_spec=__spec__, 44 | ) 45 | for name, value in _dummy_objects.items(): 46 | setattr(sys.modules[__name__], name, value) 47 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/kandinsky/text_encoder.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel 3 | 4 | 5 | class MCLIPConfig(XLMRobertaConfig): 6 | model_type = "M-CLIP" 7 | 8 | def __init__(self, transformerDimSize=1024, imageDimSize=768, **kwargs): 9 | self.transformerDimensions = transformerDimSize 10 | self.numDims = imageDimSize 11 | super().__init__(**kwargs) 12 | 13 | 14 | class MultilingualCLIP(PreTrainedModel): 15 | config_class = MCLIPConfig 16 | 17 | def __init__(self, config, *args, **kwargs): 18 | super().__init__(config, *args, **kwargs) 19 | self.transformer = XLMRobertaModel(config) 20 | self.LinearTransformation = torch.nn.Linear( 21 | in_features=config.transformerDimensions, out_features=config.numDims 22 | ) 23 | 24 | def forward(self, input_ids, attention_mask): 25 | embs = self.transformer(input_ids=input_ids, attention_mask=attention_mask)[0] 26 | embs2 = (embs * attention_mask.unsqueeze(2)).sum(dim=1) / attention_mask.sum(dim=1)[:, None] 27 | return self.LinearTransformation(embs2), embs 28 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/kolors/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ...utils import BaseOutput 8 | 9 | 10 | @dataclass 11 | class KolorsPipelineOutput(BaseOutput): 12 | """ 13 | Output class for Kolors pipelines. 14 | 15 | Args: 16 | images (`List[PIL.Image.Image]` or `np.ndarray`) 17 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 18 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 19 | """ 20 | 21 | images: Union[List[PIL.Image.Image], np.ndarray] 22 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/latte/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | 17 | try: 18 | if not (is_transformers_available() and is_torch_available()): 19 | raise OptionalDependencyNotAvailable() 20 | except OptionalDependencyNotAvailable: 21 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 22 | 23 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 24 | else: 25 | _import_structure["pipeline_latte"] = ["LattePipeline"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_torch_and_transformers_objects import * 34 | else: 35 | from .pipeline_latte import LattePipeline 36 | 37 | else: 38 | import sys 39 | 40 | sys.modules[__name__] = _LazyModule( 41 | __name__, 42 | globals()["__file__"], 43 | _import_structure, 44 | module_spec=__spec__, 45 | ) 46 | 47 | for name, value in _dummy_objects.items(): 48 | setattr(sys.modules[__name__], name, value) 49 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/ltx/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | import torch 4 | 5 | from diffusers.utils import BaseOutput 6 | 7 | 8 | @dataclass 9 | class LTXPipelineOutput(BaseOutput): 10 | r""" 11 | Output class for LTX pipelines. 12 | 13 | Args: 14 | frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): 15 | List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing 16 | denoised PIL image sequences of length `num_frames.` It can also be a NumPy array or Torch tensor of shape 17 | `(batch_size, num_frames, channels, height, width)`. 18 | """ 19 | 20 | frames: torch.Tensor 21 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/lumina/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | 17 | try: 18 | if not (is_transformers_available() and is_torch_available()): 19 | raise OptionalDependencyNotAvailable() 20 | except OptionalDependencyNotAvailable: 21 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 22 | 23 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 24 | else: 25 | _import_structure["pipeline_lumina"] = ["LuminaText2ImgPipeline"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_torch_and_transformers_objects import * 34 | else: 35 | from .pipeline_lumina import LuminaText2ImgPipeline 36 | 37 | else: 38 | import sys 39 | 40 | sys.modules[__name__] = _LazyModule( 41 | __name__, 42 | globals()["__file__"], 43 | _import_structure, 44 | module_spec=__spec__, 45 | ) 46 | 47 | for name, value in _dummy_objects.items(): 48 | setattr(sys.modules[__name__], name, value) 49 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/mochi/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | 17 | try: 18 | if not (is_transformers_available() and is_torch_available()): 19 | raise OptionalDependencyNotAvailable() 20 | except OptionalDependencyNotAvailable: 21 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 22 | 23 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 24 | else: 25 | _import_structure["pipeline_mochi"] = ["MochiPipeline"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_torch_and_transformers_objects import * 34 | else: 35 | from .pipeline_mochi import MochiPipeline 36 | 37 | else: 38 | import sys 39 | 40 | sys.modules[__name__] = _LazyModule( 41 | __name__, 42 | globals()["__file__"], 43 | _import_structure, 44 | module_spec=__spec__, 45 | ) 46 | 47 | for name, value in _dummy_objects.items(): 48 | setattr(sys.modules[__name__], name, value) 49 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/mochi/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | import torch 4 | 5 | from diffusers.utils import BaseOutput 6 | 7 | 8 | @dataclass 9 | class MochiPipelineOutput(BaseOutput): 10 | r""" 11 | Output class for Mochi pipelines. 12 | 13 | Args: 14 | frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): 15 | List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing 16 | denoised PIL image sequences of length `num_frames.` It can also be a NumPy array or Torch tensor of shape 17 | `(batch_size, num_frames, channels, height, width)`. 18 | """ 19 | 20 | frames: torch.Tensor 21 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/pia/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | try: 17 | if not (is_transformers_available() and is_torch_available()): 18 | raise OptionalDependencyNotAvailable() 19 | except OptionalDependencyNotAvailable: 20 | from ...utils import dummy_torch_and_transformers_objects 21 | 22 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 23 | else: 24 | _import_structure["pipeline_pia"] = ["PIAPipeline", "PIAPipelineOutput"] 25 | 26 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 27 | try: 28 | if not (is_transformers_available() and is_torch_available()): 29 | raise OptionalDependencyNotAvailable() 30 | except OptionalDependencyNotAvailable: 31 | from ...utils.dummy_torch_and_transformers_objects import * 32 | 33 | else: 34 | from .pipeline_pia import PIAPipeline, PIAPipelineOutput 35 | 36 | else: 37 | import sys 38 | 39 | sys.modules[__name__] = _LazyModule( 40 | __name__, 41 | globals()["__file__"], 42 | _import_structure, 43 | module_spec=__spec__, 44 | ) 45 | for name, value in _dummy_objects.items(): 46 | setattr(sys.modules[__name__], name, value) 47 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/sana/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from ...utils import ( 4 | DIFFUSERS_SLOW_IMPORT, 5 | OptionalDependencyNotAvailable, 6 | _LazyModule, 7 | get_objects_from_module, 8 | is_torch_available, 9 | is_transformers_available, 10 | ) 11 | 12 | 13 | _dummy_objects = {} 14 | _import_structure = {} 15 | 16 | 17 | try: 18 | if not (is_transformers_available() and is_torch_available()): 19 | raise OptionalDependencyNotAvailable() 20 | except OptionalDependencyNotAvailable: 21 | from ...utils import dummy_torch_and_transformers_objects # noqa F403 22 | 23 | _dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects)) 24 | else: 25 | _import_structure["pipeline_sana"] = ["SanaPipeline"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not (is_transformers_available() and is_torch_available()): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_torch_and_transformers_objects import * 34 | else: 35 | from .pipeline_sana import SanaPipeline 36 | else: 37 | import sys 38 | 39 | sys.modules[__name__] = _LazyModule( 40 | __name__, 41 | globals()["__file__"], 42 | _import_structure, 43 | module_spec=__spec__, 44 | ) 45 | 46 | for name, value in _dummy_objects.items(): 47 | setattr(sys.modules[__name__], name, value) 48 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/sana/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ...utils import BaseOutput 8 | 9 | 10 | @dataclass 11 | class SanaPipelineOutput(BaseOutput): 12 | """ 13 | Output class for Sana pipelines. 14 | 15 | Args: 16 | images (`List[PIL.Image.Image]` or `np.ndarray`) 17 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 18 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 19 | """ 20 | 21 | images: Union[List[PIL.Image.Image], np.ndarray] 22 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/semantic_stable_diffusion/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Optional, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ...utils import BaseOutput 8 | 9 | 10 | @dataclass 11 | class SemanticStableDiffusionPipelineOutput(BaseOutput): 12 | """ 13 | Output class for Stable Diffusion pipelines. 14 | 15 | Args: 16 | images (`List[PIL.Image.Image]` or `np.ndarray`) 17 | List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width, 18 | num_channels)`. 19 | nsfw_content_detected (`List[bool]`) 20 | List indicating whether the corresponding generated image contains “not-safe-for-work” (nsfw) content or 21 | `None` if safety checking could not be performed. 22 | """ 23 | 24 | images: Union[List[PIL.Image.Image], np.ndarray] 25 | nsfw_content_detected: Optional[List[bool]] 26 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/stable_diffusion/clip_image_project_model.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 The GLIGEN Authors and HuggingFace Team. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from torch import nn 16 | 17 | from ...configuration_utils import ConfigMixin, register_to_config 18 | from ...models.modeling_utils import ModelMixin 19 | 20 | 21 | class CLIPImageProjection(ModelMixin, ConfigMixin): 22 | @register_to_config 23 | def __init__(self, hidden_size: int = 768): 24 | super().__init__() 25 | self.hidden_size = hidden_size 26 | self.project = nn.Linear(self.hidden_size, self.hidden_size, bias=False) 27 | 28 | def forward(self, x): 29 | return self.project(x) 30 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/stable_diffusion_3/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ...utils import BaseOutput 8 | 9 | 10 | @dataclass 11 | class StableDiffusion3PipelineOutput(BaseOutput): 12 | """ 13 | Output class for Stable Diffusion pipelines. 14 | 15 | Args: 16 | images (`List[PIL.Image.Image]` or `np.ndarray`) 17 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 18 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 19 | """ 20 | 21 | images: Union[List[PIL.Image.Image], np.ndarray] 22 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/stable_diffusion_xl/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL.Image 6 | 7 | from ...utils import BaseOutput, is_flax_available 8 | 9 | 10 | @dataclass 11 | class StableDiffusionXLPipelineOutput(BaseOutput): 12 | """ 13 | Output class for Stable Diffusion pipelines. 14 | 15 | Args: 16 | images (`List[PIL.Image.Image]` or `np.ndarray`) 17 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 18 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 19 | """ 20 | 21 | images: Union[List[PIL.Image.Image], np.ndarray] 22 | 23 | 24 | if is_flax_available(): 25 | import flax 26 | 27 | @flax.struct.dataclass 28 | class FlaxStableDiffusionXLPipelineOutput(BaseOutput): 29 | """ 30 | Output class for Flax Stable Diffusion XL pipelines. 31 | 32 | Args: 33 | images (`np.ndarray`) 34 | Array of shape `(batch_size, height, width, num_channels)` with images from the diffusion pipeline. 35 | """ 36 | 37 | images: np.ndarray 38 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/pipelines/text_to_video_synthesis/pipeline_output.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import List, Union 3 | 4 | import numpy as np 5 | import PIL 6 | import torch 7 | 8 | from ...utils import ( 9 | BaseOutput, 10 | ) 11 | 12 | 13 | @dataclass 14 | class TextToVideoSDPipelineOutput(BaseOutput): 15 | """ 16 | Output class for text-to-video pipelines. 17 | 18 | Args: 19 | frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): 20 | List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing 21 | denoised 22 | PIL image sequences of length `num_frames.` It can also be a NumPy array or Torch tensor of shape 23 | `(batch_size, num_frames, channels, height, width)` 24 | """ 25 | 26 | frames: Union[torch.Tensor, np.ndarray, List[List[PIL.Image.Image]]] 27 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/src/diffusers/py.typed -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/quantizers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 The HuggingFace Team. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .auto import DiffusersAutoQuantizer 16 | from .base import DiffusersQuantizer 17 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/quantizers/bitsandbytes/__init__.py: -------------------------------------------------------------------------------- 1 | from .bnb_quantizer import BnB4BitDiffusersQuantizer, BnB8BitDiffusersQuantizer 2 | from .utils import dequantize_and_replace, dequantize_bnb_weight, replace_with_bnb_linear 3 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/quantizers/gguf/__init__.py: -------------------------------------------------------------------------------- 1 | from .gguf_quantizer import GGUFQuantizer 2 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/quantizers/torchao/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 The HuggingFace Inc. team. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .torchao_quantizer import TorchAoHfQuantizer 16 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/schedulers/README.md: -------------------------------------------------------------------------------- 1 | # Schedulers 2 | 3 | For more information on the schedulers, please refer to the [docs](https://huggingface.co/docs/diffusers/api/schedulers/overview). -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/doc_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 The HuggingFace Team. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | """ 15 | Doc utilities: Utilities related to documentation 16 | """ 17 | 18 | import re 19 | 20 | 21 | def replace_example_docstring(example_docstring): 22 | def docstring_decorator(fn): 23 | func_doc = fn.__doc__ 24 | lines = func_doc.split("\n") 25 | i = 0 26 | while i < len(lines) and re.search(r"^\s*Examples?:\s*$", lines[i]) is None: 27 | i += 1 28 | if i < len(lines): 29 | lines[i] = example_docstring 30 | func_doc = "\n".join(lines) 31 | else: 32 | raise ValueError( 33 | f"The function {fn} should have an empty 'Examples:' in its docstring as placeholder, " 34 | f"current docstring is:\n{func_doc}" 35 | ) 36 | fn.__doc__ = func_doc 37 | return fn 38 | 39 | return docstring_decorator 40 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/dummy_note_seq_objects.py: -------------------------------------------------------------------------------- 1 | # This file is autogenerated by the command `make fix-copies`, do not edit. 2 | from ..utils import DummyObject, requires_backends 3 | 4 | 5 | class MidiProcessor(metaclass=DummyObject): 6 | _backends = ["note_seq"] 7 | 8 | def __init__(self, *args, **kwargs): 9 | requires_backends(self, ["note_seq"]) 10 | 11 | @classmethod 12 | def from_config(cls, *args, **kwargs): 13 | requires_backends(cls, ["note_seq"]) 14 | 15 | @classmethod 16 | def from_pretrained(cls, *args, **kwargs): 17 | requires_backends(cls, ["note_seq"]) 18 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/dummy_onnx_objects.py: -------------------------------------------------------------------------------- 1 | # This file is autogenerated by the command `make fix-copies`, do not edit. 2 | from ..utils import DummyObject, requires_backends 3 | 4 | 5 | class OnnxRuntimeModel(metaclass=DummyObject): 6 | _backends = ["onnx"] 7 | 8 | def __init__(self, *args, **kwargs): 9 | requires_backends(self, ["onnx"]) 10 | 11 | @classmethod 12 | def from_config(cls, *args, **kwargs): 13 | requires_backends(cls, ["onnx"]) 14 | 15 | @classmethod 16 | def from_pretrained(cls, *args, **kwargs): 17 | requires_backends(cls, ["onnx"]) 18 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/dummy_torch_and_librosa_objects.py: -------------------------------------------------------------------------------- 1 | # This file is autogenerated by the command `make fix-copies`, do not edit. 2 | from ..utils import DummyObject, requires_backends 3 | 4 | 5 | class AudioDiffusionPipeline(metaclass=DummyObject): 6 | _backends = ["torch", "librosa"] 7 | 8 | def __init__(self, *args, **kwargs): 9 | requires_backends(self, ["torch", "librosa"]) 10 | 11 | @classmethod 12 | def from_config(cls, *args, **kwargs): 13 | requires_backends(cls, ["torch", "librosa"]) 14 | 15 | @classmethod 16 | def from_pretrained(cls, *args, **kwargs): 17 | requires_backends(cls, ["torch", "librosa"]) 18 | 19 | 20 | class Mel(metaclass=DummyObject): 21 | _backends = ["torch", "librosa"] 22 | 23 | def __init__(self, *args, **kwargs): 24 | requires_backends(self, ["torch", "librosa"]) 25 | 26 | @classmethod 27 | def from_config(cls, *args, **kwargs): 28 | requires_backends(cls, ["torch", "librosa"]) 29 | 30 | @classmethod 31 | def from_pretrained(cls, *args, **kwargs): 32 | requires_backends(cls, ["torch", "librosa"]) 33 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/dummy_torch_and_scipy_objects.py: -------------------------------------------------------------------------------- 1 | # This file is autogenerated by the command `make fix-copies`, do not edit. 2 | from ..utils import DummyObject, requires_backends 3 | 4 | 5 | class LMSDiscreteScheduler(metaclass=DummyObject): 6 | _backends = ["torch", "scipy"] 7 | 8 | def __init__(self, *args, **kwargs): 9 | requires_backends(self, ["torch", "scipy"]) 10 | 11 | @classmethod 12 | def from_config(cls, *args, **kwargs): 13 | requires_backends(cls, ["torch", "scipy"]) 14 | 15 | @classmethod 16 | def from_pretrained(cls, *args, **kwargs): 17 | requires_backends(cls, ["torch", "scipy"]) 18 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/dummy_torch_and_torchsde_objects.py: -------------------------------------------------------------------------------- 1 | # This file is autogenerated by the command `make fix-copies`, do not edit. 2 | from ..utils import DummyObject, requires_backends 3 | 4 | 5 | class CosineDPMSolverMultistepScheduler(metaclass=DummyObject): 6 | _backends = ["torch", "torchsde"] 7 | 8 | def __init__(self, *args, **kwargs): 9 | requires_backends(self, ["torch", "torchsde"]) 10 | 11 | @classmethod 12 | def from_config(cls, *args, **kwargs): 13 | requires_backends(cls, ["torch", "torchsde"]) 14 | 15 | @classmethod 16 | def from_pretrained(cls, *args, **kwargs): 17 | requires_backends(cls, ["torch", "torchsde"]) 18 | 19 | 20 | class DPMSolverSDEScheduler(metaclass=DummyObject): 21 | _backends = ["torch", "torchsde"] 22 | 23 | def __init__(self, *args, **kwargs): 24 | requires_backends(self, ["torch", "torchsde"]) 25 | 26 | @classmethod 27 | def from_config(cls, *args, **kwargs): 28 | requires_backends(cls, ["torch", "torchsde"]) 29 | 30 | @classmethod 31 | def from_pretrained(cls, *args, **kwargs): 32 | requires_backends(cls, ["torch", "torchsde"]) 33 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/dummy_torch_and_transformers_and_k_diffusion_objects.py: -------------------------------------------------------------------------------- 1 | # This file is autogenerated by the command `make fix-copies`, do not edit. 2 | from ..utils import DummyObject, requires_backends 3 | 4 | 5 | class StableDiffusionKDiffusionPipeline(metaclass=DummyObject): 6 | _backends = ["torch", "transformers", "k_diffusion"] 7 | 8 | def __init__(self, *args, **kwargs): 9 | requires_backends(self, ["torch", "transformers", "k_diffusion"]) 10 | 11 | @classmethod 12 | def from_config(cls, *args, **kwargs): 13 | requires_backends(cls, ["torch", "transformers", "k_diffusion"]) 14 | 15 | @classmethod 16 | def from_pretrained(cls, *args, **kwargs): 17 | requires_backends(cls, ["torch", "transformers", "k_diffusion"]) 18 | 19 | 20 | class StableDiffusionXLKDiffusionPipeline(metaclass=DummyObject): 21 | _backends = ["torch", "transformers", "k_diffusion"] 22 | 23 | def __init__(self, *args, **kwargs): 24 | requires_backends(self, ["torch", "transformers", "k_diffusion"]) 25 | 26 | @classmethod 27 | def from_config(cls, *args, **kwargs): 28 | requires_backends(cls, ["torch", "transformers", "k_diffusion"]) 29 | 30 | @classmethod 31 | def from_pretrained(cls, *args, **kwargs): 32 | requires_backends(cls, ["torch", "transformers", "k_diffusion"]) 33 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/dummy_transformers_and_torch_and_note_seq_objects.py: -------------------------------------------------------------------------------- 1 | # This file is autogenerated by the command `make fix-copies`, do not edit. 2 | from ..utils import DummyObject, requires_backends 3 | 4 | 5 | class SpectrogramDiffusionPipeline(metaclass=DummyObject): 6 | _backends = ["transformers", "torch", "note_seq"] 7 | 8 | def __init__(self, *args, **kwargs): 9 | requires_backends(self, ["transformers", "torch", "note_seq"]) 10 | 11 | @classmethod 12 | def from_config(cls, *args, **kwargs): 13 | requires_backends(cls, ["transformers", "torch", "note_seq"]) 14 | 15 | @classmethod 16 | def from_pretrained(cls, *args, **kwargs): 17 | requires_backends(cls, ["transformers", "torch", "note_seq"]) 18 | -------------------------------------------------------------------------------- /src/diffusers/src/diffusers/utils/model_card_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | {{ card_data }} 3 | --- 4 | 5 | 7 | 8 | {{ model_description }} 9 | 10 | ## Intended uses & limitations 11 | 12 | #### How to use 13 | 14 | ```python 15 | # TODO: add an example code snippet for running this diffusion pipeline 16 | ``` 17 | 18 | #### Limitations and bias 19 | 20 | [TODO: provide examples of latent issues and potential remediations] 21 | 22 | ## Training details 23 | 24 | [TODO: describe the data used to train the model] 25 | -------------------------------------------------------------------------------- /src/diffusers/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/fixtures/elise_format0.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/fixtures/elise_format0.mid -------------------------------------------------------------------------------- /src/diffusers/tests/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/models/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/models/autoencoders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/models/autoencoders/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/models/autoencoders/test_models_vae_flax.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from diffusers import FlaxAutoencoderKL 4 | from diffusers.utils import is_flax_available 5 | from diffusers.utils.testing_utils import require_flax 6 | 7 | from ..test_modeling_common_flax import FlaxModelTesterMixin 8 | 9 | 10 | if is_flax_available(): 11 | import jax 12 | 13 | 14 | @require_flax 15 | class FlaxAutoencoderKLTests(FlaxModelTesterMixin, unittest.TestCase): 16 | model_class = FlaxAutoencoderKL 17 | 18 | @property 19 | def dummy_input(self): 20 | batch_size = 4 21 | num_channels = 3 22 | sizes = (32, 32) 23 | 24 | prng_key = jax.random.PRNGKey(0) 25 | image = jax.random.uniform(prng_key, ((batch_size, num_channels) + sizes)) 26 | 27 | return {"sample": image, "prng_key": prng_key} 28 | 29 | def prepare_init_args_and_inputs_for_common(self): 30 | init_dict = { 31 | "block_out_channels": [32, 64], 32 | "in_channels": 3, 33 | "out_channels": 3, 34 | "down_block_types": ["DownEncoderBlock2D", "DownEncoderBlock2D"], 35 | "up_block_types": ["UpDecoderBlock2D", "UpDecoderBlock2D"], 36 | "latent_channels": 4, 37 | } 38 | inputs_dict = self.dummy_input 39 | return init_dict, inputs_dict 40 | -------------------------------------------------------------------------------- /src/diffusers/tests/models/transformers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/models/transformers/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/models/unets/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/models/unets/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/others/test_hub_utils.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | # Copyright 2024 HuggingFace Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | import unittest 16 | from pathlib import Path 17 | from tempfile import TemporaryDirectory 18 | 19 | from diffusers.utils.hub_utils import load_or_create_model_card, populate_model_card 20 | 21 | 22 | class CreateModelCardTest(unittest.TestCase): 23 | def test_generate_model_card_with_library_name(self): 24 | with TemporaryDirectory() as tmpdir: 25 | file_path = Path(tmpdir) / "README.md" 26 | file_path.write_text("---\nlibrary_name: foo\n---\nContent\n") 27 | model_card = load_or_create_model_card(file_path) 28 | populate_model_card(model_card) 29 | assert model_card.data.library_name == "foo" 30 | -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/allegro/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/allegro/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/amused/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/amused/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/animatediff/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/animatediff/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/audioldm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/audioldm/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/audioldm2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/audioldm2/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/aura_flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/aura_flow/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/blipdiffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/blipdiffusion/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/cogvideo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/cogvideo/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/cogview3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/cogview3/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/consistency_models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/consistency_models/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/controlnet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/controlnet/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/controlnet_flux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/controlnet_flux/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/controlnet_hunyuandit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/controlnet_hunyuandit/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/controlnet_sd3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/controlnet_sd3/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/controlnet_xs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/controlnet_xs/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/dance_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/dance_diffusion/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/ddim/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/ddim/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/ddpm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/ddpm/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/dit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/dit/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/flux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/flux/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/hunyuan_dit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/hunyuan_dit/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/hunyuan_video/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/hunyuan_video/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/i2vgen_xl/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/i2vgen_xl/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/kandinsky/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/kandinsky/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/kandinsky2_2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/kandinsky2_2/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/kandinsky3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/kandinsky3/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/kolors/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/kolors/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/latent_consistency_models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/latent_consistency_models/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/latent_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/latent_diffusion/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/latte/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/latte/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/ledits_pp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/ledits_pp/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/ltx/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/ltx/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/lumina/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/lumina/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/marigold/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/marigold/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/mochi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/mochi/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/musicldm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/musicldm/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/pag/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/pag/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/paint_by_example/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/paint_by_example/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/pia/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/pia/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/pixart_alpha/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/pixart_alpha/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/pixart_sigma/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/pixart_sigma/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/pndm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/pndm/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/sana/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/sana/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/semantic_stable_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/semantic_stable_diffusion/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/shap_e/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/shap_e/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_audio/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_audio/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_cascade/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_cascade/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_2/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_3/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_adapter/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_adapter/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_gligen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_gligen/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_gligen_text_image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_gligen_text_image/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_image_variation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_image_variation/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_k_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_k_diffusion/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_ldm3d/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_ldm3d/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_panorama/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_panorama/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_safe/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_safe/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_sag/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_sag/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_diffusion_xl/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_diffusion_xl/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_unclip/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_unclip/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/stable_video_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/stable_video_diffusion/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/test_pipelines_onnx_common.py: -------------------------------------------------------------------------------- 1 | from diffusers.utils.testing_utils import require_onnxruntime 2 | 3 | 4 | @require_onnxruntime 5 | class OnnxPipelineTesterMixin: 6 | """ 7 | This mixin is designed to be used with unittest.TestCase classes. 8 | It provides a set of common tests for each ONNXRuntime pipeline, e.g. saving and loading the pipeline, 9 | equivalence of dict and tuple outputs, etc. 10 | """ 11 | 12 | pass 13 | -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/text_to_video_synthesis/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/text_to_video_synthesis/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/unclip/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/unclip/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/unidiffuser/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/unidiffuser/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/pipelines/wuerstchen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/pipelines/wuerstchen/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/quantization/bnb/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/quantization/bnb/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/schedulers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/schedulers/__init__.py -------------------------------------------------------------------------------- /src/diffusers/tests/single_file/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/diffusers/tests/single_file/__init__.py -------------------------------------------------------------------------------- /src/scripts/eval/1665_Girl_with_a_Pearl_Earring.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/scripts/eval/1665_Girl_with_a_Pearl_Earring.jpg -------------------------------------------------------------------------------- /src/scripts/eval/forest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/scripts/eval/forest.png -------------------------------------------------------------------------------- /src/scripts/eval/orange_cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenllliang/DreamEngine/374cffe648f095f5ecb37d7a4690c54fb285b58b/src/scripts/eval/orange_cat.png --------------------------------------------------------------------------------