├── README.md ├── anyword_data.py ├── anyword_data_lmdb.py ├── configs ├── train_diff_step1_cfg.py ├── train_diff_step2_cfg.py └── train_vae_cfg.py ├── diffusers ├── .github │ ├── ISSUE_TEMPLATE │ │ ├── bug-report.yml │ │ ├── config.yml │ │ ├── feature_request.md │ │ ├── feedback.md │ │ ├── new-model-addition.yml │ │ └── translate.md │ ├── PULL_REQUEST_TEMPLATE.md │ ├── actions │ │ └── setup-miniconda │ │ │ └── action.yml │ └── workflows │ │ ├── benchmark.yml │ │ ├── build_docker_images.yml │ │ ├── build_documentation.yml │ │ ├── build_pr_documentation.yml │ │ ├── mirror_community_pipeline.yml │ │ ├── nightly_tests.yml │ │ ├── notify_slack_about_release.yml │ │ ├── pr_dependency_test.yml │ │ ├── pr_flax_dependency_test.yml │ │ ├── pr_test_fetcher.yml │ │ ├── pr_test_peft_backend.yml │ │ ├── pr_tests.yml │ │ ├── pr_torch_dependency_test.yml │ │ ├── push_tests.yml │ │ ├── push_tests_fast.yml │ │ ├── push_tests_mps.yml │ │ ├── pypi_publish.yaml │ │ ├── release_tests_fast.yml │ │ ├── run_tests_from_a_pr.yml │ │ ├── ssh-pr-runner.yml │ │ ├── ssh-runner.yml │ │ ├── stale.yml │ │ ├── trufflehog.yml │ │ ├── typos.yml │ │ ├── update_metadata.yml │ │ └── upload_pr_documentation.yml ├── .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 │ │ │ │ └── unet.md │ │ │ ├── logging.md │ │ │ ├── models │ │ │ │ ├── asymmetricautoencoderkl.md │ │ │ │ ├── aura_flow_transformer2d.md │ │ │ │ ├── autoencoder_oobleck.md │ │ │ │ ├── autoencoder_tiny.md │ │ │ │ ├── autoencoderkl.md │ │ │ │ ├── autoencoderkl_cogvideox.md │ │ │ │ ├── cogvideox_transformer3d.md │ │ │ │ ├── consistency_decoder_vae.md │ │ │ │ ├── controlnet.md │ │ │ │ ├── controlnet_flux.md │ │ │ │ ├── controlnet_hunyuandit.md │ │ │ │ ├── controlnet_sd3.md │ │ │ │ ├── controlnet_sparsectrl.md │ │ │ │ ├── dit_transformer2d.md │ │ │ │ ├── flux_transformer.md │ │ │ │ ├── hunyuan_transformer2d.md │ │ │ │ ├── latte_transformer3d.md │ │ │ │ ├── lumina_nextdit2d.md │ │ │ │ ├── overview.md │ │ │ │ ├── pixart_transformer2d.md │ │ │ │ ├── prior_transformer.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 │ │ │ │ ├── amused.md │ │ │ │ ├── animatediff.md │ │ │ │ ├── attend_and_excite.md │ │ │ │ ├── audioldm.md │ │ │ │ ├── audioldm2.md │ │ │ │ ├── aura_flow.md │ │ │ │ ├── auto_pipeline.md │ │ │ │ ├── blip_diffusion.md │ │ │ │ ├── cogvideox.md │ │ │ │ ├── consistency_models.md │ │ │ │ ├── controlnet.md │ │ │ │ ├── controlnet_flux.md │ │ │ │ ├── controlnet_hunyuandit.md │ │ │ │ ├── controlnet_sd3.md │ │ │ │ ├── controlnet_sdxl.md │ │ │ │ ├── controlnetxs.md │ │ │ │ ├── controlnetxs_sdxl.md │ │ │ │ ├── dance_diffusion.md │ │ │ │ ├── ddim.md │ │ │ │ ├── ddpm.md │ │ │ │ ├── deepfloyd_if.md │ │ │ │ ├── diffedit.md │ │ │ │ ├── dit.md │ │ │ │ ├── flux.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 │ │ │ │ ├── lumina.md │ │ │ │ ├── marigold.md │ │ │ │ ├── musicldm.md │ │ │ │ ├── overview.md │ │ │ │ ├── pag.md │ │ │ │ ├── paint_by_example.md │ │ │ │ ├── panorama.md │ │ │ │ ├── pia.md │ │ │ │ ├── pix2pix.md │ │ │ │ ├── pixart.md │ │ │ │ ├── pixart_sigma.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 │ │ │ ├── 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 │ │ │ ├── onnx.md │ │ │ ├── open_vino.md │ │ │ ├── tgate.md │ │ │ ├── tome.md │ │ │ ├── torch2.0.md │ │ │ ├── xdit.md │ │ │ └── xformers.md │ │ ├── quicktour.md │ │ ├── stable_diffusion.md │ │ ├── training │ │ │ ├── adapt_a_model.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 │ │ │ ├── conditional_image_generation.md │ │ │ ├── controlling_generation.md │ │ │ ├── controlnet.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 │ │ ├── requirements.txt │ │ ├── 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_lora.py │ ├── community │ │ ├── README.md │ │ ├── README_community_scripts.md │ │ ├── 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 │ │ ├── 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_with_cfg.py │ │ ├── pipeline_hunyuandit_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_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_sd3.md │ │ ├── README_sdxl.md │ │ ├── requirements.txt │ │ ├── requirements_flax.txt │ │ ├── requirements_flux.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_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_sd3.py │ │ ├── train_dreambooth_lora_sdxl.py │ │ └── train_dreambooth_sd3.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 │ ├── reinforcement_learning │ │ ├── README.md │ │ └── 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 │ │ ├── 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 │ │ ├── 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 │ │ ├── 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 │ ├── 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 │ └── 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 ├── 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_consistency_decoder.py │ ├── convert_consistency_to_diffusers.py │ ├── convert_dance_diffusion_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_gligen_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_lumina_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_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 │ │ ├── unet.py │ │ ├── unet_loader_utils.py │ │ └── utils.py │ │ ├── models │ │ ├── README.md │ │ ├── __init__.py │ │ ├── activations.py │ │ ├── adapter.py │ │ ├── attention.py │ │ ├── attention_flax.py │ │ ├── attention_processor.py │ │ ├── autoencoders │ │ │ ├── __init__.py │ │ │ ├── autoencoder_asym_kl.py │ │ │ ├── autoencoder_kl.py │ │ │ ├── autoencoder_kl_cogvideox.py │ │ │ ├── autoencoder_kl_temporal_decoder.py │ │ │ ├── autoencoder_oobleck.py │ │ │ ├── autoencoder_tiny.py │ │ │ ├── consistency_decoder_vae.py │ │ │ ├── vae.py │ │ │ └── vq_model.py │ │ ├── controlnet.py │ │ ├── controlnet_flax.py │ │ ├── controlnet_flux.py │ │ ├── controlnet_hunyuan.py │ │ ├── controlnet_sd3.py │ │ ├── controlnet_sparsectrl.py │ │ ├── controlnet_xs.py │ │ ├── downsampling.py │ │ ├── embeddings.py │ │ ├── embeddings_flax.py │ │ ├── lora.py │ │ ├── model_loading_utils.py │ │ ├── modeling_flax_pytorch_utils.py │ │ ├── modeling_flax_utils.py │ │ ├── modeling_outputs.py │ │ ├── modeling_pytorch_flax_utils.py │ │ ├── modeling_utils.py │ │ ├── normalization.py │ │ ├── resnet.py │ │ ├── resnet_flax.py │ │ ├── transformers │ │ │ ├── __init__.py │ │ │ ├── auraflow_transformer_2d.py │ │ │ ├── cogvideox_transformer_3d.py │ │ │ ├── dit_transformer_2d.py │ │ │ ├── dual_transformer_2d.py │ │ │ ├── hunyuan_transformer_2d.py │ │ │ ├── latte_transformer_3d.py │ │ │ ├── lumina_nextdit2d.py │ │ │ ├── pixart_transformer_2d.py │ │ │ ├── prior_transformer.py │ │ │ ├── stable_audio_transformer.py │ │ │ ├── t5_film_transformer.py │ │ │ ├── transformer_2d.py │ │ │ ├── transformer_flux.py │ │ │ ├── transformer_sd3.py │ │ │ └── transformer_temporal.py │ │ ├── unets │ │ │ ├── __init__.py │ │ │ ├── unet_1d.py │ │ │ ├── unet_1d_blocks.py │ │ │ ├── unet_2d.py │ │ │ ├── unet_2d_blocks.py │ │ │ ├── unet_2d_blocks_flax.py │ │ │ ├── unet_2d_condition.py │ │ │ ├── unet_2d_condition_flax.py │ │ │ ├── unet_3d_blocks.py │ │ │ ├── unet_3d_condition.py │ │ │ ├── unet_i2vgen_xl.py │ │ │ ├── unet_kandinsky3.py │ │ │ ├── unet_motion_model.py │ │ │ ├── unet_spatio_temporal_condition.py │ │ │ ├── unet_stable_cascade.py │ │ │ └── uvit_2d.py │ │ ├── upsampling.py │ │ ├── vae_flax.py │ │ └── vq_model.py │ │ ├── optimization.py │ │ ├── pipelines │ │ ├── README.md │ │ ├── __init__.py │ │ ├── amused │ │ │ ├── __init__.py │ │ │ ├── pipeline_amused.py │ │ │ ├── pipeline_amused_img2img.py │ │ │ └── pipeline_amused_inpaint.py │ │ ├── animatediff │ │ │ ├── __init__.py │ │ │ ├── pipeline_animatediff.py │ │ │ ├── pipeline_animatediff_controlnet.py │ │ │ ├── pipeline_animatediff_sdxl.py │ │ │ ├── pipeline_animatediff_sparsectrl.py │ │ │ ├── pipeline_animatediff_video2video.py │ │ │ ├── pipeline_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_image2video.py │ │ │ ├── pipeline_cogvideox_video2video.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_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 │ │ │ ├── pipeline_flux.py │ │ │ ├── pipeline_flux_controlnet.py │ │ │ ├── pipeline_flux_controlnet_image_to_image.py │ │ │ ├── pipeline_flux_controlnet_inpainting.py │ │ │ ├── pipeline_flux_img2img.py │ │ │ ├── pipeline_flux_inpaint.py │ │ │ └── pipeline_output.py │ │ ├── free_init_utils.py │ │ ├── free_noise_utils.py │ │ ├── hunyuandit │ │ │ ├── __init__.py │ │ │ └── pipeline_hunyuandit.py │ │ ├── i2vgen_xl │ │ │ ├── __init__.py │ │ │ └── pipeline_i2vgen_xl.py │ │ ├── kandinsky │ │ │ ├── __init__.py │ │ │ ├── pipeline_kandinsky.py │ │ │ ├── pipeline_kandinsky_combined.py │ │ │ ├── pipeline_kandinsky_img2img.py │ │ │ ├── pipeline_kandinsky_inpaint.py │ │ │ ├── pipeline_kandinsky_prior.py │ │ │ └── text_encoder.py │ │ ├── kandinsky2_2 │ │ │ ├── __init__.py │ │ │ ├── pipeline_kandinsky2_2.py │ │ │ ├── pipeline_kandinsky2_2_combined.py │ │ │ ├── pipeline_kandinsky2_2_controlnet.py │ │ │ ├── pipeline_kandinsky2_2_controlnet_img2img.py │ │ │ ├── pipeline_kandinsky2_2_img2img.py │ │ │ ├── pipeline_kandinsky2_2_inpainting.py │ │ │ ├── pipeline_kandinsky2_2_prior.py │ │ │ └── pipeline_kandinsky2_2_prior_emb2emb.py │ │ ├── kandinsky3 │ │ │ ├── __init__.py │ │ │ ├── convert_kandinsky3_unet.py │ │ │ ├── pipeline_kandinsky3.py │ │ │ └── pipeline_kandinsky3_img2img.py │ │ ├── kolors │ │ │ ├── __init__.py │ │ │ ├── pipeline_kolors.py │ │ │ ├── pipeline_kolors_img2img.py │ │ │ ├── pipeline_output.py │ │ │ ├── text_encoder.py │ │ │ └── tokenizer.py │ │ ├── latent_consistency_models │ │ │ ├── __init__.py │ │ │ ├── pipeline_latent_consistency_img2img.py │ │ │ └── pipeline_latent_consistency_text2img.py │ │ ├── latent_diffusion │ │ │ ├── __init__.py │ │ │ ├── pipeline_latent_diffusion.py │ │ │ └── pipeline_latent_diffusion_superresolution.py │ │ ├── latte │ │ │ ├── __init__.py │ │ │ └── pipeline_latte.py │ │ ├── ledits_pp │ │ │ ├── __init__.py │ │ │ ├── pipeline_leditspp_stable_diffusion.py │ │ │ ├── pipeline_leditspp_stable_diffusion_xl.py │ │ │ └── pipeline_output.py │ │ ├── lumina │ │ │ ├── __init__.py │ │ │ └── pipeline_lumina.py │ │ ├── marigold │ │ │ ├── __init__.py │ │ │ ├── marigold_image_processing.py │ │ │ ├── pipeline_marigold_depth.py │ │ │ └── pipeline_marigold_normals.py │ │ ├── musicldm │ │ │ ├── __init__.py │ │ │ └── pipeline_musicldm.py │ │ ├── onnx_utils.py │ │ ├── pag │ │ │ ├── __init__.py │ │ │ ├── pag_utils.py │ │ │ ├── pipeline_pag_controlnet_sd.py │ │ │ ├── pipeline_pag_controlnet_sd_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_sd.py │ │ │ ├── pipeline_pag_sd_3.py │ │ │ ├── pipeline_pag_sd_animatediff.py │ │ │ ├── pipeline_pag_sd_img2img.py │ │ │ ├── pipeline_pag_sd_xl.py │ │ │ ├── pipeline_pag_sd_xl_img2img.py │ │ │ └── pipeline_pag_sd_xl_inpaint.py │ │ ├── paint_by_example │ │ │ ├── __init__.py │ │ │ ├── image_encoder.py │ │ │ └── pipeline_paint_by_example.py │ │ ├── pia │ │ │ ├── __init__.py │ │ │ └── pipeline_pia.py │ │ ├── pipeline_flax_utils.py │ │ ├── pipeline_loading_utils.py │ │ ├── pipeline_utils.py │ │ ├── pixart_alpha │ │ │ ├── __init__.py │ │ │ ├── pipeline_pixart_alpha.py │ │ │ └── pipeline_pixart_sigma.py │ │ ├── semantic_stable_diffusion │ │ │ ├── __init__.py │ │ │ ├── pipeline_output.py │ │ │ └── pipeline_semantic_stable_diffusion.py │ │ ├── shap_e │ │ │ ├── __init__.py │ │ │ ├── camera.py │ │ │ ├── pipeline_shap_e.py │ │ │ ├── pipeline_shap_e_img2img.py │ │ │ └── renderer.py │ │ ├── stable_audio │ │ │ ├── __init__.py │ │ │ ├── modeling_stable_audio.py │ │ │ └── pipeline_stable_audio.py │ │ ├── stable_cascade │ │ │ ├── __init__.py │ │ │ ├── pipeline_stable_cascade.py │ │ │ ├── pipeline_stable_cascade_combined.py │ │ │ └── pipeline_stable_cascade_prior.py │ │ ├── stable_diffusion │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── clip_image_project_model.py │ │ │ ├── convert_from_ckpt.py │ │ │ ├── pipeline_flax_stable_diffusion.py │ │ │ ├── pipeline_flax_stable_diffusion_img2img.py │ │ │ ├── pipeline_flax_stable_diffusion_inpaint.py │ │ │ ├── pipeline_onnx_stable_diffusion.py │ │ │ ├── pipeline_onnx_stable_diffusion_img2img.py │ │ │ ├── pipeline_onnx_stable_diffusion_inpaint.py │ │ │ ├── pipeline_onnx_stable_diffusion_upscale.py │ │ │ ├── pipeline_output.py │ │ │ ├── pipeline_stable_diffusion.py │ │ │ ├── pipeline_stable_diffusion_depth2img.py │ │ │ ├── pipeline_stable_diffusion_image_variation.py │ │ │ ├── pipeline_stable_diffusion_img2img.py │ │ │ ├── pipeline_stable_diffusion_inpaint.py │ │ │ ├── pipeline_stable_diffusion_instruct_pix2pix.py │ │ │ ├── pipeline_stable_diffusion_latent_upscale.py │ │ │ ├── pipeline_stable_diffusion_upscale.py │ │ │ ├── pipeline_stable_unclip.py │ │ │ ├── pipeline_stable_unclip_img2img.py │ │ │ ├── safety_checker.py │ │ │ ├── safety_checker_flax.py │ │ │ └── stable_unclip_image_normalizer.py │ │ ├── stable_diffusion_3 │ │ │ ├── __init__.py │ │ │ ├── pipeline_output.py │ │ │ ├── pipeline_stable_diffusion_3.py │ │ │ ├── pipeline_stable_diffusion_3_img2img.py │ │ │ └── pipeline_stable_diffusion_3_inpaint.py │ │ ├── stable_diffusion_attend_and_excite │ │ │ ├── __init__.py │ │ │ └── pipeline_stable_diffusion_attend_and_excite.py │ │ ├── stable_diffusion_diffedit │ │ │ ├── __init__.py │ │ │ └── pipeline_stable_diffusion_diffedit.py │ │ ├── stable_diffusion_gligen │ │ │ ├── __init__.py │ │ │ ├── pipeline_stable_diffusion_gligen.py │ │ │ └── pipeline_stable_diffusion_gligen_text_image.py │ │ ├── stable_diffusion_k_diffusion │ │ │ ├── __init__.py │ │ │ ├── pipeline_stable_diffusion_k_diffusion.py │ │ │ └── pipeline_stable_diffusion_xl_k_diffusion.py │ │ ├── stable_diffusion_ldm3d │ │ │ ├── __init__.py │ │ │ └── pipeline_stable_diffusion_ldm3d.py │ │ ├── stable_diffusion_panorama │ │ │ ├── __init__.py │ │ │ └── pipeline_stable_diffusion_panorama.py │ │ ├── stable_diffusion_safe │ │ │ ├── __init__.py │ │ │ ├── pipeline_output.py │ │ │ ├── pipeline_stable_diffusion_safe.py │ │ │ └── safety_checker.py │ │ ├── stable_diffusion_sag │ │ │ ├── __init__.py │ │ │ └── pipeline_stable_diffusion_sag.py │ │ ├── stable_diffusion_xl │ │ │ ├── __init__.py │ │ │ ├── pipeline_flax_stable_diffusion_xl.py │ │ │ ├── pipeline_output.py │ │ │ ├── pipeline_stable_diffusion_xl.py │ │ │ ├── pipeline_stable_diffusion_xl_img2img.py │ │ │ ├── pipeline_stable_diffusion_xl_inpaint.py │ │ │ ├── pipeline_stable_diffusion_xl_instruct_pix2pix.py │ │ │ └── watermark.py │ │ ├── stable_video_diffusion │ │ │ ├── __init__.py │ │ │ └── pipeline_stable_video_diffusion.py │ │ ├── t2i_adapter │ │ │ ├── __init__.py │ │ │ ├── pipeline_stable_diffusion_adapter.py │ │ │ └── pipeline_stable_diffusion_xl_adapter.py │ │ ├── text_to_video_synthesis │ │ │ ├── __init__.py │ │ │ ├── pipeline_output.py │ │ │ ├── pipeline_text_to_video_synth.py │ │ │ ├── pipeline_text_to_video_synth_img2img.py │ │ │ ├── pipeline_text_to_video_zero.py │ │ │ └── pipeline_text_to_video_zero_sdxl.py │ │ ├── unclip │ │ │ ├── __init__.py │ │ │ ├── pipeline_unclip.py │ │ │ ├── pipeline_unclip_image_variation.py │ │ │ └── text_proj.py │ │ ├── unidiffuser │ │ │ ├── __init__.py │ │ │ ├── modeling_text_decoder.py │ │ │ ├── modeling_uvit.py │ │ │ └── pipeline_unidiffuser.py │ │ └── wuerstchen │ │ │ ├── __init__.py │ │ │ ├── modeling_paella_vq_model.py │ │ │ ├── modeling_wuerstchen_common.py │ │ │ ├── modeling_wuerstchen_diffnext.py │ │ │ ├── modeling_wuerstchen_prior.py │ │ │ ├── pipeline_wuerstchen.py │ │ │ ├── pipeline_wuerstchen_combined.py │ │ │ └── pipeline_wuerstchen_prior.py │ │ ├── py.typed │ │ ├── schedulers │ │ ├── README.md │ │ ├── __init__.py │ │ ├── deprecated │ │ │ ├── __init__.py │ │ │ ├── scheduling_karras_ve.py │ │ │ └── scheduling_sde_vp.py │ │ ├── scheduling_amused.py │ │ ├── scheduling_consistency_decoder.py │ │ ├── scheduling_consistency_models.py │ │ ├── scheduling_cosine_dpmsolver_multistep.py │ │ ├── scheduling_ddim.py │ │ ├── scheduling_ddim_cogvideox.py │ │ ├── scheduling_ddim_flax.py │ │ ├── scheduling_ddim_inverse.py │ │ ├── scheduling_ddim_parallel.py │ │ ├── scheduling_ddpm.py │ │ ├── scheduling_ddpm_flax.py │ │ ├── scheduling_ddpm_parallel.py │ │ ├── scheduling_ddpm_wuerstchen.py │ │ ├── scheduling_deis_multistep.py │ │ ├── scheduling_dpm_cogvideox.py │ │ ├── scheduling_dpmsolver_multistep.py │ │ ├── scheduling_dpmsolver_multistep_flax.py │ │ ├── scheduling_dpmsolver_multistep_inverse.py │ │ ├── scheduling_dpmsolver_sde.py │ │ ├── scheduling_dpmsolver_singlestep.py │ │ ├── scheduling_edm_dpmsolver_multistep.py │ │ ├── scheduling_edm_euler.py │ │ ├── scheduling_euler_ancestral_discrete.py │ │ ├── scheduling_euler_discrete.py │ │ ├── scheduling_euler_discrete_flax.py │ │ ├── scheduling_flow_match_euler_discrete.py │ │ ├── scheduling_flow_match_heun_discrete.py │ │ ├── scheduling_heun_discrete.py │ │ ├── scheduling_ipndm.py │ │ ├── scheduling_k_dpm_2_ancestral_discrete.py │ │ ├── scheduling_k_dpm_2_discrete.py │ │ ├── scheduling_karras_ve_flax.py │ │ ├── scheduling_lcm.py │ │ ├── scheduling_lms_discrete.py │ │ ├── scheduling_lms_discrete_flax.py │ │ ├── scheduling_pndm.py │ │ ├── scheduling_pndm_flax.py │ │ ├── scheduling_repaint.py │ │ ├── scheduling_sasolver.py │ │ ├── scheduling_sde_ve.py │ │ ├── scheduling_sde_ve_flax.py │ │ ├── scheduling_tcd.py │ │ ├── scheduling_unclip.py │ │ ├── scheduling_unipc_multistep.py │ │ ├── scheduling_utils.py │ │ ├── scheduling_utils_flax.py │ │ └── scheduling_vq_diffusion.py │ │ ├── training_utils.py │ │ ├── utils │ │ ├── __init__.py │ │ ├── accelerate_utils.py │ │ ├── constants.py │ │ ├── deprecation_utils.py │ │ ├── doc_utils.py │ │ ├── dummy_flax_and_transformers_objects.py │ │ ├── dummy_flax_objects.py │ │ ├── dummy_note_seq_objects.py │ │ ├── dummy_onnx_objects.py │ │ ├── dummy_pt_objects.py │ │ ├── dummy_torch_and_librosa_objects.py │ │ ├── dummy_torch_and_scipy_objects.py │ │ ├── dummy_torch_and_torchsde_objects.py │ │ ├── dummy_torch_and_transformers_and_k_diffusion_objects.py │ │ ├── dummy_torch_and_transformers_and_onnx_objects.py │ │ ├── dummy_torch_and_transformers_and_sentencepiece_objects.py │ │ ├── dummy_torch_and_transformers_objects.py │ │ ├── dummy_transformers_and_torch_and_note_seq_objects.py │ │ ├── dynamic_modules_utils.py │ │ ├── export_utils.py │ │ ├── hub_utils.py │ │ ├── import_utils.py │ │ ├── loading_utils.py │ │ ├── logging.py │ │ ├── model_card_template.md │ │ ├── outputs.py │ │ ├── peft_utils.py │ │ ├── pil_utils.py │ │ ├── state_dict_utils.py │ │ ├── testing_utils.py │ │ ├── torch_utils.py │ │ └── versions.py │ │ └── video_processor.py ├── tests │ ├── __init__.py │ ├── conftest.py │ ├── fixtures │ │ ├── custom_pipeline │ │ │ ├── pipeline.py │ │ │ └── what_ever.py │ │ └── elise_format0.mid │ ├── lora │ │ ├── test_lora_layers_cogvideox.py │ │ ├── test_lora_layers_flux.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_vae.py │ │ │ ├── test_models_vae_flax.py │ │ │ └── test_models_vq.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_aura_flow.py │ │ │ ├── test_models_transformer_cogvideox.py │ │ │ ├── test_models_transformer_flux.py │ │ │ ├── test_models_transformer_hunyuan_dit.py │ │ │ ├── test_models_transformer_latte.py │ │ │ ├── test_models_transformer_lumina.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 │ │ ├── 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_image2video.py │ │ │ └── test_cogvideox_video2video.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_img2img.py │ │ │ └── test_pipeline_flux_inpaint.py │ │ ├── hunyuan_dit │ │ │ ├── __init__.py │ │ │ └── test_hunyuan_dit.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 │ │ ├── lumina │ │ │ ├── __init__.py │ │ │ └── test_lumina_nextdit.py │ │ ├── marigold │ │ │ ├── __init__.py │ │ │ ├── test_marigold_depth.py │ │ │ └── test_marigold_normals.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_sd.py │ │ │ ├── test_pag_sd3.py │ │ │ ├── test_pag_sd_img2img.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 │ │ ├── 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 │ ├── 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_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 ├── imgs ├── framework.svg ├── intro.svg ├── model.svg └── more_viz.svg ├── infer.py ├── requirements.txt ├── train_diff.py └── train_vae.py /diffusers/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Questions / Discussions 3 | url: https://github.com/huggingface/diffusers/discussions 4 | about: General usage questions and community discussions 5 | -------------------------------------------------------------------------------- /diffusers/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680 Feature Request" 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]. 12 | 13 | **Describe the solution you'd like.** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered.** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context.** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /diffusers/.github/ISSUE_TEMPLATE/feedback.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "💬 Feedback about API Design" 3 | about: Give feedback about the current API design 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What API design would you like to have changed or added to the library? Why?** 11 | 12 | **What use case would this enable or better enable? Can you give us a code example?** 13 | -------------------------------------------------------------------------------- /diffusers/.github/ISSUE_TEMPLATE/new-model-addition.yml: -------------------------------------------------------------------------------- 1 | name: "\U0001F31F New Model/Pipeline/Scheduler Addition" 2 | description: Submit a proposal/request to implement a new diffusion model/pipeline/scheduler 3 | labels: [ "New model/pipeline/scheduler" ] 4 | 5 | body: 6 | - type: textarea 7 | id: description-request 8 | validations: 9 | required: true 10 | attributes: 11 | label: Model/Pipeline/Scheduler description 12 | description: | 13 | Put any and all important information relative to the model/pipeline/scheduler 14 | 15 | - type: checkboxes 16 | id: information-tasks 17 | attributes: 18 | label: Open source status 19 | description: | 20 | Please note that if the model implementation isn't available or if the weights aren't open-source, we are less likely to implement it in `diffusers`. 21 | options: 22 | - label: "The model implementation is available." 23 | - label: "The model weights are available (Only relevant if addition is not a scheduler)." 24 | 25 | - type: textarea 26 | id: additional-info 27 | attributes: 28 | label: Provide useful links for the implementation 29 | description: | 30 | Please provide information regarding the implementation, the weights, and the authors. 31 | Please mention the authors by @gh-username if you're aware of their usernames. 32 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/build_documentation.yml: -------------------------------------------------------------------------------- 1 | name: Build documentation 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - doc-builder* 8 | - v*-release 9 | - v*-patch 10 | paths: 11 | - "src/diffusers/**.py" 12 | - "examples/**" 13 | - "docs/**" 14 | 15 | jobs: 16 | build: 17 | uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main 18 | with: 19 | commit_sha: ${{ github.sha }} 20 | install_libgl1: true 21 | package: diffusers 22 | notebook_folder: diffusers_doc 23 | languages: en ko zh ja pt 24 | custom_container: diffusers/diffusers-doc-builder 25 | secrets: 26 | token: ${{ secrets.HUGGINGFACE_PUSH }} 27 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }} 28 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/build_pr_documentation.yml: -------------------------------------------------------------------------------- 1 | name: Build PR Documentation 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - "src/diffusers/**.py" 7 | - "examples/**" 8 | - "docs/**" 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | build: 16 | uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main 17 | with: 18 | commit_sha: ${{ github.event.pull_request.head.sha }} 19 | pr_number: ${{ github.event.number }} 20 | install_libgl1: true 21 | package: diffusers 22 | languages: en ko zh ja pt 23 | custom_container: diffusers/diffusers-doc-builder 24 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/notify_slack_about_release.yml: -------------------------------------------------------------------------------- 1 | name: Notify Slack about a release 2 | 3 | on: 4 | workflow_dispatch: 5 | release: 6 | types: [published] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: Setup Python 16 | uses: actions/setup-python@v4 17 | with: 18 | python-version: '3.8' 19 | 20 | - name: Notify Slack about the release 21 | env: 22 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 23 | run: pip install requests && python utils/notify_slack_about_release.py 24 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/pr_dependency_test.yml: -------------------------------------------------------------------------------- 1 | name: Run dependency tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - "src/diffusers/**.py" 9 | push: 10 | branches: 11 | - main 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | check_dependencies: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Set up Python 23 | uses: actions/setup-python@v4 24 | with: 25 | python-version: "3.8" 26 | - name: Install dependencies 27 | run: | 28 | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" 29 | python -m pip install --upgrade pip uv 30 | python -m uv pip install -e . 31 | python -m uv pip install pytest 32 | - name: Check for soft dependencies 33 | run: | 34 | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" 35 | pytest tests/others/test_dependencies.py 36 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/pr_flax_dependency_test.yml: -------------------------------------------------------------------------------- 1 | name: Run Flax dependency tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - "src/diffusers/**.py" 9 | push: 10 | branches: 11 | - main 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | check_flax_dependencies: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Set up Python 23 | uses: actions/setup-python@v4 24 | with: 25 | python-version: "3.8" 26 | - name: Install dependencies 27 | run: | 28 | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" 29 | python -m pip install --upgrade pip uv 30 | python -m uv pip install -e . 31 | python -m uv pip install "jax[cpu]>=0.2.16,!=0.3.2" 32 | python -m uv pip install "flax>=0.4.1" 33 | python -m uv pip install "jaxlib>=0.1.65" 34 | python -m uv pip install pytest 35 | - name: Check for soft dependencies 36 | run: | 37 | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" 38 | pytest tests/others/test_dependencies.py 39 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/pr_torch_dependency_test.yml: -------------------------------------------------------------------------------- 1 | name: Run Torch dependency tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - "src/diffusers/**.py" 9 | push: 10 | branches: 11 | - main 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | check_torch_dependencies: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Set up Python 23 | uses: actions/setup-python@v4 24 | with: 25 | python-version: "3.8" 26 | - name: Install dependencies 27 | run: | 28 | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" 29 | python -m pip install --upgrade pip uv 30 | python -m uv pip install -e . 31 | python -m uv pip install torch torchvision torchaudio 32 | python -m uv pip install pytest 33 | - name: Check for soft dependencies 34 | run: | 35 | python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" 36 | pytest tests/others/test_dependencies.py 37 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/ssh-pr-runner.yml: -------------------------------------------------------------------------------- 1 | name: SSH into PR runners 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | docker_image: 7 | description: 'Name of the Docker image' 8 | required: true 9 | 10 | env: 11 | IS_GITHUB_CI: "1" 12 | HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }} 13 | HF_HOME: /mnt/cache 14 | DIFFUSERS_IS_CI: yes 15 | OMP_NUM_THREADS: 8 16 | MKL_NUM_THREADS: 8 17 | RUN_SLOW: yes 18 | 19 | jobs: 20 | ssh_runner: 21 | name: "SSH" 22 | runs-on: 23 | group: aws-highmemory-32-plus 24 | container: 25 | image: ${{ github.event.inputs.docker_image }} 26 | options: --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface/diffusers:/mnt/cache/ --privileged 27 | 28 | steps: 29 | - name: Checkout diffusers 30 | uses: actions/checkout@v3 31 | with: 32 | fetch-depth: 2 33 | 34 | - name: Tailscale # In order to be able to SSH when a test fails 35 | uses: huggingface/tailscale-action@main 36 | with: 37 | authkey: ${{ secrets.TAILSCALE_SSH_AUTHKEY }} 38 | slackChannel: ${{ secrets.SLACK_CIFEEDBACK_CHANNEL }} 39 | slackToken: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }} 40 | waitForSSH: true 41 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/ssh-runner.yml: -------------------------------------------------------------------------------- 1 | name: SSH into GPU runners 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | runner_type: 7 | description: 'Type of runner to test (aws-g6-4xlarge-plus: a10 or aws-g4dn-2xlarge: t4)' 8 | type: choice 9 | required: true 10 | options: 11 | - aws-g6-4xlarge-plus 12 | - aws-g4dn-2xlarge 13 | docker_image: 14 | description: 'Name of the Docker image' 15 | required: true 16 | 17 | env: 18 | IS_GITHUB_CI: "1" 19 | HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }} 20 | HF_HOME: /mnt/cache 21 | DIFFUSERS_IS_CI: yes 22 | OMP_NUM_THREADS: 8 23 | MKL_NUM_THREADS: 8 24 | RUN_SLOW: yes 25 | 26 | jobs: 27 | ssh_runner: 28 | name: "SSH" 29 | runs-on: 30 | group: "${{ github.event.inputs.runner_type }}" 31 | container: 32 | image: ${{ github.event.inputs.docker_image }} 33 | options: --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface/diffusers:/mnt/cache/ --gpus 0 --privileged 34 | 35 | steps: 36 | - name: Checkout diffusers 37 | uses: actions/checkout@v3 38 | with: 39 | fetch-depth: 2 40 | 41 | - name: NVIDIA-SMI 42 | run: | 43 | nvidia-smi 44 | 45 | - name: Tailscale # In order to be able to SSH when a test fails 46 | uses: huggingface/tailscale-action@main 47 | with: 48 | authkey: ${{ secrets.TAILSCALE_SSH_AUTHKEY }} 49 | slackChannel: ${{ secrets.SLACK_CIFEEDBACK_CHANNEL }} 50 | slackToken: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }} 51 | waitForSSH: true 52 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Stale Bot 2 | 3 | on: 4 | schedule: 5 | - cron: "0 15 * * *" 6 | 7 | jobs: 8 | close_stale_issues: 9 | name: Close Stale Issues 10 | if: github.repository == 'huggingface/diffusers' 11 | runs-on: ubuntu-latest 12 | permissions: 13 | issues: write 14 | pull-requests: write 15 | env: 16 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Setup Python 21 | uses: actions/setup-python@v1 22 | with: 23 | python-version: 3.8 24 | 25 | - name: Install requirements 26 | run: | 27 | pip install PyGithub 28 | - name: Close stale issues 29 | run: | 30 | python utils/stale.py 31 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/trufflehog.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | 4 | name: Secret Leaks 5 | 6 | jobs: 7 | trufflehog: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@v4 12 | with: 13 | fetch-depth: 0 14 | - name: Secret Scanning 15 | uses: trufflesecurity/trufflehog@main 16 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/typos.yml: -------------------------------------------------------------------------------- 1 | name: Check typos 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v3 12 | 13 | - name: typos-action 14 | uses: crate-ci/typos@v1.12.4 15 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/update_metadata.yml: -------------------------------------------------------------------------------- 1 | name: Update Diffusers metadata 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - update_diffusers_metadata* 9 | 10 | jobs: 11 | update_metadata: 12 | runs-on: ubuntu-22.04 13 | defaults: 14 | run: 15 | shell: bash -l {0} 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | 20 | - name: Setup environment 21 | run: | 22 | pip install --upgrade pip 23 | pip install datasets pandas 24 | pip install .[torch] 25 | 26 | - name: Update metadata 27 | env: 28 | HF_TOKEN: ${{ secrets.SAYAK_HF_TOKEN }} 29 | run: | 30 | python utils/update_metadata.py --commit_sha ${{ github.sha }} 31 | -------------------------------------------------------------------------------- /diffusers/.github/workflows/upload_pr_documentation.yml: -------------------------------------------------------------------------------- 1 | name: Upload PR Documentation 2 | 3 | on: 4 | workflow_run: 5 | workflows: ["Build PR Documentation"] 6 | types: 7 | - completed 8 | 9 | jobs: 10 | build: 11 | uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main 12 | with: 13 | package_name: diffusers 14 | secrets: 15 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }} 16 | comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }} 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include src/diffusers/utils/model_card_template.md 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/docker/diffusers-flax-cpu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.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-pip \ 21 | python3.10-venv && \ 22 | rm -rf /var/lib/apt/lists 23 | 24 | # make sure to use venv 25 | RUN python3.10 -m venv /opt/venv 26 | ENV PATH="/opt/venv/bin:$PATH" 27 | 28 | # pre-install the heavy dependencies (these can later be overridden by the deps from setup.py) 29 | # follow the instructions here: https://cloud.google.com/tpu/docs/run-in-container#train_a_jax_model_in_a_docker_container 30 | RUN python3 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \ 31 | python3 -m uv pip install --upgrade --no-cache-dir \ 32 | clu \ 33 | "jax[cpu]>=0.2.16,!=0.3.2" \ 34 | "flax>=0.4.1" \ 35 | "jaxlib>=0.1.65" && \ 36 | python3 -m uv pip install --no-cache-dir \ 37 | accelerate \ 38 | datasets \ 39 | hf-doc-builder \ 40 | huggingface-hub \ 41 | Jinja2 \ 42 | librosa \ 43 | numpy==1.26.4 \ 44 | scipy \ 45 | tensorboard \ 46 | transformers \ 47 | hf_transfer 48 | 49 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /diffusers/docker/diffusers-onnxruntime-cpu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.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-pip \ 21 | python3.10-venv && \ 22 | rm -rf /var/lib/apt/lists 23 | 24 | # make sure to use venv 25 | RUN python3.10 -m venv /opt/venv 26 | ENV PATH="/opt/venv/bin:$PATH" 27 | 28 | # pre-install the heavy dependencies (these can later be overridden by the deps from setup.py) 29 | RUN python3 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \ 30 | python3 -m uv pip install --no-cache-dir \ 31 | torch==2.1.2 \ 32 | torchvision==0.16.2 \ 33 | torchaudio==2.1.2 \ 34 | onnxruntime \ 35 | --extra-index-url https://download.pytorch.org/whl/cpu && \ 36 | python3 -m uv pip install --no-cache-dir \ 37 | accelerate \ 38 | datasets \ 39 | hf-doc-builder \ 40 | huggingface-hub \ 41 | Jinja2 \ 42 | librosa \ 43 | numpy==1.26.4 \ 44 | scipy \ 45 | tensorboard \ 46 | transformers \ 47 | hf_transfer 48 | 49 | CMD ["/bin/bash"] -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | ## IPAdapterMaskProcessor 28 | 29 | [[autodoc]] image_processor.IPAdapterMaskProcessor -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/docs/source/en/api/models/autoencoderkl_cogvideox.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | # AutoencoderKLCogVideoX 13 | 14 | The 3D variational autoencoder (VAE) model with KL loss used in [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 AutoencoderKLCogVideoX 20 | 21 | vae = AutoencoderKLCogVideoX.from_pretrained("THUDM/CogVideoX-2b", subfolder="vae", torch_dtype=torch.float16).to("cuda") 22 | ``` 23 | 24 | ## AutoencoderKLCogVideoX 25 | 26 | [[autodoc]] AutoencoderKLCogVideoX 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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__ -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/docs/source/en/imgs/access_request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/docs/source/en/imgs/access_request.png -------------------------------------------------------------------------------- /diffusers/docs/source/en/imgs/diffusers_library.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/docs/source/en/imgs/diffusers_library.jpg -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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: チュートリアル -------------------------------------------------------------------------------- /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 | さあ、「拡散」をはじめていきましょう!🧨 -------------------------------------------------------------------------------- /diffusers/docs/source/ko/in_translation.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # 번역중 14 | 15 | 열심히 번역을 진행중입니다. 조금만 기다려주세요. 16 | 감사합니다! -------------------------------------------------------------------------------- /diffusers/docs/source/ko/optimization/xformers.md: -------------------------------------------------------------------------------- 1 | 12 | 13 | # xFormers 설치하기 14 | 15 | 추론과 학습 모두에 [xFormers](https://github.com/facebookresearch/xformers)를 사용하는 것이 좋습니다. 16 | 자체 테스트로 어텐션 블록에서 수행된 최적화가 더 빠른 속도와 적은 메모리 소비를 확인했습니다. 17 | 18 | 2023년 1월에 출시된 xFormers 버전 '0.0.16'부터 사전 빌드된 pip wheel을 사용하여 쉽게 설치할 수 있습니다: 19 | 20 | ```bash 21 | pip install xformers 22 | ``` 23 | 24 | 25 | 26 | xFormers PIP 패키지에는 최신 버전의 PyTorch(xFormers 0.0.16에 1.13.1)가 필요합니다. 이전 버전의 PyTorch를 사용해야 하는 경우 [프로젝트 지침](https://github.com/facebookresearch/xformers#installing-xformers)의 소스를 사용해 xFormers를 설치하는 것이 좋습니다. 27 | 28 | 29 | 30 | xFormers를 설치하면, [여기](fp16#memory-efficient-attention)서 설명한 것처럼 'enable_xformers_memory_efficient_attention()'을 사용하여 추론 속도를 높이고 메모리 소비를 줄일 수 있습니다. 31 | 32 | 33 | 34 | [이 이슈](https://github.com/huggingface/diffusers/issues/2234#issuecomment-1416931212)에 따르면 xFormers `v0.0.16`에서 GPU를 사용한 학습(파인 튜닝 또는 Dreambooth)을 할 수 없습니다. 해당 문제가 발견되면. 해당 코멘트를 참고해 development 버전을 설치하세요. 35 | 36 | 37 | -------------------------------------------------------------------------------- /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을 시작해 보겠습니다! 🧨 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /diffusers/examples/controlnet/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | datasets 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/custom_diffusion/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate 2 | torchvision 3 | transformers>=4.25.1 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/instruct_pix2pix/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | transformers>=4.25.1 4 | datasets 5 | ftfy 6 | tensorboard -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/reinforcement_learning/README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | These examples show how to run [Diffuser](https://arxiv.org/abs/2205.09991) in Diffusers. 4 | There are two ways to use the script, `run_diffuser_locomotion.py`. 5 | 6 | The key option is a change of the variable `n_guide_steps`. 7 | When `n_guide_steps=0`, the trajectories are sampled from the diffusion model, but not fine-tuned to maximize reward in the environment. 8 | By default, `n_guide_steps=2` to match the original implementation. 9 | 10 | 11 | You will need some RL specific requirements to run the examples: 12 | 13 | ```sh 14 | pip install -f https://download.pytorch.org/whl/torch_stable.html \ 15 | free-mujoco-py \ 16 | einops \ 17 | gym==0.24.1 \ 18 | protobuf==3.20.1 \ 19 | git+https://github.com/rail-berkeley/d4rl.git \ 20 | mediapy \ 21 | Pillow==9.0.0 22 | ``` 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/research_projects/colossalai/requirement.txt: -------------------------------------------------------------------------------- 1 | diffusers 2 | torch 3 | torchvision 4 | ftfy 5 | tensorboard 6 | Jinja2 7 | transformers -------------------------------------------------------------------------------- /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 | ``` -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/research_projects/diffusion_orpo/requirements.txt: -------------------------------------------------------------------------------- 1 | datasets 2 | accelerate 3 | transformers 4 | torchvision 5 | wandb 6 | peft 7 | webdataset -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/research_projects/gligen/generated-images-100000-00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/examples/research_projects/gligen/generated-images-100000-00.png -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/research_projects/onnxruntime/unconditional_image_generation/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | datasets 4 | tensorboard -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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! -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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). -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /diffusers/examples/textual_inversion/README_sdxl.md: -------------------------------------------------------------------------------- 1 | ## Textual Inversion fine-tuning example for SDXL 2 | 3 | ```sh 4 | export MODEL_NAME="stabilityai/stable-diffusion-xl-base-1.0" 5 | export DATA_DIR="./cat" 6 | 7 | accelerate launch textual_inversion_sdxl.py \ 8 | --pretrained_model_name_or_path=$MODEL_NAME \ 9 | --train_data_dir=$DATA_DIR \ 10 | --learnable_property="object" \ 11 | --placeholder_token="" \ 12 | --initializer_token="toy" \ 13 | --mixed_precision="bf16" \ 14 | --resolution=768 \ 15 | --train_batch_size=1 \ 16 | --gradient_accumulation_steps=4 \ 17 | --max_train_steps=500 \ 18 | --learning_rate=5.0e-04 \ 19 | --scale_lr \ 20 | --lr_scheduler="constant" \ 21 | --lr_warmup_steps=0 \ 22 | --save_as_full_pipeline \ 23 | --output_dir="./textual_inversion_cat_sdxl" 24 | ``` 25 | 26 | Training of both text encoders is supported. 27 | 28 | ### Inference Example 29 | 30 | Once you have trained a model using above command, the inference can be done simply using the `StableDiffusionXLPipeline`. 31 | Make sure to include the `placeholder_token` in your prompt. 32 | 33 | ```python 34 | from diffusers import StableDiffusionXLPipeline 35 | import torch 36 | 37 | model_id = "./textual_inversion_cat_sdxl" 38 | pipe = StableDiffusionXLPipeline.from_pretrained(model_id,torch_dtype=torch.float16).to("cuda") 39 | 40 | prompt = "A backpack" 41 | 42 | image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0] 43 | image.save("cat-backpack.png") 44 | 45 | image = pipe(prompt="", prompt_2=prompt, num_inference_steps=50, guidance_scale=7.5).images[0] 46 | image.save("cat-backpack-prompt_2.png") 47 | ``` 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/examples/unconditional_image_generation/requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate>=0.16.0 2 | torchvision 3 | datasets 4 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /diffusers/examples/wuerstchen/text_to_image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/examples/wuerstchen/text_to_image/__init__.py -------------------------------------------------------------------------------- /diffusers/examples/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 | -------------------------------------------------------------------------------- /diffusers/examples/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/scripts/__init__.py -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /diffusers/src/diffusers/experimental/__init__.py: -------------------------------------------------------------------------------- 1 | from .rl import ValueGuidedRLPipeline 2 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/experimental/rl/__init__.py: -------------------------------------------------------------------------------- 1 | from .value_guided_sampling import ValueGuidedRLPipeline 2 | -------------------------------------------------------------------------------- /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). -------------------------------------------------------------------------------- /diffusers/src/diffusers/models/autoencoders/__init__.py: -------------------------------------------------------------------------------- 1 | from .autoencoder_asym_kl import AsymmetricAutoencoderKL 2 | from .autoencoder_kl import AutoencoderKL 3 | from .autoencoder_kl_cogvideox import AutoencoderKLCogVideoX 4 | from .autoencoder_kl_temporal_decoder import AutoencoderKLTemporalDecoder 5 | from .autoencoder_oobleck import AutoencoderOobleck 6 | from .autoencoder_tiny import AutoencoderTiny 7 | from .consistency_decoder_vae import ConsistencyDecoderVAE 8 | from .vq_model import VQModel 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 .stable_audio_transformer import StableAudioDiTModel 15 | from .t5_film_transformer import T5FilmDecoder 16 | from .transformer_2d import Transformer2DModel 17 | from .transformer_flux import FluxTransformer2DModel 18 | from .transformer_sd3 import SD3Transformer2DModel 19 | from .transformer_temporal import TransformerTemporalModel 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/pipelines/controlnet_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_controlnet"] = ["HunyuanDiTControlNetPipeline"] 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_controlnet import HunyuanDiTControlNetPipeline 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 7 | from ...utils import BaseOutput 8 | 9 | 10 | @dataclass 11 | class FluxPipelineOutput(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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/pipelines/stable_diffusion_diffedit/__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_stable_diffusion_diffedit"] = ["StableDiffusionDiffEditPipeline"] 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_stable_diffusion_diffedit import StableDiffusionDiffEditPipeline 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 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/pipelines/stable_diffusion_ldm3d/__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_stable_diffusion_ldm3d"] = ["StableDiffusionLDM3DPipeline"] 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_stable_diffusion_ldm3d import StableDiffusionLDM3DPipeline 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 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/pipelines/stable_diffusion_panorama/__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_stable_diffusion_panorama"] = ["StableDiffusionPanoramaPipeline"] 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_stable_diffusion_panorama import StableDiffusionPanoramaPipeline 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 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/pipelines/stable_diffusion_safe/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 | class StableDiffusionSafePipelineOutput(BaseOutput): 14 | """ 15 | Output class for Safe Stable Diffusion pipelines. 16 | 17 | Args: 18 | images (`List[PIL.Image.Image]` or `np.ndarray`) 19 | List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, 20 | num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline. 21 | nsfw_content_detected (`List[bool]`) 22 | List of flags denoting whether the corresponding generated image likely represents "not-safe-for-work" 23 | (nsfw) content, or `None` if safety checking could not be performed. 24 | images (`List[PIL.Image.Image]` or `np.ndarray`) 25 | List of denoised PIL images that were flagged by the safety checker any may contain "not-safe-for-work" 26 | (nsfw) content, or `None` if no safety check was performed or no images were flagged. 27 | applied_safety_concept (`str`) 28 | The safety concept that was applied for safety guidance, or `None` if safety guidance was disabled 29 | """ 30 | 31 | images: Union[List[PIL.Image.Image], np.ndarray] 32 | nsfw_content_detected: Optional[List[bool]] 33 | unsafe_images: Optional[Union[List[PIL.Image.Image], np.ndarray]] 34 | applied_safety_concept: Optional[str] 35 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/pipelines/stable_diffusion_sag/__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_stable_diffusion_sag"] = ["StableDiffusionSAGPipeline"] 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_stable_diffusion_sag import StableDiffusionSAGPipeline 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/src/diffusers/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/src/diffusers/py.typed -------------------------------------------------------------------------------- /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). -------------------------------------------------------------------------------- /diffusers/src/diffusers/schedulers/deprecated/__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_pt_objects # noqa F403 21 | 22 | _dummy_objects.update(get_objects_from_module(dummy_pt_objects)) 23 | else: 24 | _import_structure["scheduling_karras_ve"] = ["KarrasVeScheduler"] 25 | _import_structure["scheduling_sde_vp"] = ["ScoreSdeVpScheduler"] 26 | 27 | if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: 28 | try: 29 | if not is_torch_available(): 30 | raise OptionalDependencyNotAvailable() 31 | 32 | except OptionalDependencyNotAvailable: 33 | from ...utils.dummy_pt_objects import * # noqa F403 34 | else: 35 | from .scheduling_karras_ve import KarrasVeScheduler 36 | from .scheduling_sde_vp import ScoreSdeVpScheduler 37 | 38 | 39 | else: 40 | import sys 41 | 42 | sys.modules[__name__] = _LazyModule( 43 | __name__, 44 | globals()["__file__"], 45 | _import_structure, 46 | module_spec=__spec__, 47 | ) 48 | 49 | for name, value in _dummy_objects.items(): 50 | setattr(sys.modules[__name__], name, value) 51 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/fixtures/elise_format0.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/fixtures/elise_format0.mid -------------------------------------------------------------------------------- /diffusers/tests/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/models/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/models/autoencoders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/models/autoencoders/__init__.py -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/tests/models/transformers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/models/transformers/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/models/unets/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/models/unets/__init__.py -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/tests/pipelines/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/amused/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/amused/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/animatediff/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/animatediff/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/audioldm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/audioldm/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/audioldm2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/audioldm2/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/aura_flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/aura_flow/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/blipdiffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/blipdiffusion/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/cogvideo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/cogvideo/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/consistency_models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/consistency_models/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/controlnet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/controlnet/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/controlnet_flux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/controlnet_flux/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/controlnet_hunyuandit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/controlnet_hunyuandit/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/controlnet_sd3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/controlnet_sd3/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/controlnet_xs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/controlnet_xs/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/dance_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/dance_diffusion/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/ddim/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/ddim/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/ddpm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/ddpm/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/dit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/dit/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/flux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/flux/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/hunyuan_dit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/hunyuan_dit/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/i2vgen_xl/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/i2vgen_xl/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/kandinsky/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/kandinsky/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/kandinsky2_2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/kandinsky2_2/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/kandinsky3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/kandinsky3/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/kolors/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/kolors/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/latent_consistency_models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/latent_consistency_models/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/latent_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/latent_diffusion/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/latte/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/latte/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/ledits_pp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/ledits_pp/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/lumina/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/lumina/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/marigold/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/marigold/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/musicldm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/musicldm/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/pag/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/pag/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/paint_by_example/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/paint_by_example/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/pia/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/pia/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/pixart_alpha/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/pixart_alpha/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/pixart_sigma/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/pixart_sigma/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/pndm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/pndm/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/semantic_stable_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/semantic_stable_diffusion/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/shap_e/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/shap_e/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_audio/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_audio/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_cascade/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_cascade/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_2/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_3/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_adapter/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_adapter/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_gligen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_gligen/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_gligen_text_image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_gligen_text_image/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_image_variation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_image_variation/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_k_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_k_diffusion/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_ldm3d/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_ldm3d/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_panorama/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_panorama/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_safe/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_safe/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_sag/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_sag/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_diffusion_xl/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_diffusion_xl/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_unclip/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_unclip/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/stable_video_diffusion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/stable_video_diffusion/__init__.py -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /diffusers/tests/pipelines/text_to_video_synthesis/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/text_to_video_synthesis/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/unclip/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/unclip/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/unidiffuser/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/unidiffuser/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/pipelines/wuerstchen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/pipelines/wuerstchen/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/schedulers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/schedulers/__init__.py -------------------------------------------------------------------------------- /diffusers/tests/single_file/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YesianRohn/TextSSR/30d5291e1d6b721924b3d6a91dab110605a4f713/diffusers/tests/single_file/__init__.py -------------------------------------------------------------------------------- /diffusers/utils/get_modified_files.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | # Copyright 2024 The HuggingFace Inc. team. 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 | # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: 17 | # python ./utils/get_modified_files.py utils src tests examples 18 | # 19 | # it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered 20 | # since the output of this script is fed into Makefile commands it doesn't print a newline after the results 21 | 22 | import re 23 | import subprocess 24 | import sys 25 | 26 | 27 | fork_point_sha = subprocess.check_output("git merge-base main HEAD".split()).decode("utf-8") 28 | modified_files = subprocess.check_output(f"git diff --name-only {fork_point_sha}".split()).decode("utf-8").split() 29 | 30 | joined_dirs = "|".join(sys.argv[1:]) 31 | regex = re.compile(rf"^({joined_dirs}).*?\.py$") 32 | 33 | relevant_modified_files = [x for x in modified_files if regex.match(x)] 34 | print(" ".join(relevant_modified_files), end="") 35 | -------------------------------------------------------------------------------- /diffusers/utils/print_env.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # coding=utf-8 4 | # Copyright 2024 The HuggingFace Inc. team. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # this script dumps information about the environment 19 | 20 | import os 21 | import platform 22 | import sys 23 | 24 | 25 | os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" 26 | 27 | print("Python version:", sys.version) 28 | 29 | print("OS platform:", platform.platform()) 30 | print("OS architecture:", platform.machine()) 31 | 32 | try: 33 | import torch 34 | 35 | print("Torch version:", torch.__version__) 36 | print("Cuda available:", torch.cuda.is_available()) 37 | print("Cuda version:", torch.version.cuda) 38 | print("CuDNN version:", torch.backends.cudnn.version()) 39 | print("Number of GPUs available:", torch.cuda.device_count()) 40 | except ImportError: 41 | print("Torch version:", None) 42 | 43 | try: 44 | import transformers 45 | 46 | print("transformers version:", transformers.__version__) 47 | except ImportError: 48 | print("transformers version:", None) 49 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | lmdb 2 | transformers 3 | datasets 4 | accelerate 5 | mmengine 6 | timm 7 | opencv-python 8 | ujson 9 | Pillow==9.5 --------------------------------------------------------------------------------