Datasets:

ArXiv:
diffusers-benchmarking-bot commited on
Commit
e73e60b
·
verified ·
1 Parent(s): 6e953e6

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. main/README.md +36 -36
  2. main/adaptive_mask_inpainting.py +3 -3
  3. main/bit_diffusion.py +7 -7
  4. main/clip_guided_images_mixing_stable_diffusion.py +3 -3
  5. main/clip_guided_stable_diffusion.py +3 -3
  6. main/clip_guided_stable_diffusion_img2img.py +3 -3
  7. main/cogvideox_ddim_inversion.py +1 -1
  8. main/composable_stable_diffusion.py +5 -5
  9. main/fresco_v2v.py +4 -4
  10. main/gluegen.py +6 -6
  11. main/iadb.py +1 -1
  12. main/imagic_stable_diffusion.py +9 -9
  13. main/img2img_inpainting.py +5 -5
  14. main/instaflow_one_step.py +5 -5
  15. main/interpolate_stable_diffusion.py +8 -8
  16. main/ip_adapter_face_id.py +6 -6
  17. main/latent_consistency_img2img.py +2 -2
  18. main/latent_consistency_interpolate.py +1 -1
  19. main/latent_consistency_txt2img.py +2 -2
  20. main/llm_grounded_diffusion.py +9 -9
  21. main/lpw_stable_diffusion.py +14 -14
  22. main/lpw_stable_diffusion_onnx.py +14 -14
  23. main/lpw_stable_diffusion_xl.py +9 -9
  24. main/masked_stable_diffusion_img2img.py +2 -2
  25. main/masked_stable_diffusion_xl_img2img.py +2 -2
  26. main/matryoshka.py +14 -14
  27. main/mixture_tiling.py +2 -2
  28. main/mixture_tiling_sdxl.py +6 -6
  29. main/mod_controlnet_tile_sr_sdxl.py +5 -5
  30. main/multilingual_stable_diffusion.py +5 -5
  31. main/pipeline_animatediff_controlnet.py +3 -3
  32. main/pipeline_animatediff_img2video.py +3 -3
  33. main/pipeline_animatediff_ipex.py +3 -3
  34. main/pipeline_controlnet_xl_kolors.py +5 -5
  35. main/pipeline_controlnet_xl_kolors_img2img.py +5 -5
  36. main/pipeline_controlnet_xl_kolors_inpaint.py +5 -5
  37. main/pipeline_demofusion_sdxl.py +11 -11
  38. main/pipeline_faithdiff_stable_diffusion_xl.py +9 -9
  39. main/pipeline_flux_differential_img2img.py +2 -2
  40. main/pipeline_flux_rf_inversion.py +7 -7
  41. main/pipeline_flux_semantic_guidance.py +2 -2
  42. main/pipeline_flux_with_cfg.py +2 -2
  43. main/pipeline_hunyuandit_differential_img2img.py +6 -6
  44. main/pipeline_kolors_differential_img2img.py +5 -5
  45. main/pipeline_kolors_inpainting.py +7 -7
  46. main/pipeline_prompt2prompt.py +8 -8
  47. main/pipeline_sdxl_style_aligned.py +12 -12
  48. main/pipeline_stable_diffusion_3_differential_img2img.py +3 -3
  49. main/pipeline_stable_diffusion_3_instruct_pix2pix.py +3 -3
  50. main/pipeline_stable_diffusion_boxdiff.py +7 -7
main/README.md CHANGED
@@ -10,7 +10,7 @@ Please also check out our [Community Scripts](https://github.com/huggingface/dif
10
 
11
  | Example | Description | Code Example | Colab | Author |
12
  |:--------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------:|
13
- |Spatiotemporal Skip Guidance (STG)|[Spatiotemporal Skip Guidance for Enhanced Video Diffusion Sampling](https://arxiv.org/abs/2411.18664) (CVPR 2025) enhances video diffusion models by generating a weaker model through layer skipping and using it as guidance, improving fidelity in models like HunyuanVideo, LTXVideo, and Mochi.|[Spatiotemporal Skip Guidance](#spatiotemporal-skip-guidance)|-|[Junha Hyung](https://junhahyung.github.io/), [Kinam Kim](https://kinam0252.github.io/), and [Ednaordinary](https://github.com/Ednaordinary)|
14
  |Adaptive Mask Inpainting|Adaptive Mask Inpainting algorithm from [Beyond the Contact: Discovering Comprehensive Affordance for 3D Objects from Pre-trained 2D Diffusion Models](https://github.com/snuvclab/coma) (ECCV '24, Oral) provides a way to insert human inside the scene image without altering the background, by inpainting with adapting mask.|[Adaptive Mask Inpainting](#adaptive-mask-inpainting)|-|[Hyeonwoo Kim](https://sshowbiz.xyz),[Sookwan Han](https://jellyheadandrew.github.io)|
15
  |Flux with CFG|[Flux with CFG](https://github.com/ToTheBeginning/PuLID/blob/main/docs/pulid_for_flux.md) provides an implementation of using CFG in [Flux](https://blackforestlabs.ai/announcing-black-forest-labs/).|[Flux with CFG](#flux-with-cfg)|[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/flux_with_cfg.ipynb)|[Linoy Tsaban](https://github.com/linoytsaban), [Apolinário](https://github.com/apolinario), and [Sayak Paul](https://github.com/sayakpaul)|
16
  |Differential Diffusion|[Differential Diffusion](https://github.com/exx8/differential-diffusion) modifies an image according to a text prompt, and according to a map that specifies the amount of change in each region.|[Differential Diffusion](#differential-diffusion)|[![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/exx8/differential-diffusion) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/exx8/differential-diffusion/blob/main/examples/SD2.ipynb)|[Eran Levin](https://github.com/exx8) and [Ohad Fried](https://www.ohadf.com/)|
@@ -39,17 +39,17 @@ Please also check out our [Community Scripts](https://github.com/huggingface/dif
39
  | Stable UnCLIP | Diffusion Pipeline for combining prior model (generate clip image embedding from text, UnCLIPPipeline `"kakaobrain/karlo-v1-alpha"`) and decoder pipeline (decode clip image embedding to image, StableDiffusionImageVariationPipeline `"lambdalabs/sd-image-variations-diffusers"` ). | [Stable UnCLIP](#stable-unclip) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/stable_unclip.ipynb) | [Ray Wang](https://wrong.wang) |
40
  | UnCLIP Text Interpolation Pipeline | Diffusion Pipeline that allows passing two prompts and produces images while interpolating between the text-embeddings of the two prompts | [UnCLIP Text Interpolation Pipeline](#unclip-text-interpolation-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/unclip_text_interpolation.ipynb)| [Naga Sai Abhinay Devarinti](https://github.com/Abhinay1997/) |
41
  | UnCLIP Image Interpolation Pipeline | Diffusion Pipeline that allows passing two images/image_embeddings and produces images while interpolating between their image-embeddings | [UnCLIP Image Interpolation Pipeline](#unclip-image-interpolation-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/unclip_image_interpolation.ipynb)| [Naga Sai Abhinay Devarinti](https://github.com/Abhinay1997/) |
42
- | DDIM Noise Comparative Analysis Pipeline | Investigating how the diffusion models learn visual concepts from each noise level (which is a contribution of [P2 weighting (CVPR 2022)](https://arxiv.org/abs/2204.00227)) | [DDIM Noise Comparative Analysis Pipeline](#ddim-noise-comparative-analysis-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/ddim_noise_comparative_analysis.ipynb)| [Aengus (Duc-Anh)](https://github.com/aengusng8) |
43
  | CLIP Guided Img2Img Stable Diffusion Pipeline | Doing CLIP guidance for image to image generation with Stable Diffusion | [CLIP Guided Img2Img Stable Diffusion](#clip-guided-img2img-stable-diffusion) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/clip_guided_img2img_stable_diffusion.ipynb) | [Nipun Jindal](https://github.com/nipunjindal/) |
44
  | TensorRT Stable Diffusion Text to Image Pipeline | Accelerates the Stable Diffusion Text2Image Pipeline using TensorRT | [TensorRT Stable Diffusion Text to Image Pipeline](#tensorrt-text2image-stable-diffusion-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/tensorrt_text2image_stable_diffusion_pipeline.ipynb) | [Asfiya Baig](https://github.com/asfiyab-nvidia) |
45
  | EDICT Image Editing Pipeline | Diffusion pipeline for text-guided image editing | [EDICT Image Editing Pipeline](#edict-image-editing-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/edict_image_pipeline.ipynb) | [Joqsan Azocar](https://github.com/Joqsan) |
46
- | Stable Diffusion RePaint | Stable Diffusion pipeline using [RePaint](https://arxiv.org/abs/2201.09865) for inpainting. | [Stable Diffusion RePaint](#stable-diffusion-repaint )|[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/stable_diffusion_repaint.ipynb)| [Markus Pobitzer](https://github.com/Markus-Pobitzer) |
47
  | TensorRT Stable Diffusion Image to Image Pipeline | Accelerates the Stable Diffusion Image2Image Pipeline using TensorRT | [TensorRT Stable Diffusion Image to Image Pipeline](#tensorrt-image2image-stable-diffusion-pipeline) | - | [Asfiya Baig](https://github.com/asfiyab-nvidia) |
48
  | Stable Diffusion IPEX Pipeline | Accelerate Stable Diffusion inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [Stable Diffusion on IPEX](#stable-diffusion-on-ipex) | - | [Yingjie Han](https://github.com/yingjie-han/) |
49
  | CLIP Guided Images Mixing Stable Diffusion Pipeline | Сombine images using usual diffusion models. | [CLIP Guided Images Mixing Using Stable Diffusion](#clip-guided-images-mixing-with-stable-diffusion) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/clip_guided_images_mixing_with_stable_diffusion.ipynb) | [Karachev Denis](https://github.com/TheDenk) |
50
  | TensorRT Stable Diffusion Inpainting Pipeline | Accelerates the Stable Diffusion Inpainting Pipeline using TensorRT | [TensorRT Stable Diffusion Inpainting Pipeline](#tensorrt-inpainting-stable-diffusion-pipeline) | - | [Asfiya Baig](https://github.com/asfiyab-nvidia) |
51
- | IADB Pipeline | Implementation of [Iterative α-(de)Blending: a Minimalist Deterministic Diffusion Model](https://arxiv.org/abs/2305.03486) | [IADB Pipeline](#iadb-pipeline) | - | [Thomas Chambon](https://github.com/tchambon)
52
- | Zero1to3 Pipeline | Implementation of [Zero-1-to-3: Zero-shot One Image to 3D Object](https://arxiv.org/abs/2303.11328) | [Zero1to3 Pipeline](#zero1to3-pipeline) | - | [Xin Kong](https://github.com/kxhit) |
53
  | Stable Diffusion XL Long Weighted Prompt Pipeline | A pipeline support unlimited length of prompt and negative prompt, use A1111 style of prompt weighting | [Stable Diffusion XL Long Weighted Prompt Pipeline](#stable-diffusion-xl-long-weighted-prompt-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1LsqilswLR40XLLcp6XFOl5nKb_wOe26W?usp=sharing) | [Andrew Zhu](https://xhinker.medium.com/) |
54
  | Stable Diffusion Mixture Tiling Pipeline SD 1.5 | A pipeline generates cohesive images by integrating multiple diffusion processes, each focused on a specific image region and considering boundary effects for smooth blending | [Stable Diffusion Mixture Tiling Pipeline SD 1.5](#stable-diffusion-mixture-tiling-pipeline-sd-15) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/albarji/mixture-of-diffusers) | [Álvaro B Jiménez](https://github.com/albarji/) |
55
  | Stable Diffusion Mixture Canvas Pipeline SD 1.5 | A pipeline generates cohesive images by integrating multiple diffusion processes, each focused on a specific image region and considering boundary effects for smooth blending. Works by defining a list of Text2Image region objects that detail the region of influence of each diffuser. | [Stable Diffusion Mixture Canvas Pipeline SD 1.5](#stable-diffusion-mixture-canvas-pipeline-sd-15) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/albarji/mixture-of-diffusers) | [Álvaro B Jiménez](https://github.com/albarji/) |
@@ -59,25 +59,25 @@ Please also check out our [Community Scripts](https://github.com/huggingface/dif
59
  | sketch inpaint - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion Pipeline](#stable-diffusion-masked-im2im) | - | [Anatoly Belikov](https://github.com/noskill) |
60
  | sketch inpaint xl - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion XL Pipeline](#stable-diffusion-xl-masked-im2im) | - | [Anatoly Belikov](https://github.com/noskill) |
61
  | prompt-to-prompt | change parts of a prompt and retain image structure (see [paper page](https://prompt-to-prompt.github.io/)) | [Prompt2Prompt Pipeline](#prompt2prompt-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/prompt_2_prompt_pipeline.ipynb) | [Umer H. Adil](https://twitter.com/UmerHAdil) |
62
- | Latent Consistency Pipeline | Implementation of [Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference](https://arxiv.org/abs/2310.04378) | [Latent Consistency Pipeline](#latent-consistency-pipeline) | - | [Simian Luo](https://github.com/luosiallen) |
63
  | Latent Consistency Img2img Pipeline | Img2img pipeline for Latent Consistency Models | [Latent Consistency Img2Img Pipeline](#latent-consistency-img2img-pipeline) | - | [Logan Zoellner](https://github.com/nagolinc) |
64
  | Latent Consistency Interpolation Pipeline | Interpolate the latent space of Latent Consistency Models with multiple prompts | [Latent Consistency Interpolation Pipeline](#latent-consistency-interpolation-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1pK3NrLWJSiJsBynLns1K1-IDTW9zbPvl?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) |
65
  | SDE Drag Pipeline | The pipeline supports drag editing of images using stochastic differential equations | [SDE Drag Pipeline](#sde-drag-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/sde_drag.ipynb) | [NieShen](https://github.com/NieShenRuc) [Fengqi Zhu](https://github.com/Monohydroxides) |
66
  | Regional Prompting Pipeline | Assign multiple prompts for different regions | [Regional Prompting Pipeline](#regional-prompting-pipeline) | - | [hako-mikan](https://github.com/hako-mikan) |
67
  | LDM3D-sr (LDM3D upscaler) | Upscale low resolution RGB and depth inputs to high resolution | [StableDiffusionUpscaleLDM3D Pipeline](https://github.com/estelleafl/diffusers/tree/ldm3d_upscaler_community/examples/community#stablediffusionupscaleldm3d-pipeline) | - | [Estelle Aflalo](https://github.com/estelleafl) |
68
  | AnimateDiff ControlNet Pipeline | Combines AnimateDiff with precise motion control using ControlNets | [AnimateDiff ControlNet Pipeline](#animatediff-controlnet-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1SKboYeGjEQmQPWoFC0aLYpBlYdHXkvAu?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) and [Edoardo Botta](https://github.com/EdoardoBotta) |
69
- | DemoFusion Pipeline | Implementation of [DemoFusion: Democratising High-Resolution Image Generation With No $$$](https://arxiv.org/abs/2311.16973) | [DemoFusion Pipeline](#demofusion) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/demo_fusion.ipynb) | [Ruoyi Du](https://github.com/RuoyiDu) |
70
- | Instaflow Pipeline | Implementation of [InstaFlow! One-Step Stable Diffusion with Rectified Flow](https://arxiv.org/abs/2309.06380) | [Instaflow Pipeline](#instaflow-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/insta_flow.ipynb) | [Ayush Mangal](https://github.com/ayushtues) |
71
- | Null-Text Inversion Pipeline | Implement [Null-text Inversion for Editing Real Images using Guided Diffusion Models](https://arxiv.org/abs/2211.09794) as a pipeline. | [Null-Text Inversion](https://github.com/google/prompt-to-prompt/) | - | [Junsheng Luan](https://github.com/Junsheng121) |
72
- | Rerender A Video Pipeline | Implementation of [[SIGGRAPH Asia 2023] Rerender A Video: Zero-Shot Text-Guided Video-to-Video Translation](https://arxiv.org/abs/2306.07954) | [Rerender A Video Pipeline](#rerender-a-video) | - | [Yifan Zhou](https://github.com/SingleZombie) |
73
- | StyleAligned Pipeline | Implementation of [Style Aligned Image Generation via Shared Attention](https://arxiv.org/abs/2312.02133) | [StyleAligned Pipeline](#stylealigned-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://drive.google.com/file/d/15X2E0jFPTajUIjS0FzX50OaHsCbP2lQ0/view?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) |
74
  | AnimateDiff Image-To-Video Pipeline | Experimental Image-To-Video support for AnimateDiff (open to improvements) | [AnimateDiff Image To Video Pipeline](#animatediff-image-to-video-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://drive.google.com/file/d/1TvzCDPHhfFtdcJZe4RLloAwyoLKuttWK/view?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) |
75
  | IP Adapter FaceID Stable Diffusion | Stable Diffusion Pipeline that supports IP Adapter Face ID | [IP Adapter Face ID](#ip-adapter-face-id) |[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/ip_adapter_face_id.ipynb)| [Fabio Rigano](https://github.com/fabiorigano) |
76
  | InstantID Pipeline | Stable Diffusion XL Pipeline that supports InstantID | [InstantID Pipeline](#instantid-pipeline) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/InstantX/InstantID) | [Haofan Wang](https://github.com/haofanwang) |
77
  | UFOGen Scheduler | Scheduler for UFOGen Model (compatible with Stable Diffusion pipelines) | [UFOGen Scheduler](#ufogen-scheduler) | - | [dg845](https://github.com/dg845) |
78
  | Stable Diffusion XL IPEX Pipeline | Accelerate Stable Diffusion XL inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [Stable Diffusion XL on IPEX](#stable-diffusion-xl-on-ipex) | - | [Dan Li](https://github.com/ustcuna/) |
79
  | Stable Diffusion BoxDiff Pipeline | Training-free controlled generation with bounding boxes using [BoxDiff](https://github.com/showlab/BoxDiff) | [Stable Diffusion BoxDiff Pipeline](#stable-diffusion-boxdiff) | - | [Jingyang Zhang](https://github.com/zjysteven/) |
80
- | FRESCO V2V Pipeline | Implementation of [[CVPR 2024] FRESCO: Spatial-Temporal Correspondence for Zero-Shot Video Translation](https://arxiv.org/abs/2403.12962) | [FRESCO V2V Pipeline](#fresco) | - | [Yifan Zhou](https://github.com/SingleZombie) |
81
  | AnimateDiff IPEX Pipeline | Accelerate AnimateDiff inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [AnimateDiff on IPEX](#animatediff-on-ipex) | - | [Dan Li](https://github.com/ustcuna/) |
82
  PIXART-α Controlnet pipeline | Implementation of the controlnet model for pixart alpha and its diffusers pipeline | [PIXART-α Controlnet pipeline](#pixart-α-controlnet-pipeline) | - | [Raul Ciotescu](https://github.com/raulc0399/) |
83
  | HunyuanDiT Differential Diffusion Pipeline | Applies [Differential Diffusion](https://github.com/exx8/differential-diffusion) to [HunyuanDiT](https://github.com/huggingface/diffusers/pull/8240). | [HunyuanDiT with Differential Diffusion](#hunyuandit-with-differential-diffusion) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1v44a5fpzyr4Ffr4v2XBQ7BajzG874N4P?usp=sharing) | [Monjoy Choudhury](https://github.com/MnCSSJ4x) |
@@ -85,7 +85,7 @@ PIXART-α Controlnet pipeline | Implementation of the controlnet model for pixar
85
  | Stable Diffusion XL Attentive Eraser Pipeline |[[AAAI2025 Oral] Attentive Eraser](https://github.com/Anonym0u3/AttentiveEraser) is a novel tuning-free method that enhances object removal capabilities in pre-trained diffusion models.|[Stable Diffusion XL Attentive Eraser Pipeline](#stable-diffusion-xl-attentive-eraser-pipeline)|-|[Wenhao Sun](https://github.com/Anonym0u3) and [Benlei Cui](https://github.com/Benny079)|
86
  | Perturbed-Attention Guidance |StableDiffusionPAGPipeline is a modification of StableDiffusionPipeline to support Perturbed-Attention Guidance (PAG).|[Perturbed-Attention Guidance](#perturbed-attention-guidance)|[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/perturbed_attention_guidance.ipynb)|[Hyoungwon Cho](https://github.com/HyoungwonCho)|
87
  | CogVideoX DDIM Inversion Pipeline | Implementation of DDIM inversion and guided attention-based editing denoising process on CogVideoX. | [CogVideoX DDIM Inversion Pipeline](#cogvideox-ddim-inversion-pipeline) | - | [LittleNyima](https://github.com/LittleNyima) |
88
- | FaithDiff Stable Diffusion XL Pipeline | Implementation of [(CVPR 2025) FaithDiff: Unleashing Diffusion Priors for Faithful Image Super-resolutionUnleashing Diffusion Priors for Faithful Image Super-resolution](https://arxiv.org/abs/2411.18824) - FaithDiff is a faithful image super-resolution method that leverages latent diffusion models by actively adapting the diffusion prior and jointly fine-tuning its components (encoder and diffusion model) with an alignment module to ensure high fidelity and structural consistency. | [FaithDiff Stable Diffusion XL Pipeline](#faithdiff-stable-diffusion-xl-pipeline) | [![Hugging Face Models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/jychen9811/FaithDiff) | [Junyang Chen, Jinshan Pan, Jiangxin Dong, IMAG Lab, (Adapted by Eliseu Silva)](https://github.com/JyChen9811/FaithDiff) |
89
  | Stable Diffusion 3 InstructPix2Pix Pipeline | Implementation of Stable Diffusion 3 InstructPix2Pix Pipeline | [Stable Diffusion 3 InstructPix2Pix Pipeline](#stable-diffusion-3-instructpix2pix-pipeline) | [![Hugging Face Models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/BleachNick/SD3_UltraEdit_freeform) [![Hugging Face Models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/CaptainZZZ/sd3-instructpix2pix) | [Jiayu Zhang](https://github.com/xduzhangjiayu) and [Haozhe Zhao](https://github.com/HaozheZhao)|
90
  To load a custom pipeline you just need to pass the `custom_pipeline` argument to `DiffusionPipeline`, as one of the files in `diffusers/examples/community`. Feel free to send a PR with your own pipelines, we will merge them quickly.
91
 
@@ -101,7 +101,7 @@ pipe = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion
101
 
102
  **KAIST AI, University of Washington**
103
 
104
- [*Spatiotemporal Skip Guidance (STG) for Enhanced Video Diffusion Sampling*](https://arxiv.org/abs/2411.18664) (CVPR 2025) is a simple training-free sampling guidance method for enhancing transformer-based video diffusion models. STG employs an implicit weak model via self-perturbation, avoiding the need for external models or additional training. By selectively skipping spatiotemporal layers, STG produces an aligned, degraded version of the original model to boost sample quality without compromising diversity or dynamic degree.
105
 
106
  Following is the example video of STG applied to Mochi.
107
 
@@ -161,7 +161,7 @@ Here is the demonstration of Adaptive Mask Inpainting:
161
  ![teaser-img](https://snuvclab.github.io/coma/static/images/example_result_adaptive_mask_inpainting.png)
162
 
163
 
164
- You can find additional information about Adaptive Mask Inpainting in the [paper](https://arxiv.org/pdf/2401.12978) or in the [project website](https://snuvclab.github.io/coma).
165
 
166
  #### Usage example
167
  First, clone the diffusers github repository, and run the following command to set environment.
@@ -413,7 +413,7 @@ image.save("result.png")
413
 
414
  ### HD-Painter
415
 
416
- Implementation of [HD-Painter: High-Resolution and Prompt-Faithful Text-Guided Image Inpainting with Diffusion Models](https://arxiv.org/abs/2312.14091).
417
 
418
  ![teaser-img](https://raw.githubusercontent.com/Picsart-AI-Research/HD-Painter/main/__assets__/github/teaser.jpg)
419
 
@@ -428,7 +428,7 @@ Moreover, HD-Painter allows extension to larger scales by introducing a speciali
428
  Our experiments demonstrate that HD-Painter surpasses existing state-of-the-art approaches qualitatively and quantitatively, achieving an impressive generation accuracy improvement of **61.4** vs **51.9**.
429
  We will make the codes publicly available.
430
 
431
- You can find additional information about Text2Video-Zero in the [paper](https://arxiv.org/abs/2312.14091) or the [original codebase](https://github.com/Picsart-AI-Research/HD-Painter).
432
 
433
  #### Usage example
434
 
@@ -1362,7 +1362,7 @@ print("Inpainting completed. Image saved as 'inpainting_output.png'.")
1362
 
1363
  ### Bit Diffusion
1364
 
1365
- Based <https://arxiv.org/abs/2208.04202>, this is used for diffusion on discrete data - eg, discrete image data, DNA sequence data. An unconditional discrete image can be generated like this:
1366
 
1367
  ```python
1368
  from diffusers import DiffusionPipeline
@@ -1523,7 +1523,7 @@ As a result, you can look at a grid of all 4 generated images being shown togeth
1523
 
1524
  ### Magic Mix
1525
 
1526
- Implementation of the [MagicMix: Semantic Mixing with Diffusion Models](https://arxiv.org/abs/2210.16056) paper. This is a Diffusion Pipeline for semantic mixing of an image and a text prompt to create a new concept while preserving the spatial layout and geometry of the subject in the image. The pipeline takes an image that provides the layout semantics and a prompt that provides the content semantics for the mixing process.
1527
 
1528
  There are 3 parameters for the method-
1529
 
@@ -1754,7 +1754,7 @@ The resulting images in order:-
1754
 
1755
  #### **Research question: What visual concepts do the diffusion models learn from each noise level during training?**
1756
 
1757
- The [P2 weighting (CVPR 2022)](https://arxiv.org/abs/2204.00227) paper proposed an approach to answer the above question, which is their second contribution.
1758
  The approach consists of the following steps:
1759
 
1760
  1. The input is an image x0.
@@ -1896,7 +1896,7 @@ image.save('tensorrt_mt_fuji.png')
1896
 
1897
  ### EDICT Image Editing Pipeline
1898
 
1899
- This pipeline implements the text-guided image editing approach from the paper [EDICT: Exact Diffusion Inversion via Coupled Transformations](https://arxiv.org/abs/2211.12446). You have to pass:
1900
 
1901
  - (`PIL`) `image` you want to edit.
1902
  - `base_prompt`: the text prompt describing the current image (before editing).
@@ -1981,7 +1981,7 @@ Output Image
1981
 
1982
  ### Stable Diffusion RePaint
1983
 
1984
- This pipeline uses the [RePaint](https://arxiv.org/abs/2201.09865) logic on the latent space of stable diffusion. It can
1985
  be used similarly to other image inpainting pipelines but does not rely on a specific inpainting model. This means you can use
1986
  models that are not specifically created for inpainting.
1987
 
@@ -2576,7 +2576,7 @@ For more results, checkout [PR #6114](https://github.com/huggingface/diffusers/p
2576
 
2577
  ### Stable Diffusion Mixture Tiling Pipeline SD 1.5
2578
 
2579
- This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2580
 
2581
  ```python
2582
  from diffusers import LMSDiscreteScheduler, DiffusionPipeline
@@ -2607,7 +2607,7 @@ image = pipeline(
2607
 
2608
  ### Stable Diffusion Mixture Canvas Pipeline SD 1.5
2609
 
2610
- This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2611
 
2612
  ```python
2613
  from PIL import Image
@@ -2642,7 +2642,7 @@ output = pipeline(
2642
 
2643
  ### Stable Diffusion Mixture Tiling Pipeline SDXL
2644
 
2645
- This pipeline uses the Mixture. Refer to the [Mixture](https://arxiv.org/abs/2302.02412) paper for more details.
2646
 
2647
  ```python
2648
  import torch
@@ -2696,7 +2696,7 @@ image = pipe(
2696
 
2697
  ### Stable Diffusion MoD ControlNet Tile SR Pipeline SDXL
2698
 
2699
- This pipeline implements the [MoD (Mixture-of-Diffusers)]("https://arxiv.org/pdf/2408.06072") tiled diffusion technique and combines it with SDXL's ControlNet Tile process to generate SR images.
2700
 
2701
  This works better with 4x scales, but you can try adjusts parameters to higher scales.
2702
 
@@ -2835,7 +2835,7 @@ image.save('tensorrt_inpaint_mecha_robot.png')
2835
 
2836
  ### IADB pipeline
2837
 
2838
- This pipeline is the implementation of the [α-(de)Blending: a Minimalist Deterministic Diffusion Model](https://arxiv.org/abs/2305.03486) paper.
2839
  It is a simple and minimalist diffusion model.
2840
 
2841
  The following code shows how to use the IADB pipeline to generate images using a pretrained celebahq-256 model.
@@ -2888,7 +2888,7 @@ while True:
2888
 
2889
  ### Zero1to3 pipeline
2890
 
2891
- This pipeline is the implementation of the [Zero-1-to-3: Zero-shot One Image to 3D Object](https://arxiv.org/abs/2303.11328) paper.
2892
  The original pytorch-lightning [repo](https://github.com/cvlab-columbia/zero123) and a diffusers [repo](https://github.com/kxhit/zero123-hf).
2893
 
2894
  The following code shows how to use the Zero1to3 pipeline to generate novel view synthesis images using a pretrained stable diffusion model.
@@ -3356,7 +3356,7 @@ Side note: See [this GitHub gist](https://gist.github.com/UmerHA/b65bb5fb9626c9c
3356
 
3357
  ### Latent Consistency Pipeline
3358
 
3359
- Latent Consistency Models was proposed in [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, Hang Zhao_ from Tsinghua University.
3360
 
3361
  The abstract of the paper reads as follows:
3362
 
@@ -3468,7 +3468,7 @@ assert len(images) == (len(prompts) - 1) * num_interpolation_steps
3468
 
3469
  ### StableDiffusionUpscaleLDM3D Pipeline
3470
 
3471
- [LDM3D-VR](https://arxiv.org/pdf/2311.03226.pdf) is an extended version of LDM3D.
3472
 
3473
  The abstract from the paper is:
3474
  *Latent diffusion models have proven to be state-of-the-art in the creation and manipulation of visual outputs. However, as far as we know, the generation of depth maps jointly with RGB is still limited. We introduce LDM3D-VR, a suite of diffusion models targeting virtual reality development that includes LDM3D-pano and LDM3D-SR. These models enable the generation of panoramic RGBD based on textual prompts and the upscaling of low-resolution inputs to high-resolution RGBD, respectively. Our models are fine-tuned from existing pretrained models on datasets containing panoramic/high-resolution RGB images, depth maps and captions. Both models are evaluated in comparison to existing related methods*
@@ -4165,7 +4165,7 @@ export_to_gif(result.frames[0], "result.gif")
4165
 
4166
  ### DemoFusion
4167
 
4168
- This pipeline is the official implementation of [DemoFusion: Democratising High-Resolution Image Generation With No $$$](https://arxiv.org/abs/2311.16973).
4169
  The original repo can be found at [repo](https://github.com/PRIS-CV/DemoFusion).
4170
 
4171
  - `view_batch_size` (`int`, defaults to 16):
@@ -4259,7 +4259,7 @@ This pipeline provides drag-and-drop image editing using stochastic differential
4259
 
4260
  ![SDE Drag Image](https://github.com/huggingface/diffusers/assets/75928535/bd54f52f-f002-4951-9934-b2a4592771a5)
4261
 
4262
- See [paper](https://arxiv.org/abs/2311.01410), [paper page](https://ml-gsai.github.io/SDE-Drag-demo/), [original repo](https://github.com/ML-GSAI/SDE-Drag) for more information.
4263
 
4264
  ```py
4265
  import torch
@@ -4515,7 +4515,7 @@ export_to_video(
4515
 
4516
  ### StyleAligned Pipeline
4517
 
4518
- This pipeline is the implementation of [Style Aligned Image Generation via Shared Attention](https://arxiv.org/abs/2312.02133). You can find more results [here](https://github.com/huggingface/diffusers/pull/6489#issuecomment-1881209354).
4519
 
4520
  > Large-scale Text-to-Image (T2I) models have rapidly gained prominence across creative fields, generating visually compelling outputs from textual prompts. However, controlling these models to ensure consistent style remains challenging, with existing methods necessitating fine-tuning and manual intervention to disentangle content and style. In this paper, we introduce StyleAligned, a novel technique designed to establish style alignment among a series of generated images. By employing minimal `attention sharing' during the diffusion process, our method maintains style consistency across images within T2I models. This approach allows for the creation of style-consistent images using a reference style through a straightforward inversion operation. Our method's evaluation across diverse styles and text prompts demonstrates high-quality synthesis and fidelity, underscoring its efficacy in achieving consistent style across various inputs.
4521
 
@@ -4729,7 +4729,7 @@ image = pipe(
4729
 
4730
  ### UFOGen Scheduler
4731
 
4732
- [UFOGen](https://arxiv.org/abs/2311.09257) is a generative model designed for fast one-step text-to-image generation, trained via adversarial training starting from an initial pretrained diffusion model such as Stable Diffusion. `scheduling_ufogen.py` implements a onestep and multistep sampling algorithm for UFOGen models compatible with pipelines like `StableDiffusionPipeline`. A usage example is as follows:
4733
 
4734
  ```py
4735
  import torch
@@ -5047,7 +5047,7 @@ make_image_grid(image, rows=1, cols=len(image))
5047
  ### Stable Diffusion XL Attentive Eraser Pipeline
5048
  <img src="https://raw.githubusercontent.com/Anonym0u3/Images/refs/heads/main/fenmian.png" width="600" />
5049
 
5050
- **Stable Diffusion XL Attentive Eraser Pipeline** is an advanced object removal pipeline that leverages SDXL for precise content suppression and seamless region completion. This pipeline uses **self-attention redirection guidance** to modify the model’s self-attention mechanism, allowing for effective removal and inpainting across various levels of mask precision, including semantic segmentation masks, bounding boxes, and hand-drawn masks. If you are interested in more detailed information and have any questions, please refer to the [paper](https://arxiv.org/abs/2412.12974) and [official implementation](https://github.com/Anonym0u3/AttentiveEraser).
5051
 
5052
  #### Key features
5053
 
@@ -5133,7 +5133,7 @@ print("Object removal completed")
5133
 
5134
  # Perturbed-Attention Guidance
5135
 
5136
- [Project](https://ku-cvlab.github.io/Perturbed-Attention-Guidance/) / [arXiv](https://arxiv.org/abs/2403.17377) / [GitHub](https://github.com/KU-CVLAB/Perturbed-Attention-Guidance)
5137
 
5138
  This implementation is based on [Diffusers](https://huggingface.co/docs/diffusers/index). `StableDiffusionPAGPipeline` is a modification of `StableDiffusionPipeline` to support Perturbed-Attention Guidance (PAG).
5139
 
 
10
 
11
  | Example | Description | Code Example | Colab | Author |
12
  |:--------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------:|
13
+ |Spatiotemporal Skip Guidance (STG)|[Spatiotemporal Skip Guidance for Enhanced Video Diffusion Sampling](https://huggingface.co/papers/2411.18664) (CVPR 2025) enhances video diffusion models by generating a weaker model through layer skipping and using it as guidance, improving fidelity in models like HunyuanVideo, LTXVideo, and Mochi.|[Spatiotemporal Skip Guidance](#spatiotemporal-skip-guidance)|-|[Junha Hyung](https://junhahyung.github.io/), [Kinam Kim](https://kinam0252.github.io/), and [Ednaordinary](https://github.com/Ednaordinary)|
14
  |Adaptive Mask Inpainting|Adaptive Mask Inpainting algorithm from [Beyond the Contact: Discovering Comprehensive Affordance for 3D Objects from Pre-trained 2D Diffusion Models](https://github.com/snuvclab/coma) (ECCV '24, Oral) provides a way to insert human inside the scene image without altering the background, by inpainting with adapting mask.|[Adaptive Mask Inpainting](#adaptive-mask-inpainting)|-|[Hyeonwoo Kim](https://sshowbiz.xyz),[Sookwan Han](https://jellyheadandrew.github.io)|
15
  |Flux with CFG|[Flux with CFG](https://github.com/ToTheBeginning/PuLID/blob/main/docs/pulid_for_flux.md) provides an implementation of using CFG in [Flux](https://blackforestlabs.ai/announcing-black-forest-labs/).|[Flux with CFG](#flux-with-cfg)|[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/flux_with_cfg.ipynb)|[Linoy Tsaban](https://github.com/linoytsaban), [Apolinário](https://github.com/apolinario), and [Sayak Paul](https://github.com/sayakpaul)|
16
  |Differential Diffusion|[Differential Diffusion](https://github.com/exx8/differential-diffusion) modifies an image according to a text prompt, and according to a map that specifies the amount of change in each region.|[Differential Diffusion](#differential-diffusion)|[![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/exx8/differential-diffusion) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/exx8/differential-diffusion/blob/main/examples/SD2.ipynb)|[Eran Levin](https://github.com/exx8) and [Ohad Fried](https://www.ohadf.com/)|
 
39
  | Stable UnCLIP | Diffusion Pipeline for combining prior model (generate clip image embedding from text, UnCLIPPipeline `"kakaobrain/karlo-v1-alpha"`) and decoder pipeline (decode clip image embedding to image, StableDiffusionImageVariationPipeline `"lambdalabs/sd-image-variations-diffusers"` ). | [Stable UnCLIP](#stable-unclip) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/stable_unclip.ipynb) | [Ray Wang](https://wrong.wang) |
40
  | UnCLIP Text Interpolation Pipeline | Diffusion Pipeline that allows passing two prompts and produces images while interpolating between the text-embeddings of the two prompts | [UnCLIP Text Interpolation Pipeline](#unclip-text-interpolation-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/unclip_text_interpolation.ipynb)| [Naga Sai Abhinay Devarinti](https://github.com/Abhinay1997/) |
41
  | UnCLIP Image Interpolation Pipeline | Diffusion Pipeline that allows passing two images/image_embeddings and produces images while interpolating between their image-embeddings | [UnCLIP Image Interpolation Pipeline](#unclip-image-interpolation-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/unclip_image_interpolation.ipynb)| [Naga Sai Abhinay Devarinti](https://github.com/Abhinay1997/) |
42
+ | DDIM Noise Comparative Analysis Pipeline | Investigating how the diffusion models learn visual concepts from each noise level (which is a contribution of [P2 weighting (CVPR 2022)](https://huggingface.co/papers/2204.00227)) | [DDIM Noise Comparative Analysis Pipeline](#ddim-noise-comparative-analysis-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/ddim_noise_comparative_analysis.ipynb)| [Aengus (Duc-Anh)](https://github.com/aengusng8) |
43
  | CLIP Guided Img2Img Stable Diffusion Pipeline | Doing CLIP guidance for image to image generation with Stable Diffusion | [CLIP Guided Img2Img Stable Diffusion](#clip-guided-img2img-stable-diffusion) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/clip_guided_img2img_stable_diffusion.ipynb) | [Nipun Jindal](https://github.com/nipunjindal/) |
44
  | TensorRT Stable Diffusion Text to Image Pipeline | Accelerates the Stable Diffusion Text2Image Pipeline using TensorRT | [TensorRT Stable Diffusion Text to Image Pipeline](#tensorrt-text2image-stable-diffusion-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/tensorrt_text2image_stable_diffusion_pipeline.ipynb) | [Asfiya Baig](https://github.com/asfiyab-nvidia) |
45
  | EDICT Image Editing Pipeline | Diffusion pipeline for text-guided image editing | [EDICT Image Editing Pipeline](#edict-image-editing-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/edict_image_pipeline.ipynb) | [Joqsan Azocar](https://github.com/Joqsan) |
46
+ | Stable Diffusion RePaint | Stable Diffusion pipeline using [RePaint](https://huggingface.co/papers/2201.09865) for inpainting. | [Stable Diffusion RePaint](#stable-diffusion-repaint )|[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/stable_diffusion_repaint.ipynb)| [Markus Pobitzer](https://github.com/Markus-Pobitzer) |
47
  | TensorRT Stable Diffusion Image to Image Pipeline | Accelerates the Stable Diffusion Image2Image Pipeline using TensorRT | [TensorRT Stable Diffusion Image to Image Pipeline](#tensorrt-image2image-stable-diffusion-pipeline) | - | [Asfiya Baig](https://github.com/asfiyab-nvidia) |
48
  | Stable Diffusion IPEX Pipeline | Accelerate Stable Diffusion inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [Stable Diffusion on IPEX](#stable-diffusion-on-ipex) | - | [Yingjie Han](https://github.com/yingjie-han/) |
49
  | CLIP Guided Images Mixing Stable Diffusion Pipeline | Сombine images using usual diffusion models. | [CLIP Guided Images Mixing Using Stable Diffusion](#clip-guided-images-mixing-with-stable-diffusion) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/clip_guided_images_mixing_with_stable_diffusion.ipynb) | [Karachev Denis](https://github.com/TheDenk) |
50
  | TensorRT Stable Diffusion Inpainting Pipeline | Accelerates the Stable Diffusion Inpainting Pipeline using TensorRT | [TensorRT Stable Diffusion Inpainting Pipeline](#tensorrt-inpainting-stable-diffusion-pipeline) | - | [Asfiya Baig](https://github.com/asfiyab-nvidia) |
51
+ | IADB Pipeline | Implementation of [Iterative α-(de)Blending: a Minimalist Deterministic Diffusion Model](https://huggingface.co/papers/2305.03486) | [IADB Pipeline](#iadb-pipeline) | - | [Thomas Chambon](https://github.com/tchambon)
52
+ | Zero1to3 Pipeline | Implementation of [Zero-1-to-3: Zero-shot One Image to 3D Object](https://huggingface.co/papers/2303.11328) | [Zero1to3 Pipeline](#zero1to3-pipeline) | - | [Xin Kong](https://github.com/kxhit) |
53
  | Stable Diffusion XL Long Weighted Prompt Pipeline | A pipeline support unlimited length of prompt and negative prompt, use A1111 style of prompt weighting | [Stable Diffusion XL Long Weighted Prompt Pipeline](#stable-diffusion-xl-long-weighted-prompt-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1LsqilswLR40XLLcp6XFOl5nKb_wOe26W?usp=sharing) | [Andrew Zhu](https://xhinker.medium.com/) |
54
  | Stable Diffusion Mixture Tiling Pipeline SD 1.5 | A pipeline generates cohesive images by integrating multiple diffusion processes, each focused on a specific image region and considering boundary effects for smooth blending | [Stable Diffusion Mixture Tiling Pipeline SD 1.5](#stable-diffusion-mixture-tiling-pipeline-sd-15) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/albarji/mixture-of-diffusers) | [Álvaro B Jiménez](https://github.com/albarji/) |
55
  | Stable Diffusion Mixture Canvas Pipeline SD 1.5 | A pipeline generates cohesive images by integrating multiple diffusion processes, each focused on a specific image region and considering boundary effects for smooth blending. Works by defining a list of Text2Image region objects that detail the region of influence of each diffuser. | [Stable Diffusion Mixture Canvas Pipeline SD 1.5](#stable-diffusion-mixture-canvas-pipeline-sd-15) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/albarji/mixture-of-diffusers) | [Álvaro B Jiménez](https://github.com/albarji/) |
 
59
  | sketch inpaint - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion Pipeline](#stable-diffusion-masked-im2im) | - | [Anatoly Belikov](https://github.com/noskill) |
60
  | sketch inpaint xl - Inpainting with non-inpaint Stable Diffusion | sketch inpaint much like in automatic1111 | [Masked Im2Im Stable Diffusion XL Pipeline](#stable-diffusion-xl-masked-im2im) | - | [Anatoly Belikov](https://github.com/noskill) |
61
  | prompt-to-prompt | change parts of a prompt and retain image structure (see [paper page](https://prompt-to-prompt.github.io/)) | [Prompt2Prompt Pipeline](#prompt2prompt-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/prompt_2_prompt_pipeline.ipynb) | [Umer H. Adil](https://twitter.com/UmerHAdil) |
62
+ | Latent Consistency Pipeline | Implementation of [Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference](https://huggingface.co/papers/2310.04378) | [Latent Consistency Pipeline](#latent-consistency-pipeline) | - | [Simian Luo](https://github.com/luosiallen) |
63
  | Latent Consistency Img2img Pipeline | Img2img pipeline for Latent Consistency Models | [Latent Consistency Img2Img Pipeline](#latent-consistency-img2img-pipeline) | - | [Logan Zoellner](https://github.com/nagolinc) |
64
  | Latent Consistency Interpolation Pipeline | Interpolate the latent space of Latent Consistency Models with multiple prompts | [Latent Consistency Interpolation Pipeline](#latent-consistency-interpolation-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1pK3NrLWJSiJsBynLns1K1-IDTW9zbPvl?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) |
65
  | SDE Drag Pipeline | The pipeline supports drag editing of images using stochastic differential equations | [SDE Drag Pipeline](#sde-drag-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/sde_drag.ipynb) | [NieShen](https://github.com/NieShenRuc) [Fengqi Zhu](https://github.com/Monohydroxides) |
66
  | Regional Prompting Pipeline | Assign multiple prompts for different regions | [Regional Prompting Pipeline](#regional-prompting-pipeline) | - | [hako-mikan](https://github.com/hako-mikan) |
67
  | LDM3D-sr (LDM3D upscaler) | Upscale low resolution RGB and depth inputs to high resolution | [StableDiffusionUpscaleLDM3D Pipeline](https://github.com/estelleafl/diffusers/tree/ldm3d_upscaler_community/examples/community#stablediffusionupscaleldm3d-pipeline) | - | [Estelle Aflalo](https://github.com/estelleafl) |
68
  | AnimateDiff ControlNet Pipeline | Combines AnimateDiff with precise motion control using ControlNets | [AnimateDiff ControlNet Pipeline](#animatediff-controlnet-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1SKboYeGjEQmQPWoFC0aLYpBlYdHXkvAu?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) and [Edoardo Botta](https://github.com/EdoardoBotta) |
69
+ | DemoFusion Pipeline | Implementation of [DemoFusion: Democratising High-Resolution Image Generation With No $$$](https://huggingface.co/papers/2311.16973) | [DemoFusion Pipeline](#demofusion) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/demo_fusion.ipynb) | [Ruoyi Du](https://github.com/RuoyiDu) |
70
+ | Instaflow Pipeline | Implementation of [InstaFlow! One-Step Stable Diffusion with Rectified Flow](https://huggingface.co/papers/2309.06380) | [Instaflow Pipeline](#instaflow-pipeline) | [Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/insta_flow.ipynb) | [Ayush Mangal](https://github.com/ayushtues) |
71
+ | Null-Text Inversion Pipeline | Implement [Null-text Inversion for Editing Real Images using Guided Diffusion Models](https://huggingface.co/papers/2211.09794) as a pipeline. | [Null-Text Inversion](https://github.com/google/prompt-to-prompt/) | - | [Junsheng Luan](https://github.com/Junsheng121) |
72
+ | Rerender A Video Pipeline | Implementation of [[SIGGRAPH Asia 2023] Rerender A Video: Zero-Shot Text-Guided Video-to-Video Translation](https://huggingface.co/papers/2306.07954) | [Rerender A Video Pipeline](#rerender-a-video) | - | [Yifan Zhou](https://github.com/SingleZombie) |
73
+ | StyleAligned Pipeline | Implementation of [Style Aligned Image Generation via Shared Attention](https://huggingface.co/papers/2312.02133) | [StyleAligned Pipeline](#stylealigned-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://drive.google.com/file/d/15X2E0jFPTajUIjS0FzX50OaHsCbP2lQ0/view?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) |
74
  | AnimateDiff Image-To-Video Pipeline | Experimental Image-To-Video support for AnimateDiff (open to improvements) | [AnimateDiff Image To Video Pipeline](#animatediff-image-to-video-pipeline) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://drive.google.com/file/d/1TvzCDPHhfFtdcJZe4RLloAwyoLKuttWK/view?usp=sharing) | [Aryan V S](https://github.com/a-r-r-o-w) |
75
  | IP Adapter FaceID Stable Diffusion | Stable Diffusion Pipeline that supports IP Adapter Face ID | [IP Adapter Face ID](#ip-adapter-face-id) |[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/ip_adapter_face_id.ipynb)| [Fabio Rigano](https://github.com/fabiorigano) |
76
  | InstantID Pipeline | Stable Diffusion XL Pipeline that supports InstantID | [InstantID Pipeline](#instantid-pipeline) | [![Hugging Face Space](https://img.shields.io/badge/🤗%20Hugging%20Face-Space-yellow)](https://huggingface.co/spaces/InstantX/InstantID) | [Haofan Wang](https://github.com/haofanwang) |
77
  | UFOGen Scheduler | Scheduler for UFOGen Model (compatible with Stable Diffusion pipelines) | [UFOGen Scheduler](#ufogen-scheduler) | - | [dg845](https://github.com/dg845) |
78
  | Stable Diffusion XL IPEX Pipeline | Accelerate Stable Diffusion XL inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [Stable Diffusion XL on IPEX](#stable-diffusion-xl-on-ipex) | - | [Dan Li](https://github.com/ustcuna/) |
79
  | Stable Diffusion BoxDiff Pipeline | Training-free controlled generation with bounding boxes using [BoxDiff](https://github.com/showlab/BoxDiff) | [Stable Diffusion BoxDiff Pipeline](#stable-diffusion-boxdiff) | - | [Jingyang Zhang](https://github.com/zjysteven/) |
80
+ | FRESCO V2V Pipeline | Implementation of [[CVPR 2024] FRESCO: Spatial-Temporal Correspondence for Zero-Shot Video Translation](https://huggingface.co/papers/2403.12962) | [FRESCO V2V Pipeline](#fresco) | - | [Yifan Zhou](https://github.com/SingleZombie) |
81
  | AnimateDiff IPEX Pipeline | Accelerate AnimateDiff inference pipeline with BF16/FP32 precision on Intel Xeon CPUs with [IPEX](https://github.com/intel/intel-extension-for-pytorch) | [AnimateDiff on IPEX](#animatediff-on-ipex) | - | [Dan Li](https://github.com/ustcuna/) |
82
  PIXART-α Controlnet pipeline | Implementation of the controlnet model for pixart alpha and its diffusers pipeline | [PIXART-α Controlnet pipeline](#pixart-α-controlnet-pipeline) | - | [Raul Ciotescu](https://github.com/raulc0399/) |
83
  | HunyuanDiT Differential Diffusion Pipeline | Applies [Differential Diffusion](https://github.com/exx8/differential-diffusion) to [HunyuanDiT](https://github.com/huggingface/diffusers/pull/8240). | [HunyuanDiT with Differential Diffusion](#hunyuandit-with-differential-diffusion) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1v44a5fpzyr4Ffr4v2XBQ7BajzG874N4P?usp=sharing) | [Monjoy Choudhury](https://github.com/MnCSSJ4x) |
 
85
  | Stable Diffusion XL Attentive Eraser Pipeline |[[AAAI2025 Oral] Attentive Eraser](https://github.com/Anonym0u3/AttentiveEraser) is a novel tuning-free method that enhances object removal capabilities in pre-trained diffusion models.|[Stable Diffusion XL Attentive Eraser Pipeline](#stable-diffusion-xl-attentive-eraser-pipeline)|-|[Wenhao Sun](https://github.com/Anonym0u3) and [Benlei Cui](https://github.com/Benny079)|
86
  | Perturbed-Attention Guidance |StableDiffusionPAGPipeline is a modification of StableDiffusionPipeline to support Perturbed-Attention Guidance (PAG).|[Perturbed-Attention Guidance](#perturbed-attention-guidance)|[Notebook](https://github.com/huggingface/notebooks/blob/main/diffusers/perturbed_attention_guidance.ipynb)|[Hyoungwon Cho](https://github.com/HyoungwonCho)|
87
  | CogVideoX DDIM Inversion Pipeline | Implementation of DDIM inversion and guided attention-based editing denoising process on CogVideoX. | [CogVideoX DDIM Inversion Pipeline](#cogvideox-ddim-inversion-pipeline) | - | [LittleNyima](https://github.com/LittleNyima) |
88
+ | FaithDiff Stable Diffusion XL Pipeline | Implementation of [(CVPR 2025) FaithDiff: Unleashing Diffusion Priors for Faithful Image Super-resolutionUnleashing Diffusion Priors for Faithful Image Super-resolution](https://huggingface.co/papers/2411.18824) - FaithDiff is a faithful image super-resolution method that leverages latent diffusion models by actively adapting the diffusion prior and jointly fine-tuning its components (encoder and diffusion model) with an alignment module to ensure high fidelity and structural consistency. | [FaithDiff Stable Diffusion XL Pipeline](#faithdiff-stable-diffusion-xl-pipeline) | [![Hugging Face Models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/jychen9811/FaithDiff) | [Junyang Chen, Jinshan Pan, Jiangxin Dong, IMAG Lab, (Adapted by Eliseu Silva)](https://github.com/JyChen9811/FaithDiff) |
89
  | Stable Diffusion 3 InstructPix2Pix Pipeline | Implementation of Stable Diffusion 3 InstructPix2Pix Pipeline | [Stable Diffusion 3 InstructPix2Pix Pipeline](#stable-diffusion-3-instructpix2pix-pipeline) | [![Hugging Face Models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/BleachNick/SD3_UltraEdit_freeform) [![Hugging Face Models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/CaptainZZZ/sd3-instructpix2pix) | [Jiayu Zhang](https://github.com/xduzhangjiayu) and [Haozhe Zhao](https://github.com/HaozheZhao)|
90
  To load a custom pipeline you just need to pass the `custom_pipeline` argument to `DiffusionPipeline`, as one of the files in `diffusers/examples/community`. Feel free to send a PR with your own pipelines, we will merge them quickly.
91
 
 
101
 
102
  **KAIST AI, University of Washington**
103
 
104
+ [*Spatiotemporal Skip Guidance (STG) for Enhanced Video Diffusion Sampling*](https://huggingface.co/papers/2411.18664) (CVPR 2025) is a simple training-free sampling guidance method for enhancing transformer-based video diffusion models. STG employs an implicit weak model via self-perturbation, avoiding the need for external models or additional training. By selectively skipping spatiotemporal layers, STG produces an aligned, degraded version of the original model to boost sample quality without compromising diversity or dynamic degree.
105
 
106
  Following is the example video of STG applied to Mochi.
107
 
 
161
  ![teaser-img](https://snuvclab.github.io/coma/static/images/example_result_adaptive_mask_inpainting.png)
162
 
163
 
164
+ You can find additional information about Adaptive Mask Inpainting in the [paper](https://huggingface.co/papers/2401.12978) or in the [project website](https://snuvclab.github.io/coma).
165
 
166
  #### Usage example
167
  First, clone the diffusers github repository, and run the following command to set environment.
 
413
 
414
  ### HD-Painter
415
 
416
+ Implementation of [HD-Painter: High-Resolution and Prompt-Faithful Text-Guided Image Inpainting with Diffusion Models](https://huggingface.co/papers/2312.14091).
417
 
418
  ![teaser-img](https://raw.githubusercontent.com/Picsart-AI-Research/HD-Painter/main/__assets__/github/teaser.jpg)
419
 
 
428
  Our experiments demonstrate that HD-Painter surpasses existing state-of-the-art approaches qualitatively and quantitatively, achieving an impressive generation accuracy improvement of **61.4** vs **51.9**.
429
  We will make the codes publicly available.
430
 
431
+ You can find additional information about Text2Video-Zero in the [paper](https://huggingface.co/papers/2312.14091) or the [original codebase](https://github.com/Picsart-AI-Research/HD-Painter).
432
 
433
  #### Usage example
434
 
 
1362
 
1363
  ### Bit Diffusion
1364
 
1365
+ Based <https://huggingface.co/papers/2208.04202>, this is used for diffusion on discrete data - eg, discrete image data, DNA sequence data. An unconditional discrete image can be generated like this:
1366
 
1367
  ```python
1368
  from diffusers import DiffusionPipeline
 
1523
 
1524
  ### Magic Mix
1525
 
1526
+ Implementation of the [MagicMix: Semantic Mixing with Diffusion Models](https://huggingface.co/papers/2210.16056) paper. This is a Diffusion Pipeline for semantic mixing of an image and a text prompt to create a new concept while preserving the spatial layout and geometry of the subject in the image. The pipeline takes an image that provides the layout semantics and a prompt that provides the content semantics for the mixing process.
1527
 
1528
  There are 3 parameters for the method-
1529
 
 
1754
 
1755
  #### **Research question: What visual concepts do the diffusion models learn from each noise level during training?**
1756
 
1757
+ The [P2 weighting (CVPR 2022)](https://huggingface.co/papers/2204.00227) paper proposed an approach to answer the above question, which is their second contribution.
1758
  The approach consists of the following steps:
1759
 
1760
  1. The input is an image x0.
 
1896
 
1897
  ### EDICT Image Editing Pipeline
1898
 
1899
+ This pipeline implements the text-guided image editing approach from the paper [EDICT: Exact Diffusion Inversion via Coupled Transformations](https://huggingface.co/papers/2211.12446). You have to pass:
1900
 
1901
  - (`PIL`) `image` you want to edit.
1902
  - `base_prompt`: the text prompt describing the current image (before editing).
 
1981
 
1982
  ### Stable Diffusion RePaint
1983
 
1984
+ This pipeline uses the [RePaint](https://huggingface.co/papers/2201.09865) logic on the latent space of stable diffusion. It can
1985
  be used similarly to other image inpainting pipelines but does not rely on a specific inpainting model. This means you can use
1986
  models that are not specifically created for inpainting.
1987
 
 
2576
 
2577
  ### Stable Diffusion Mixture Tiling Pipeline SD 1.5
2578
 
2579
+ This pipeline uses the Mixture. Refer to the [Mixture](https://huggingface.co/papers/2302.02412) paper for more details.
2580
 
2581
  ```python
2582
  from diffusers import LMSDiscreteScheduler, DiffusionPipeline
 
2607
 
2608
  ### Stable Diffusion Mixture Canvas Pipeline SD 1.5
2609
 
2610
+ This pipeline uses the Mixture. Refer to the [Mixture](https://huggingface.co/papers/2302.02412) paper for more details.
2611
 
2612
  ```python
2613
  from PIL import Image
 
2642
 
2643
  ### Stable Diffusion Mixture Tiling Pipeline SDXL
2644
 
2645
+ This pipeline uses the Mixture. Refer to the [Mixture](https://huggingface.co/papers/2302.02412) paper for more details.
2646
 
2647
  ```python
2648
  import torch
 
2696
 
2697
  ### Stable Diffusion MoD ControlNet Tile SR Pipeline SDXL
2698
 
2699
+ This pipeline implements the [MoD (Mixture-of-Diffusers)](https://huggingface.co/papers/2408.06072) tiled diffusion technique and combines it with SDXL's ControlNet Tile process to generate SR images.
2700
 
2701
  This works better with 4x scales, but you can try adjusts parameters to higher scales.
2702
 
 
2835
 
2836
  ### IADB pipeline
2837
 
2838
+ This pipeline is the implementation of the [α-(de)Blending: a Minimalist Deterministic Diffusion Model](https://huggingface.co/papers/2305.03486) paper.
2839
  It is a simple and minimalist diffusion model.
2840
 
2841
  The following code shows how to use the IADB pipeline to generate images using a pretrained celebahq-256 model.
 
2888
 
2889
  ### Zero1to3 pipeline
2890
 
2891
+ This pipeline is the implementation of the [Zero-1-to-3: Zero-shot One Image to 3D Object](https://huggingface.co/papers/2303.11328) paper.
2892
  The original pytorch-lightning [repo](https://github.com/cvlab-columbia/zero123) and a diffusers [repo](https://github.com/kxhit/zero123-hf).
2893
 
2894
  The following code shows how to use the Zero1to3 pipeline to generate novel view synthesis images using a pretrained stable diffusion model.
 
3356
 
3357
  ### Latent Consistency Pipeline
3358
 
3359
+ Latent Consistency Models was proposed in [Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference](https://huggingface.co/papers/2310.04378) by _Simian Luo, Yiqin Tan, Longbo Huang, Jian Li, Hang Zhao_ from Tsinghua University.
3360
 
3361
  The abstract of the paper reads as follows:
3362
 
 
3468
 
3469
  ### StableDiffusionUpscaleLDM3D Pipeline
3470
 
3471
+ [LDM3D-VR](https://huggingface.co/papers/2311.03226) is an extended version of LDM3D.
3472
 
3473
  The abstract from the paper is:
3474
  *Latent diffusion models have proven to be state-of-the-art in the creation and manipulation of visual outputs. However, as far as we know, the generation of depth maps jointly with RGB is still limited. We introduce LDM3D-VR, a suite of diffusion models targeting virtual reality development that includes LDM3D-pano and LDM3D-SR. These models enable the generation of panoramic RGBD based on textual prompts and the upscaling of low-resolution inputs to high-resolution RGBD, respectively. Our models are fine-tuned from existing pretrained models on datasets containing panoramic/high-resolution RGB images, depth maps and captions. Both models are evaluated in comparison to existing related methods*
 
4165
 
4166
  ### DemoFusion
4167
 
4168
+ This pipeline is the official implementation of [DemoFusion: Democratising High-Resolution Image Generation With No $$$](https://huggingface.co/papers/2311.16973).
4169
  The original repo can be found at [repo](https://github.com/PRIS-CV/DemoFusion).
4170
 
4171
  - `view_batch_size` (`int`, defaults to 16):
 
4259
 
4260
  ![SDE Drag Image](https://github.com/huggingface/diffusers/assets/75928535/bd54f52f-f002-4951-9934-b2a4592771a5)
4261
 
4262
+ See [paper](https://huggingface.co/papers/2311.01410), [paper page](https://ml-gsai.github.io/SDE-Drag-demo/), [original repo](https://github.com/ML-GSAI/SDE-Drag) for more information.
4263
 
4264
  ```py
4265
  import torch
 
4515
 
4516
  ### StyleAligned Pipeline
4517
 
4518
+ This pipeline is the implementation of [Style Aligned Image Generation via Shared Attention](https://huggingface.co/papers/2312.02133). You can find more results [here](https://github.com/huggingface/diffusers/pull/6489#issuecomment-1881209354).
4519
 
4520
  > Large-scale Text-to-Image (T2I) models have rapidly gained prominence across creative fields, generating visually compelling outputs from textual prompts. However, controlling these models to ensure consistent style remains challenging, with existing methods necessitating fine-tuning and manual intervention to disentangle content and style. In this paper, we introduce StyleAligned, a novel technique designed to establish style alignment among a series of generated images. By employing minimal `attention sharing' during the diffusion process, our method maintains style consistency across images within T2I models. This approach allows for the creation of style-consistent images using a reference style through a straightforward inversion operation. Our method's evaluation across diverse styles and text prompts demonstrates high-quality synthesis and fidelity, underscoring its efficacy in achieving consistent style across various inputs.
4521
 
 
4729
 
4730
  ### UFOGen Scheduler
4731
 
4732
+ [UFOGen](https://huggingface.co/papers/2311.09257) is a generative model designed for fast one-step text-to-image generation, trained via adversarial training starting from an initial pretrained diffusion model such as Stable Diffusion. `scheduling_ufogen.py` implements a onestep and multistep sampling algorithm for UFOGen models compatible with pipelines like `StableDiffusionPipeline`. A usage example is as follows:
4733
 
4734
  ```py
4735
  import torch
 
5047
  ### Stable Diffusion XL Attentive Eraser Pipeline
5048
  <img src="https://raw.githubusercontent.com/Anonym0u3/Images/refs/heads/main/fenmian.png" width="600" />
5049
 
5050
+ **Stable Diffusion XL Attentive Eraser Pipeline** is an advanced object removal pipeline that leverages SDXL for precise content suppression and seamless region completion. This pipeline uses **self-attention redirection guidance** to modify the model’s self-attention mechanism, allowing for effective removal and inpainting across various levels of mask precision, including semantic segmentation masks, bounding boxes, and hand-drawn masks. If you are interested in more detailed information and have any questions, please refer to the [paper](https://huggingface.co/papers/2412.12974) and [official implementation](https://github.com/Anonym0u3/AttentiveEraser).
5051
 
5052
  #### Key features
5053
 
 
5133
 
5134
  # Perturbed-Attention Guidance
5135
 
5136
+ [Project](https://ku-cvlab.github.io/Perturbed-Attention-Guidance/) / [arXiv](https://huggingface.co/papers/2403.17377) / [GitHub](https://github.com/KU-CVLAB/Perturbed-Attention-Guidance)
5137
 
5138
  This implementation is based on [Diffusers](https://huggingface.co/docs/diffusers/index). `StableDiffusionPAGPipeline` is a modification of `StableDiffusionPipeline` to support Perturbed-Attention Guidance (PAG).
5139
 
main/adaptive_mask_inpainting.py CHANGED
@@ -670,7 +670,7 @@ class AdaptiveMaskInpaintPipeline(
670
  def prepare_extra_step_kwargs(self, generator, eta):
671
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
672
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
673
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
674
  # and should be between [0, 1]
675
 
676
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -917,7 +917,7 @@ class AdaptiveMaskInpaintPipeline(
917
  num_images_per_prompt (`int`, *optional*, defaults to 1):
918
  The number of images to generate per prompt.
919
  eta (`float`, *optional*, defaults to 0.0):
920
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
921
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
922
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
923
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -1012,7 +1012,7 @@ class AdaptiveMaskInpaintPipeline(
1012
 
1013
  device = self._execution_device
1014
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1015
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1016
  # corresponds to doing no classifier free guidance.
1017
  do_classifier_free_guidance = guidance_scale > 1.0
1018
 
 
670
  def prepare_extra_step_kwargs(self, generator, eta):
671
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
672
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
673
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
674
  # and should be between [0, 1]
675
 
676
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
917
  num_images_per_prompt (`int`, *optional*, defaults to 1):
918
  The number of images to generate per prompt.
919
  eta (`float`, *optional*, defaults to 0.0):
920
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
921
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
922
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
923
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
1012
 
1013
  device = self._execution_device
1014
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1015
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1016
  # corresponds to doing no classifier free guidance.
1017
  do_classifier_free_guidance = guidance_scale > 1.0
1018
 
main/bit_diffusion.py CHANGED
@@ -74,7 +74,7 @@ def ddim_bit_scheduler_step(
74
  "Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler"
75
  )
76
 
77
- # See formulas (12) and (16) of DDIM paper https://arxiv.org/pdf/2010.02502.pdf
78
  # Ideally, read DDIM paper in-detail understanding
79
 
80
  # Notation (<variable name> -> <name in paper>
@@ -95,7 +95,7 @@ def ddim_bit_scheduler_step(
95
  beta_prod_t = 1 - alpha_prod_t
96
 
97
  # 3. compute predicted original sample from predicted noise also called
98
- # "predicted x_0" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
99
  pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
100
 
101
  # 4. Clip "predicted x_0"
@@ -112,10 +112,10 @@ def ddim_bit_scheduler_step(
112
  # the model_output is always re-derived from the clipped x_0 in Glide
113
  model_output = (sample - alpha_prod_t ** (0.5) * pred_original_sample) / beta_prod_t ** (0.5)
114
 
115
- # 6. compute "direction pointing to x_t" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
116
  pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * model_output
117
 
118
- # 7. compute x_t without "random noise" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
119
  prev_sample = alpha_prod_t_prev ** (0.5) * pred_original_sample + pred_sample_direction
120
 
121
  if eta > 0:
@@ -172,7 +172,7 @@ def ddpm_bit_scheduler_step(
172
  beta_prod_t_prev = 1 - alpha_prod_t_prev
173
 
174
  # 2. compute predicted original sample from predicted noise also called
175
- # "predicted x_0" of formula (15) from https://arxiv.org/pdf/2006.11239.pdf
176
  if prediction_type == "epsilon":
177
  pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
178
  elif prediction_type == "sample":
@@ -186,12 +186,12 @@ def ddpm_bit_scheduler_step(
186
  pred_original_sample = torch.clamp(pred_original_sample, -scale, scale)
187
 
188
  # 4. Compute coefficients for pred_original_sample x_0 and current sample x_t
189
- # See formula (7) from https://arxiv.org/pdf/2006.11239.pdf
190
  pred_original_sample_coeff = (alpha_prod_t_prev ** (0.5) * self.betas[t]) / beta_prod_t
191
  current_sample_coeff = self.alphas[t] ** (0.5) * beta_prod_t_prev / beta_prod_t
192
 
193
  # 5. Compute predicted previous sample µ_t
194
- # See formula (7) from https://arxiv.org/pdf/2006.11239.pdf
195
  pred_prev_sample = pred_original_sample_coeff * pred_original_sample + current_sample_coeff * sample
196
 
197
  # 6. Add noise
 
74
  "Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler"
75
  )
76
 
77
+ # See formulas (12) and (16) of DDIM paper https://huggingface.co/papers/2010.02502
78
  # Ideally, read DDIM paper in-detail understanding
79
 
80
  # Notation (<variable name> -> <name in paper>
 
95
  beta_prod_t = 1 - alpha_prod_t
96
 
97
  # 3. compute predicted original sample from predicted noise also called
98
+ # "predicted x_0" of formula (12) from https://huggingface.co/papers/2010.02502
99
  pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
100
 
101
  # 4. Clip "predicted x_0"
 
112
  # the model_output is always re-derived from the clipped x_0 in Glide
113
  model_output = (sample - alpha_prod_t ** (0.5) * pred_original_sample) / beta_prod_t ** (0.5)
114
 
115
+ # 6. compute "direction pointing to x_t" of formula (12) from https://huggingface.co/papers/2010.02502
116
  pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * model_output
117
 
118
+ # 7. compute x_t without "random noise" of formula (12) from https://huggingface.co/papers/2010.02502
119
  prev_sample = alpha_prod_t_prev ** (0.5) * pred_original_sample + pred_sample_direction
120
 
121
  if eta > 0:
 
172
  beta_prod_t_prev = 1 - alpha_prod_t_prev
173
 
174
  # 2. compute predicted original sample from predicted noise also called
175
+ # "predicted x_0" of formula (15) from https://huggingface.co/papers/2006.11239
176
  if prediction_type == "epsilon":
177
  pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
178
  elif prediction_type == "sample":
 
186
  pred_original_sample = torch.clamp(pred_original_sample, -scale, scale)
187
 
188
  # 4. Compute coefficients for pred_original_sample x_0 and current sample x_t
189
+ # See formula (7) from https://huggingface.co/papers/2006.11239
190
  pred_original_sample_coeff = (alpha_prod_t_prev ** (0.5) * self.betas[t]) / beta_prod_t
191
  current_sample_coeff = self.alphas[t] ** (0.5) * beta_prod_t_prev / beta_prod_t
192
 
193
  # 5. Compute predicted previous sample µ_t
194
+ # See formula (7) from https://huggingface.co/papers/2006.11239
195
  pred_prev_sample = pred_original_sample_coeff * pred_original_sample + current_sample_coeff * sample
196
 
197
  # 6. Add noise
main/clip_guided_images_mixing_stable_diffusion.py CHANGED
@@ -197,7 +197,7 @@ class CLIPGuidedImagesMixingStableDiffusion(DiffusionPipeline, StableDiffusionMi
197
  alpha_prod_t = self.scheduler.alphas_cumprod[timestep]
198
  beta_prod_t = 1 - alpha_prod_t
199
  # compute predicted original sample from predicted noise also called
200
- # "predicted x_0" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
201
  pred_original_sample = (latents - beta_prod_t ** (0.5) * noise_pred) / alpha_prod_t ** (0.5)
202
 
203
  fac = torch.sqrt(beta_prod_t)
@@ -343,7 +343,7 @@ class CLIPGuidedImagesMixingStableDiffusion(DiffusionPipeline, StableDiffusionMi
343
  )
344
 
345
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
346
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
347
  # corresponds to doing no classifier free guidance.
348
  do_classifier_free_guidance = guidance_scale > 1.0
349
  # get unconditional embeddings for classifier free guidance
@@ -384,7 +384,7 @@ class CLIPGuidedImagesMixingStableDiffusion(DiffusionPipeline, StableDiffusionMi
384
 
385
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
386
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
387
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
388
  # and should be between [0, 1]
389
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
390
  extra_step_kwargs = {}
 
197
  alpha_prod_t = self.scheduler.alphas_cumprod[timestep]
198
  beta_prod_t = 1 - alpha_prod_t
199
  # compute predicted original sample from predicted noise also called
200
+ # "predicted x_0" of formula (12) from https://huggingface.co/papers/2010.02502
201
  pred_original_sample = (latents - beta_prod_t ** (0.5) * noise_pred) / alpha_prod_t ** (0.5)
202
 
203
  fac = torch.sqrt(beta_prod_t)
 
343
  )
344
 
345
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
346
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
347
  # corresponds to doing no classifier free guidance.
348
  do_classifier_free_guidance = guidance_scale > 1.0
349
  # get unconditional embeddings for classifier free guidance
 
384
 
385
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
386
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
387
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
388
  # and should be between [0, 1]
389
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
390
  extra_step_kwargs = {}
main/clip_guided_stable_diffusion.py CHANGED
@@ -125,7 +125,7 @@ class CLIPGuidedStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
125
  alpha_prod_t = self.scheduler.alphas_cumprod[timestep]
126
  beta_prod_t = 1 - alpha_prod_t
127
  # compute predicted original sample from predicted noise also called
128
- # "predicted x_0" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
129
  pred_original_sample = (latents - beta_prod_t ** (0.5) * noise_pred) / alpha_prod_t ** (0.5)
130
 
131
  fac = torch.sqrt(beta_prod_t)
@@ -223,7 +223,7 @@ class CLIPGuidedStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
223
  text_embeddings_clip = text_embeddings_clip.repeat_interleave(num_images_per_prompt, dim=0)
224
 
225
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
226
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
227
  # corresponds to doing no classifier free guidance.
228
  do_classifier_free_guidance = guidance_scale > 1.0
229
  # get unconditional embeddings for classifier free guidance
@@ -276,7 +276,7 @@ class CLIPGuidedStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
276
 
277
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
278
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
279
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
280
  # and should be between [0, 1]
281
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
282
  extra_step_kwargs = {}
 
125
  alpha_prod_t = self.scheduler.alphas_cumprod[timestep]
126
  beta_prod_t = 1 - alpha_prod_t
127
  # compute predicted original sample from predicted noise also called
128
+ # "predicted x_0" of formula (12) from https://huggingface.co/papers/2010.02502
129
  pred_original_sample = (latents - beta_prod_t ** (0.5) * noise_pred) / alpha_prod_t ** (0.5)
130
 
131
  fac = torch.sqrt(beta_prod_t)
 
223
  text_embeddings_clip = text_embeddings_clip.repeat_interleave(num_images_per_prompt, dim=0)
224
 
225
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
226
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
227
  # corresponds to doing no classifier free guidance.
228
  do_classifier_free_guidance = guidance_scale > 1.0
229
  # get unconditional embeddings for classifier free guidance
 
276
 
277
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
278
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
279
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
280
  # and should be between [0, 1]
281
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
282
  extra_step_kwargs = {}
main/clip_guided_stable_diffusion_img2img.py CHANGED
@@ -260,7 +260,7 @@ class CLIPGuidedStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
260
  alpha_prod_t = self.scheduler.alphas_cumprod[timestep]
261
  beta_prod_t = 1 - alpha_prod_t
262
  # compute predicted original sample from predicted noise also called
263
- # "predicted x_0" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
264
  pred_original_sample = (latents - beta_prod_t ** (0.5) * noise_pred) / alpha_prod_t ** (0.5)
265
 
266
  fac = torch.sqrt(beta_prod_t)
@@ -387,7 +387,7 @@ class CLIPGuidedStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
387
  text_embeddings_clip = text_embeddings_clip.repeat_interleave(num_images_per_prompt, dim=0)
388
 
389
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
390
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
391
  # corresponds to doing no classifier free guidance.
392
  do_classifier_free_guidance = guidance_scale > 1.0
393
  # get unconditional embeddings for classifier free guidance
@@ -428,7 +428,7 @@ class CLIPGuidedStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
428
 
429
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
430
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
431
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
432
  # and should be between [0, 1]
433
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
434
  extra_step_kwargs = {}
 
260
  alpha_prod_t = self.scheduler.alphas_cumprod[timestep]
261
  beta_prod_t = 1 - alpha_prod_t
262
  # compute predicted original sample from predicted noise also called
263
+ # "predicted x_0" of formula (12) from https://huggingface.co/papers/2010.02502
264
  pred_original_sample = (latents - beta_prod_t ** (0.5) * noise_pred) / alpha_prod_t ** (0.5)
265
 
266
  fac = torch.sqrt(beta_prod_t)
 
387
  text_embeddings_clip = text_embeddings_clip.repeat_interleave(num_images_per_prompt, dim=0)
388
 
389
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
390
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
391
  # corresponds to doing no classifier free guidance.
392
  do_classifier_free_guidance = guidance_scale > 1.0
393
  # get unconditional embeddings for classifier free guidance
 
428
 
429
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
430
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
431
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
432
  # and should be between [0, 1]
433
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
434
  extra_step_kwargs = {}
main/cogvideox_ddim_inversion.py CHANGED
@@ -462,7 +462,7 @@ class CogVideoXPipelineForDDIMInversion(CogVideoXPipeline):
462
  device = self._execution_device
463
 
464
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
465
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
466
  # corresponds to doing no classifier free guidance.
467
  do_classifier_free_guidance = guidance_scale > 1.0
468
 
 
462
  device = self._execution_device
463
 
464
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
465
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
466
  # corresponds to doing no classifier free guidance.
467
  do_classifier_free_guidance = guidance_scale > 1.0
468
 
main/composable_stable_diffusion.py CHANGED
@@ -295,7 +295,7 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin)
295
  def prepare_extra_step_kwargs(self, generator, eta):
296
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
297
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
298
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
299
  # and should be between [0, 1]
300
 
301
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -379,9 +379,9 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin)
379
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
380
  expense of slower inference.
381
  guidance_scale (`float`, *optional*, defaults to 5.0):
382
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
383
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
384
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
385
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
386
  usually at the expense of lower image quality.
387
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -390,7 +390,7 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin)
390
  num_images_per_prompt (`int`, *optional*, defaults to 1):
391
  The number of images to generate per prompt.
392
  eta (`float`, *optional*, defaults to 0.0):
393
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
394
  [`schedulers.DDIMScheduler`], will be ignored for others.
395
  generator (`torch.Generator`, *optional*):
396
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -430,7 +430,7 @@ class ComposableStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin)
430
  batch_size = 1 if isinstance(prompt, str) else len(prompt)
431
  device = self._execution_device
432
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
433
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
434
  # corresponds to doing no classifier free guidance.
435
  do_classifier_free_guidance = guidance_scale > 1.0
436
 
 
295
  def prepare_extra_step_kwargs(self, generator, eta):
296
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
297
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
298
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
299
  # and should be between [0, 1]
300
 
301
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
379
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
380
  expense of slower inference.
381
  guidance_scale (`float`, *optional*, defaults to 5.0):
382
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
383
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
384
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
385
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
386
  usually at the expense of lower image quality.
387
  negative_prompt (`str` or `List[str]`, *optional*):
 
390
  num_images_per_prompt (`int`, *optional*, defaults to 1):
391
  The number of images to generate per prompt.
392
  eta (`float`, *optional*, defaults to 0.0):
393
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
394
  [`schedulers.DDIMScheduler`], will be ignored for others.
395
  generator (`torch.Generator`, *optional*):
396
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
430
  batch_size = 1 if isinstance(prompt, str) else len(prompt)
431
  device = self._execution_device
432
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
433
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
434
  # corresponds to doing no classifier free guidance.
435
  do_classifier_free_guidance = guidance_scale > 1.0
436
 
main/fresco_v2v.py CHANGED
@@ -124,7 +124,7 @@ def flow_warp(feature, flow, mask=False, mode="bilinear", padding_mode="zeros"):
124
  def forward_backward_consistency_check(fwd_flow, bwd_flow, alpha=0.01, beta=0.5):
125
  # fwd_flow, bwd_flow: [B, 2, H, W]
126
  # alpha and beta values are following UnFlow
127
- # (https://arxiv.org/abs/1711.07837)
128
  assert fwd_flow.dim() == 4 and bwd_flow.dim() == 4
129
  assert fwd_flow.size(1) == 2 and bwd_flow.size(1) == 2
130
  flow_mag = torch.norm(fwd_flow, dim=1) + torch.norm(bwd_flow, dim=1) # [B, H, W]
@@ -1703,7 +1703,7 @@ class FrescoV2VPipeline(StableDiffusionControlNetImg2ImgPipeline):
1703
  def prepare_extra_step_kwargs(self, generator, eta):
1704
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
1705
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
1706
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
1707
  # and should be between [0, 1]
1708
 
1709
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -2030,7 +2030,7 @@ class FrescoV2VPipeline(StableDiffusionControlNetImg2ImgPipeline):
2030
  return self._clip_skip
2031
 
2032
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
2033
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
2034
  # corresponds to doing no classifier free guidance.
2035
  @property
2036
  def do_classifier_free_guidance(self):
@@ -2109,7 +2109,7 @@ class FrescoV2VPipeline(StableDiffusionControlNetImg2ImgPipeline):
2109
  num_images_per_prompt (`int`, *optional*, defaults to 1):
2110
  The number of images to generate per prompt.
2111
  eta (`float`, *optional*, defaults to 0.0):
2112
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
2113
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
2114
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
2115
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
124
  def forward_backward_consistency_check(fwd_flow, bwd_flow, alpha=0.01, beta=0.5):
125
  # fwd_flow, bwd_flow: [B, 2, H, W]
126
  # alpha and beta values are following UnFlow
127
+ # (https://huggingface.co/papers/1711.07837)
128
  assert fwd_flow.dim() == 4 and bwd_flow.dim() == 4
129
  assert fwd_flow.size(1) == 2 and bwd_flow.size(1) == 2
130
  flow_mag = torch.norm(fwd_flow, dim=1) + torch.norm(bwd_flow, dim=1) # [B, H, W]
 
1703
  def prepare_extra_step_kwargs(self, generator, eta):
1704
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
1705
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
1706
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
1707
  # and should be between [0, 1]
1708
 
1709
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
2030
  return self._clip_skip
2031
 
2032
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
2033
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
2034
  # corresponds to doing no classifier free guidance.
2035
  @property
2036
  def do_classifier_free_guidance(self):
 
2109
  num_images_per_prompt (`int`, *optional*, defaults to 1):
2110
  The number of images to generate per prompt.
2111
  eta (`float`, *optional*, defaults to 0.0):
2112
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
2113
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
2114
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
2115
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
main/gluegen.py CHANGED
@@ -139,7 +139,7 @@ class TranslatorNoLN(nn.Module):
139
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
140
  """
141
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
142
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
143
  """
144
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
145
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -447,7 +447,7 @@ class GlueGenStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin, St
447
  def prepare_extra_step_kwargs(self, generator, eta):
448
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
449
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
450
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
451
  # and should be between [0, 1]
452
 
453
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -563,7 +563,7 @@ class GlueGenStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin, St
563
  return self._clip_skip
564
 
565
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
566
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
567
  # corresponds to doing no classifier free guidance.
568
  @property
569
  def do_classifier_free_guidance(self):
@@ -630,7 +630,7 @@ class GlueGenStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin, St
630
  num_images_per_prompt (`int`, *optional*, defaults to 1):
631
  The number of images to generate per prompt.
632
  eta (`float`, *optional*, defaults to 0.0):
633
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
634
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
635
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
636
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -656,7 +656,7 @@ class GlueGenStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin, St
656
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
657
  guidance_rescale (`float`, *optional*, defaults to 0.0):
658
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
659
- Flawed](https://arxiv.org/pdf/2305.08891.pdf). Guidance rescale factor should fix overexposure when
660
  using zero terminal SNR.
661
  clip_skip (`int`, *optional*):
662
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
@@ -781,7 +781,7 @@ class GlueGenStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin, St
781
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
782
 
783
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
784
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
785
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
786
 
787
  # compute the previous noisy sample x_t -> x_t-1
 
139
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
140
  """
141
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
142
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
143
  """
144
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
145
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
447
  def prepare_extra_step_kwargs(self, generator, eta):
448
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
449
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
450
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
451
  # and should be between [0, 1]
452
 
453
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
563
  return self._clip_skip
564
 
565
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
566
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
567
  # corresponds to doing no classifier free guidance.
568
  @property
569
  def do_classifier_free_guidance(self):
 
630
  num_images_per_prompt (`int`, *optional*, defaults to 1):
631
  The number of images to generate per prompt.
632
  eta (`float`, *optional*, defaults to 0.0):
633
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
634
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
635
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
636
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
656
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
657
  guidance_rescale (`float`, *optional*, defaults to 0.0):
658
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
659
+ Flawed](https://huggingface.co/papers/2305.08891). Guidance rescale factor should fix overexposure when
660
  using zero terminal SNR.
661
  clip_skip (`int`, *optional*):
662
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
 
781
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
782
 
783
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
784
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
785
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
786
 
787
  # compute the previous noisy sample x_t -> x_t-1
main/iadb.py CHANGED
@@ -12,7 +12,7 @@ class IADBScheduler(SchedulerMixin, ConfigMixin):
12
  """
13
  IADBScheduler is a scheduler for the Iterative α-(de)Blending denoising method. It is simple and minimalist.
14
 
15
- For more details, see the original paper: https://arxiv.org/abs/2305.03486 and the blog post: https://ggx-research.github.io/publication/2023/05/10/publication-iadb.html
16
  """
17
 
18
  def step(
 
12
  """
13
  IADBScheduler is a scheduler for the Iterative α-(de)Blending denoising method. It is simple and minimalist.
14
 
15
+ For more details, see the original paper: https://huggingface.co/papers/2305.03486 and the blog post: https://ggx-research.github.io/publication/2023/05/10/publication-iadb.html
16
  """
17
 
18
  def step(
main/imagic_stable_diffusion.py CHANGED
@@ -61,7 +61,7 @@ def preprocess(image):
61
  class ImagicStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
62
  r"""
63
  Pipeline for imagic image editing.
64
- See paper here: https://arxiv.org/pdf/2210.09276.pdf
65
 
66
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
67
  library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
@@ -133,13 +133,13 @@ class ImagicStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
133
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
134
  expense of slower inference.
135
  guidance_scale (`float`, *optional*, defaults to 7.5):
136
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
137
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
138
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
139
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
140
  usually at the expense of lower image quality.
141
  eta (`float`, *optional*, defaults to 0.0):
142
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
143
  [`schedulers.DDIMScheduler`], will be ignored for others.
144
  generator (`torch.Generator`, *optional*):
145
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -334,9 +334,9 @@ class ImagicStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
334
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
335
  expense of slower inference.
336
  guidance_scale (`float`, *optional*, defaults to 7.5):
337
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
338
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
339
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
340
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
341
  usually at the expense of lower image quality.
342
  generator (`torch.Generator`, *optional*):
@@ -349,7 +349,7 @@ class ImagicStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
349
  Whether or not to return a [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] instead of a
350
  plain tuple.
351
  eta (`float`, *optional*, defaults to 0.0):
352
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
353
  [`schedulers.DDIMScheduler`], will be ignored for others.
354
  Returns:
355
  [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] or `tuple`:
@@ -368,7 +368,7 @@ class ImagicStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
368
  text_embeddings = alpha * self.text_embeddings_orig + (1 - alpha) * self.text_embeddings
369
 
370
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
371
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
372
  # corresponds to doing no classifier free guidance.
373
  do_classifier_free_guidance = guidance_scale > 1.0
374
  # get unconditional embeddings for classifier free guidance
@@ -420,7 +420,7 @@ class ImagicStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
420
 
421
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
422
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
423
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
424
  # and should be between [0, 1]
425
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
426
  extra_step_kwargs = {}
 
61
  class ImagicStableDiffusionPipeline(DiffusionPipeline, StableDiffusionMixin):
62
  r"""
63
  Pipeline for imagic image editing.
64
+ See paper here: https://huggingface.co/papers/2210.09276
65
 
66
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
67
  library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
 
133
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
134
  expense of slower inference.
135
  guidance_scale (`float`, *optional*, defaults to 7.5):
136
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
137
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
138
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
139
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
140
  usually at the expense of lower image quality.
141
  eta (`float`, *optional*, defaults to 0.0):
142
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
143
  [`schedulers.DDIMScheduler`], will be ignored for others.
144
  generator (`torch.Generator`, *optional*):
145
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
334
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
335
  expense of slower inference.
336
  guidance_scale (`float`, *optional*, defaults to 7.5):
337
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
338
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
339
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
340
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
341
  usually at the expense of lower image quality.
342
  generator (`torch.Generator`, *optional*):
 
349
  Whether or not to return a [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] instead of a
350
  plain tuple.
351
  eta (`float`, *optional*, defaults to 0.0):
352
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
353
  [`schedulers.DDIMScheduler`], will be ignored for others.
354
  Returns:
355
  [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] or `tuple`:
 
368
  text_embeddings = alpha * self.text_embeddings_orig + (1 - alpha) * self.text_embeddings
369
 
370
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
371
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
372
  # corresponds to doing no classifier free guidance.
373
  do_classifier_free_guidance = guidance_scale > 1.0
374
  # get unconditional embeddings for classifier free guidance
 
420
 
421
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
422
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
423
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
424
  # and should be between [0, 1]
425
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
426
  extra_step_kwargs = {}
main/img2img_inpainting.py CHANGED
@@ -178,9 +178,9 @@ class ImageToImageInpaintingPipeline(DiffusionPipeline):
178
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
179
  expense of slower inference.
180
  guidance_scale (`float`, *optional*, defaults to 7.5):
181
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
182
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
183
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
184
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
185
  usually at the expense of lower image quality.
186
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -189,7 +189,7 @@ class ImageToImageInpaintingPipeline(DiffusionPipeline):
189
  num_images_per_prompt (`int`, *optional*, defaults to 1):
190
  The number of images to generate per prompt.
191
  eta (`float`, *optional*, defaults to 0.0):
192
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
193
  [`schedulers.DDIMScheduler`], will be ignored for others.
194
  generator (`torch.Generator`, *optional*):
195
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -266,7 +266,7 @@ class ImageToImageInpaintingPipeline(DiffusionPipeline):
266
  text_embeddings = text_embeddings.view(bs_embed * num_images_per_prompt, seq_len, -1)
267
 
268
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
269
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
270
  # corresponds to doing no classifier free guidance.
271
  do_classifier_free_guidance = guidance_scale > 1.0
272
  # get unconditional embeddings for classifier free guidance
@@ -378,7 +378,7 @@ class ImageToImageInpaintingPipeline(DiffusionPipeline):
378
 
379
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
380
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
381
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
382
  # and should be between [0, 1]
383
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
384
  extra_step_kwargs = {}
 
178
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
179
  expense of slower inference.
180
  guidance_scale (`float`, *optional*, defaults to 7.5):
181
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
182
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
183
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
184
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
185
  usually at the expense of lower image quality.
186
  negative_prompt (`str` or `List[str]`, *optional*):
 
189
  num_images_per_prompt (`int`, *optional*, defaults to 1):
190
  The number of images to generate per prompt.
191
  eta (`float`, *optional*, defaults to 0.0):
192
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
193
  [`schedulers.DDIMScheduler`], will be ignored for others.
194
  generator (`torch.Generator`, *optional*):
195
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
266
  text_embeddings = text_embeddings.view(bs_embed * num_images_per_prompt, seq_len, -1)
267
 
268
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
269
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
270
  # corresponds to doing no classifier free guidance.
271
  do_classifier_free_guidance = guidance_scale > 1.0
272
  # get unconditional embeddings for classifier free guidance
 
378
 
379
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
380
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
381
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
382
  # and should be between [0, 1]
383
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
384
  extra_step_kwargs = {}
main/instaflow_one_step.py CHANGED
@@ -41,7 +41,7 @@ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
41
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
42
  """
43
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
44
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
45
  """
46
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
47
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -414,7 +414,7 @@ class InstaFlowPipeline(
414
  def prepare_extra_step_kwargs(self, generator, eta):
415
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
416
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
417
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
418
  # and should be between [0, 1]
419
 
420
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -541,7 +541,7 @@ class InstaFlowPipeline(
541
  num_images_per_prompt (`int`, *optional*, defaults to 1):
542
  The number of images to generate per prompt.
543
  eta (`float`, *optional*, defaults to 0.0):
544
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
545
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
546
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
547
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -572,7 +572,7 @@ class InstaFlowPipeline(
572
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
573
  guidance_rescale (`float`, *optional*, defaults to 0.7):
574
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
575
- Flawed](https://arxiv.org/pdf/2305.08891.pdf). Guidance rescale factor should fix overexposure when
576
  using zero terminal SNR.
577
 
578
  Examples:
@@ -603,7 +603,7 @@ class InstaFlowPipeline(
603
 
604
  device = self._execution_device
605
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
606
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
607
  # corresponds to doing no classifier free guidance.
608
  do_classifier_free_guidance = guidance_scale > 1.0
609
 
 
41
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
42
  """
43
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
44
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
45
  """
46
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
47
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
414
  def prepare_extra_step_kwargs(self, generator, eta):
415
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
416
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
417
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
418
  # and should be between [0, 1]
419
 
420
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
541
  num_images_per_prompt (`int`, *optional*, defaults to 1):
542
  The number of images to generate per prompt.
543
  eta (`float`, *optional*, defaults to 0.0):
544
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
545
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
546
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
547
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
572
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
573
  guidance_rescale (`float`, *optional*, defaults to 0.7):
574
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
575
+ Flawed](https://huggingface.co/papers/2305.08891). Guidance rescale factor should fix overexposure when
576
  using zero terminal SNR.
577
 
578
  Examples:
 
603
 
604
  device = self._execution_device
605
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
606
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
607
  # corresponds to doing no classifier free guidance.
608
  do_classifier_free_guidance = guidance_scale > 1.0
609
 
main/interpolate_stable_diffusion.py CHANGED
@@ -154,9 +154,9 @@ class StableDiffusionWalkPipeline(DiffusionPipeline, StableDiffusionMixin):
154
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
155
  expense of slower inference.
156
  guidance_scale (`float`, *optional*, defaults to 7.5):
157
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
158
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
159
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
160
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
161
  usually at the expense of lower image quality.
162
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -165,7 +165,7 @@ class StableDiffusionWalkPipeline(DiffusionPipeline, StableDiffusionMixin):
165
  num_images_per_prompt (`int`, *optional*, defaults to 1):
166
  The number of images to generate per prompt.
167
  eta (`float`, *optional*, defaults to 0.0):
168
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
169
  [`schedulers.DDIMScheduler`], will be ignored for others.
170
  generator (`torch.Generator`, *optional*):
171
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -244,7 +244,7 @@ class StableDiffusionWalkPipeline(DiffusionPipeline, StableDiffusionMixin):
244
  text_embeddings = text_embeddings.view(bs_embed * num_images_per_prompt, seq_len, -1)
245
 
246
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
247
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
248
  # corresponds to doing no classifier free guidance.
249
  do_classifier_free_guidance = guidance_scale > 1.0
250
  # get unconditional embeddings for classifier free guidance
@@ -320,7 +320,7 @@ class StableDiffusionWalkPipeline(DiffusionPipeline, StableDiffusionMixin):
320
 
321
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
322
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
323
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
324
  # and should be between [0, 1]
325
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
326
  extra_step_kwargs = {}
@@ -432,16 +432,16 @@ class StableDiffusionWalkPipeline(DiffusionPipeline, StableDiffusionMixin):
432
  width (`int`, *optional*, defaults to 512):
433
  Width of the generated images.
434
  guidance_scale (`float`, *optional*, defaults to 7.5):
435
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
436
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
437
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
438
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
439
  usually at the expense of lower image quality.
440
  num_inference_steps (`int`, *optional*, defaults to 50):
441
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
442
  expense of slower inference.
443
  eta (`float`, *optional*, defaults to 0.0):
444
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
445
  [`schedulers.DDIMScheduler`], will be ignored for others.
446
 
447
  Returns:
 
154
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
155
  expense of slower inference.
156
  guidance_scale (`float`, *optional*, defaults to 7.5):
157
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
158
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
159
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
160
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
161
  usually at the expense of lower image quality.
162
  negative_prompt (`str` or `List[str]`, *optional*):
 
165
  num_images_per_prompt (`int`, *optional*, defaults to 1):
166
  The number of images to generate per prompt.
167
  eta (`float`, *optional*, defaults to 0.0):
168
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
169
  [`schedulers.DDIMScheduler`], will be ignored for others.
170
  generator (`torch.Generator`, *optional*):
171
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
244
  text_embeddings = text_embeddings.view(bs_embed * num_images_per_prompt, seq_len, -1)
245
 
246
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
247
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
248
  # corresponds to doing no classifier free guidance.
249
  do_classifier_free_guidance = guidance_scale > 1.0
250
  # get unconditional embeddings for classifier free guidance
 
320
 
321
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
322
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
323
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
324
  # and should be between [0, 1]
325
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
326
  extra_step_kwargs = {}
 
432
  width (`int`, *optional*, defaults to 512):
433
  Width of the generated images.
434
  guidance_scale (`float`, *optional*, defaults to 7.5):
435
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
436
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
437
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
438
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
439
  usually at the expense of lower image quality.
440
  num_inference_steps (`int`, *optional*, defaults to 50):
441
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
442
  expense of slower inference.
443
  eta (`float`, *optional*, defaults to 0.0):
444
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
445
  [`schedulers.DDIMScheduler`], will be ignored for others.
446
 
447
  Returns:
main/ip_adapter_face_id.py CHANGED
@@ -76,7 +76,7 @@ class IPAdapterFullImageProjection(nn.Module):
76
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
77
  """
78
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
79
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
80
  """
81
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
82
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -693,7 +693,7 @@ class IPAdapterFaceIDStableDiffusionPipeline(
693
  def prepare_extra_step_kwargs(self, generator, eta):
694
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
695
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
696
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
697
  # and should be between [0, 1]
698
 
699
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -823,7 +823,7 @@ class IPAdapterFaceIDStableDiffusionPipeline(
823
  return self._clip_skip
824
 
825
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
826
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
827
  # corresponds to doing no classifier free guidance.
828
  @property
829
  def do_classifier_free_guidance(self):
@@ -893,7 +893,7 @@ class IPAdapterFaceIDStableDiffusionPipeline(
893
  num_images_per_prompt (`int`, *optional*, defaults to 1):
894
  The number of images to generate per prompt.
895
  eta (`float`, *optional*, defaults to 0.0):
896
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
897
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
898
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
899
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -920,7 +920,7 @@ class IPAdapterFaceIDStableDiffusionPipeline(
920
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
921
  guidance_rescale (`float`, *optional*, defaults to 0.0):
922
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
923
- Flawed](https://arxiv.org/pdf/2305.08891.pdf). Guidance rescale factor should fix overexposure when
924
  using zero terminal SNR.
925
  clip_skip (`int`, *optional*):
926
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
@@ -1084,7 +1084,7 @@ class IPAdapterFaceIDStableDiffusionPipeline(
1084
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1085
 
1086
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1087
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1088
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1089
 
1090
  # compute the previous noisy sample x_t -> x_t-1
 
76
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
77
  """
78
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
79
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
80
  """
81
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
82
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
693
  def prepare_extra_step_kwargs(self, generator, eta):
694
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
695
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
696
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
697
  # and should be between [0, 1]
698
 
699
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
823
  return self._clip_skip
824
 
825
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
826
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
827
  # corresponds to doing no classifier free guidance.
828
  @property
829
  def do_classifier_free_guidance(self):
 
893
  num_images_per_prompt (`int`, *optional*, defaults to 1):
894
  The number of images to generate per prompt.
895
  eta (`float`, *optional*, defaults to 0.0):
896
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
897
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
898
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
899
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
920
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
921
  guidance_rescale (`float`, *optional*, defaults to 0.0):
922
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
923
+ Flawed](https://huggingface.co/papers/2305.08891). Guidance rescale factor should fix overexposure when
924
  using zero terminal SNR.
925
  clip_skip (`int`, *optional*):
926
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
 
1084
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1085
 
1086
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1087
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1088
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1089
 
1090
  # compute the previous noisy sample x_t -> x_t-1
main/latent_consistency_img2img.py CHANGED
@@ -450,7 +450,7 @@ def betas_for_alpha_bar(
450
 
451
  def rescale_zero_terminal_snr(betas):
452
  """
453
- Rescales betas to have zero terminal SNR Based on https://arxiv.org/pdf/2305.08891.pdf (Algorithm 1)
454
  Args:
455
  betas (`torch.Tensor`):
456
  the betas that the scheduler is being initialized with.
@@ -620,7 +620,7 @@ class LCMSchedulerWithTimestamp(SchedulerMixin, ConfigMixin):
620
  s. Dynamic thresholding pushes saturated pixels (those near -1 and 1) inwards, thereby actively preventing
621
  pixels from saturation at each step. We find that dynamic thresholding results in significantly better
622
  photorealism as well as better image-text alignment, especially when using very large guidance weights."
623
- https://arxiv.org/abs/2205.11487
624
  """
625
  dtype = sample.dtype
626
  batch_size, channels, height, width = sample.shape
 
450
 
451
  def rescale_zero_terminal_snr(betas):
452
  """
453
+ Rescales betas to have zero terminal SNR Based on https://huggingface.co/papers/2305.08891 (Algorithm 1)
454
  Args:
455
  betas (`torch.Tensor`):
456
  the betas that the scheduler is being initialized with.
 
620
  s. Dynamic thresholding pushes saturated pixels (those near -1 and 1) inwards, thereby actively preventing
621
  pixels from saturation at each step. We find that dynamic thresholding results in significantly better
622
  photorealism as well as better image-text alignment, especially when using very large guidance weights."
623
+ https://huggingface.co/papers/2205.11487
624
  """
625
  dtype = sample.dtype
626
  batch_size, channels, height, width = sample.shape
main/latent_consistency_interpolate.py CHANGED
@@ -529,7 +529,7 @@ class LatentConsistencyModelWalkPipeline(
529
  def prepare_extra_step_kwargs(self, generator, eta):
530
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
531
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
532
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
533
  # and should be between [0, 1]
534
 
535
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
529
  def prepare_extra_step_kwargs(self, generator, eta):
530
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
531
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
532
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
533
  # and should be between [0, 1]
534
 
535
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
main/latent_consistency_txt2img.py CHANGED
@@ -365,7 +365,7 @@ def betas_for_alpha_bar(
365
 
366
  def rescale_zero_terminal_snr(betas):
367
  """
368
- Rescales betas to have zero terminal SNR Based on https://arxiv.org/pdf/2305.08891.pdf (Algorithm 1)
369
  Args:
370
  betas (`torch.Tensor`):
371
  the betas that the scheduler is being initialized with.
@@ -532,7 +532,7 @@ class LCMScheduler(SchedulerMixin, ConfigMixin):
532
  s. Dynamic thresholding pushes saturated pixels (those near -1 and 1) inwards, thereby actively preventing
533
  pixels from saturation at each step. We find that dynamic thresholding results in significantly better
534
  photorealism as well as better image-text alignment, especially when using very large guidance weights."
535
- https://arxiv.org/abs/2205.11487
536
  """
537
  dtype = sample.dtype
538
  batch_size, channels, height, width = sample.shape
 
365
 
366
  def rescale_zero_terminal_snr(betas):
367
  """
368
+ Rescales betas to have zero terminal SNR Based on https://huggingface.co/papers/2305.08891 (Algorithm 1)
369
  Args:
370
  betas (`torch.Tensor`):
371
  the betas that the scheduler is being initialized with.
 
532
  s. Dynamic thresholding pushes saturated pixels (those near -1 and 1) inwards, thereby actively preventing
533
  pixels from saturation at each step. We find that dynamic thresholding results in significantly better
534
  photorealism as well as better image-text alignment, especially when using very large guidance weights."
535
+ https://huggingface.co/papers/2205.11487
536
  """
537
  dtype = sample.dtype
538
  batch_size, channels, height, width = sample.shape
main/llm_grounded_diffusion.py CHANGED
@@ -281,7 +281,7 @@ class LLMGroundedDiffusionPipeline(
281
  FromSingleFileMixin,
282
  ):
283
  r"""
284
- Pipeline for layout-grounded text-to-image generation using LLM-grounded Diffusion (LMD+): https://arxiv.org/pdf/2305.13655.pdf.
285
 
286
  This model inherits from [`StableDiffusionPipeline`] and aims at implementing the pipeline with minimal modifications. Check the superclass documentation for the generic methods
287
  implemented for all pipelines (downloading, saving, running on a particular device, etc.).
@@ -803,7 +803,7 @@ class LLMGroundedDiffusionPipeline(
803
  `List[float]` of 4 elements `[xmin, ymin, xmax, ymax]` where each value is between [0,1].
804
  gligen_scheduled_sampling_beta (`float`, defaults to 0.3):
805
  Scheduled Sampling factor from [GLIGEN: Open-Set Grounded Text-to-Image
806
- Generation](https://arxiv.org/pdf/2301.07093.pdf). Scheduled Sampling factor is only varied for
807
  scheduled sampling during inference for improved quality and controllability.
808
  negative_prompt (`str` or `List[str]`, *optional*):
809
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
@@ -811,7 +811,7 @@ class LLMGroundedDiffusionPipeline(
811
  num_images_per_prompt (`int`, *optional*, defaults to 1):
812
  The number of images to generate per prompt.
813
  eta (`float`, *optional*, defaults to 0.0):
814
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
815
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
816
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
817
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -843,7 +843,7 @@ class LLMGroundedDiffusionPipeline(
843
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
844
  guidance_rescale (`float`, *optional*, defaults to 0.0):
845
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
846
- Flawed](https://arxiv.org/pdf/2305.08891.pdf). Guidance rescale factor should fix overexposure when
847
  using zero terminal SNR.
848
  clip_skip (`int`, *optional*):
849
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
@@ -901,7 +901,7 @@ class LLMGroundedDiffusionPipeline(
901
 
902
  device = self._execution_device
903
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
904
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
905
  # corresponds to doing no classifier free guidance.
906
  do_classifier_free_guidance = guidance_scale > 1.0
907
 
@@ -1171,8 +1171,8 @@ class LLMGroundedDiffusionPipeline(
1171
 
1172
  # Scaling with classifier guidance
1173
  alpha_prod_t = scheduler.alphas_cumprod[t]
1174
- # Classifier guidance: https://arxiv.org/pdf/2105.05233.pdf
1175
- # DDIM: https://arxiv.org/pdf/2010.02502.pdf
1176
  scale = (1 - alpha_prod_t) ** (0.5)
1177
  latents = latents - scale * grad_cond
1178
 
@@ -1457,7 +1457,7 @@ class LLMGroundedDiffusionPipeline(
1457
  def prepare_extra_step_kwargs(self, generator, eta):
1458
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
1459
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
1460
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
1461
  # and should be between [0, 1]
1462
 
1463
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -1549,7 +1549,7 @@ class LLMGroundedDiffusionPipeline(
1549
  return self._clip_skip
1550
 
1551
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1552
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1553
  # corresponds to doing no classifier free guidance.
1554
  @property
1555
  # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.do_classifier_free_guidance
 
281
  FromSingleFileMixin,
282
  ):
283
  r"""
284
+ Pipeline for layout-grounded text-to-image generation using LLM-grounded Diffusion (LMD+): https://huggingface.co/papers/2305.13655.
285
 
286
  This model inherits from [`StableDiffusionPipeline`] and aims at implementing the pipeline with minimal modifications. Check the superclass documentation for the generic methods
287
  implemented for all pipelines (downloading, saving, running on a particular device, etc.).
 
803
  `List[float]` of 4 elements `[xmin, ymin, xmax, ymax]` where each value is between [0,1].
804
  gligen_scheduled_sampling_beta (`float`, defaults to 0.3):
805
  Scheduled Sampling factor from [GLIGEN: Open-Set Grounded Text-to-Image
806
+ Generation](https://huggingface.co/papers/2301.07093). Scheduled Sampling factor is only varied for
807
  scheduled sampling during inference for improved quality and controllability.
808
  negative_prompt (`str` or `List[str]`, *optional*):
809
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
 
811
  num_images_per_prompt (`int`, *optional*, defaults to 1):
812
  The number of images to generate per prompt.
813
  eta (`float`, *optional*, defaults to 0.0):
814
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
815
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
816
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
817
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
843
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
844
  guidance_rescale (`float`, *optional*, defaults to 0.0):
845
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
846
+ Flawed](https://huggingface.co/papers/2305.08891). Guidance rescale factor should fix overexposure when
847
  using zero terminal SNR.
848
  clip_skip (`int`, *optional*):
849
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
 
901
 
902
  device = self._execution_device
903
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
904
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
905
  # corresponds to doing no classifier free guidance.
906
  do_classifier_free_guidance = guidance_scale > 1.0
907
 
 
1171
 
1172
  # Scaling with classifier guidance
1173
  alpha_prod_t = scheduler.alphas_cumprod[t]
1174
+ # Classifier guidance: https://huggingface.co/papers/2105.05233
1175
+ # DDIM: https://huggingface.co/papers/2010.02502
1176
  scale = (1 - alpha_prod_t) ** (0.5)
1177
  latents = latents - scale * grad_cond
1178
 
 
1457
  def prepare_extra_step_kwargs(self, generator, eta):
1458
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
1459
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
1460
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
1461
  # and should be between [0, 1]
1462
 
1463
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
1549
  return self._clip_skip
1550
 
1551
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1552
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1553
  # corresponds to doing no classifier free guidance.
1554
  @property
1555
  # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.do_classifier_free_guidance
main/lpw_stable_diffusion.py CHANGED
@@ -744,7 +744,7 @@ class StableDiffusionLongPromptWeightingPipeline(
744
  def prepare_extra_step_kwargs(self, generator, eta):
745
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
746
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
747
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
748
  # and should be between [0, 1]
749
 
750
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -863,9 +863,9 @@ class StableDiffusionLongPromptWeightingPipeline(
863
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
864
  expense of slower inference.
865
  guidance_scale (`float`, *optional*, defaults to 7.5):
866
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
867
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
868
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
869
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
870
  usually at the expense of lower image quality.
871
  strength (`float`, *optional*, defaults to 0.8):
@@ -880,7 +880,7 @@ class StableDiffusionLongPromptWeightingPipeline(
880
  Use predicted noise instead of random noise when constructing noisy versions of the original image in
881
  the reverse diffusion process
882
  eta (`float`, *optional*, defaults to 0.0):
883
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
884
  [`schedulers.DDIMScheduler`], will be ignored for others.
885
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
886
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -948,7 +948,7 @@ class StableDiffusionLongPromptWeightingPipeline(
948
 
949
  device = self._execution_device
950
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
951
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
952
  # corresponds to doing no classifier free guidance.
953
  do_classifier_free_guidance = guidance_scale > 1.0
954
  lora_scale = cross_attention_kwargs.get("scale", None) if cross_attention_kwargs is not None else None
@@ -1115,15 +1115,15 @@ class StableDiffusionLongPromptWeightingPipeline(
1115
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1116
  expense of slower inference.
1117
  guidance_scale (`float`, *optional*, defaults to 7.5):
1118
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1119
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1120
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1121
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1122
  usually at the expense of lower image quality.
1123
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1124
  The number of images to generate per prompt.
1125
  eta (`float`, *optional*, defaults to 0.0):
1126
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1127
  [`schedulers.DDIMScheduler`], will be ignored for others.
1128
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1129
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -1237,15 +1237,15 @@ class StableDiffusionLongPromptWeightingPipeline(
1237
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1238
  expense of slower inference. This parameter will be modulated by `strength`.
1239
  guidance_scale (`float`, *optional*, defaults to 7.5):
1240
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1241
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1242
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1243
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1244
  usually at the expense of lower image quality.
1245
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1246
  The number of images to generate per prompt.
1247
  eta (`float`, *optional*, defaults to 0.0):
1248
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1249
  [`schedulers.DDIMScheduler`], will be ignored for others.
1250
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1251
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -1355,9 +1355,9 @@ class StableDiffusionLongPromptWeightingPipeline(
1355
  The reference number of denoising steps. More denoising steps usually lead to a higher quality image at
1356
  the expense of slower inference. This parameter will be modulated by `strength`, as explained above.
1357
  guidance_scale (`float`, *optional*, defaults to 7.5):
1358
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1359
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1360
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1361
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1362
  usually at the expense of lower image quality.
1363
  num_images_per_prompt (`int`, *optional*, defaults to 1):
@@ -1366,7 +1366,7 @@ class StableDiffusionLongPromptWeightingPipeline(
1366
  Use predicted noise instead of random noise when constructing noisy versions of the original image in
1367
  the reverse diffusion process
1368
  eta (`float`, *optional*, defaults to 0.0):
1369
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1370
  [`schedulers.DDIMScheduler`], will be ignored for others.
1371
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1372
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
744
  def prepare_extra_step_kwargs(self, generator, eta):
745
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
746
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
747
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
748
  # and should be between [0, 1]
749
 
750
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
863
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
864
  expense of slower inference.
865
  guidance_scale (`float`, *optional*, defaults to 7.5):
866
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
867
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
868
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
869
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
870
  usually at the expense of lower image quality.
871
  strength (`float`, *optional*, defaults to 0.8):
 
880
  Use predicted noise instead of random noise when constructing noisy versions of the original image in
881
  the reverse diffusion process
882
  eta (`float`, *optional*, defaults to 0.0):
883
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
884
  [`schedulers.DDIMScheduler`], will be ignored for others.
885
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
886
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
948
 
949
  device = self._execution_device
950
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
951
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
952
  # corresponds to doing no classifier free guidance.
953
  do_classifier_free_guidance = guidance_scale > 1.0
954
  lora_scale = cross_attention_kwargs.get("scale", None) if cross_attention_kwargs is not None else None
 
1115
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1116
  expense of slower inference.
1117
  guidance_scale (`float`, *optional*, defaults to 7.5):
1118
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1119
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1120
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1121
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1122
  usually at the expense of lower image quality.
1123
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1124
  The number of images to generate per prompt.
1125
  eta (`float`, *optional*, defaults to 0.0):
1126
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1127
  [`schedulers.DDIMScheduler`], will be ignored for others.
1128
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1129
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
1237
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1238
  expense of slower inference. This parameter will be modulated by `strength`.
1239
  guidance_scale (`float`, *optional*, defaults to 7.5):
1240
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1241
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1242
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1243
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1244
  usually at the expense of lower image quality.
1245
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1246
  The number of images to generate per prompt.
1247
  eta (`float`, *optional*, defaults to 0.0):
1248
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1249
  [`schedulers.DDIMScheduler`], will be ignored for others.
1250
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1251
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
1355
  The reference number of denoising steps. More denoising steps usually lead to a higher quality image at
1356
  the expense of slower inference. This parameter will be modulated by `strength`, as explained above.
1357
  guidance_scale (`float`, *optional*, defaults to 7.5):
1358
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1359
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1360
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1361
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1362
  usually at the expense of lower image quality.
1363
  num_images_per_prompt (`int`, *optional*, defaults to 1):
 
1366
  Use predicted noise instead of random noise when constructing noisy versions of the original image in
1367
  the reverse diffusion process
1368
  eta (`float`, *optional*, defaults to 0.0):
1369
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1370
  [`schedulers.DDIMScheduler`], will be ignored for others.
1371
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1372
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
main/lpw_stable_diffusion_onnx.py CHANGED
@@ -604,7 +604,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
604
  def prepare_extra_step_kwargs(self, generator, eta):
605
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
606
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
607
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
608
  # and should be between [0, 1]
609
 
610
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -699,9 +699,9 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
699
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
700
  expense of slower inference.
701
  guidance_scale (`float`, *optional*, defaults to 7.5):
702
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
703
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
704
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
705
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
706
  usually at the expense of lower image quality.
707
  strength (`float`, *optional*, defaults to 0.8):
@@ -713,7 +713,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
713
  num_images_per_prompt (`int`, *optional*, defaults to 1):
714
  The number of images to generate per prompt.
715
  eta (`float`, *optional*, defaults to 0.0):
716
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
717
  [`schedulers.DDIMScheduler`], will be ignored for others.
718
  generator (`torch.Generator`, *optional*):
719
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -758,7 +758,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
758
  # 2. Define call parameters
759
  batch_size = 1 if isinstance(prompt, str) else len(prompt)
760
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
761
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
762
  # corresponds to doing no classifier free guidance.
763
  do_classifier_free_guidance = guidance_scale > 1.0
764
 
@@ -902,15 +902,15 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
902
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
903
  expense of slower inference.
904
  guidance_scale (`float`, *optional*, defaults to 7.5):
905
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
906
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
907
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
908
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
909
  usually at the expense of lower image quality.
910
  num_images_per_prompt (`int`, *optional*, defaults to 1):
911
  The number of images to generate per prompt.
912
  eta (`float`, *optional*, defaults to 0.0):
913
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
914
  [`schedulers.DDIMScheduler`], will be ignored for others.
915
  generator (`torch.Generator`, *optional*):
916
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -998,15 +998,15 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
998
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
999
  expense of slower inference. This parameter will be modulated by `strength`.
1000
  guidance_scale (`float`, *optional*, defaults to 7.5):
1001
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1002
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1003
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1004
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1005
  usually at the expense of lower image quality.
1006
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1007
  The number of images to generate per prompt.
1008
  eta (`float`, *optional*, defaults to 0.0):
1009
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1010
  [`schedulers.DDIMScheduler`], will be ignored for others.
1011
  generator (`torch.Generator`, *optional*):
1012
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -1094,15 +1094,15 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
1094
  The reference number of denoising steps. More denoising steps usually lead to a higher quality image at
1095
  the expense of slower inference. This parameter will be modulated by `strength`, as explained above.
1096
  guidance_scale (`float`, *optional*, defaults to 7.5):
1097
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1098
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1099
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1100
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1101
  usually at the expense of lower image quality.
1102
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1103
  The number of images to generate per prompt.
1104
  eta (`float`, *optional*, defaults to 0.0):
1105
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1106
  [`schedulers.DDIMScheduler`], will be ignored for others.
1107
  generator (`torch.Generator`, *optional*):
1108
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
604
  def prepare_extra_step_kwargs(self, generator, eta):
605
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
606
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
607
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
608
  # and should be between [0, 1]
609
 
610
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
699
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
700
  expense of slower inference.
701
  guidance_scale (`float`, *optional*, defaults to 7.5):
702
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
703
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
704
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
705
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
706
  usually at the expense of lower image quality.
707
  strength (`float`, *optional*, defaults to 0.8):
 
713
  num_images_per_prompt (`int`, *optional*, defaults to 1):
714
  The number of images to generate per prompt.
715
  eta (`float`, *optional*, defaults to 0.0):
716
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
717
  [`schedulers.DDIMScheduler`], will be ignored for others.
718
  generator (`torch.Generator`, *optional*):
719
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
758
  # 2. Define call parameters
759
  batch_size = 1 if isinstance(prompt, str) else len(prompt)
760
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
761
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
762
  # corresponds to doing no classifier free guidance.
763
  do_classifier_free_guidance = guidance_scale > 1.0
764
 
 
902
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
903
  expense of slower inference.
904
  guidance_scale (`float`, *optional*, defaults to 7.5):
905
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
906
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
907
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
908
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
909
  usually at the expense of lower image quality.
910
  num_images_per_prompt (`int`, *optional*, defaults to 1):
911
  The number of images to generate per prompt.
912
  eta (`float`, *optional*, defaults to 0.0):
913
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
914
  [`schedulers.DDIMScheduler`], will be ignored for others.
915
  generator (`torch.Generator`, *optional*):
916
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
998
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
999
  expense of slower inference. This parameter will be modulated by `strength`.
1000
  guidance_scale (`float`, *optional*, defaults to 7.5):
1001
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1002
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1003
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1004
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1005
  usually at the expense of lower image quality.
1006
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1007
  The number of images to generate per prompt.
1008
  eta (`float`, *optional*, defaults to 0.0):
1009
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1010
  [`schedulers.DDIMScheduler`], will be ignored for others.
1011
  generator (`torch.Generator`, *optional*):
1012
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
1094
  The reference number of denoising steps. More denoising steps usually lead to a higher quality image at
1095
  the expense of slower inference. This parameter will be modulated by `strength`, as explained above.
1096
  guidance_scale (`float`, *optional*, defaults to 7.5):
1097
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1098
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1099
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1100
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1101
  usually at the expense of lower image quality.
1102
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1103
  The number of images to generate per prompt.
1104
  eta (`float`, *optional*, defaults to 0.0):
1105
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1106
  [`schedulers.DDIMScheduler`], will be ignored for others.
1107
  generator (`torch.Generator`, *optional*):
1108
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
main/lpw_stable_diffusion_xl.py CHANGED
@@ -507,7 +507,7 @@ EXAMPLE_DOC_STRING = """
507
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
508
  """
509
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
510
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
511
  """
512
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
513
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -945,7 +945,7 @@ class SDXLLongPromptWeightingPipeline(
945
  def prepare_extra_step_kwargs(self, generator, eta):
946
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
947
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
948
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
949
  # and should be between [0, 1]
950
 
951
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -1383,7 +1383,7 @@ class SDXLLongPromptWeightingPipeline(
1383
  return self._clip_skip
1384
 
1385
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1386
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1387
  # corresponds to doing no classifier free guidance.
1388
  @property
1389
  def do_classifier_free_guidance(self):
@@ -1496,9 +1496,9 @@ class SDXLLongPromptWeightingPipeline(
1496
  forms a part of a "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refine Image
1497
  Quality**](https://huggingface.co/docs/diffusers/using-diffusers/sdxl#refine-image-quality).
1498
  guidance_scale (`float`, *optional*, defaults to 5.0):
1499
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1500
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1501
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1502
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1503
  usually at the expense of lower image quality.
1504
  negative_prompt (`str`):
@@ -1511,7 +1511,7 @@ class SDXLLongPromptWeightingPipeline(
1511
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1512
  The number of images to generate per prompt.
1513
  eta (`float`, *optional*, defaults to 0.0):
1514
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1515
  [`schedulers.DDIMScheduler`], will be ignored for others.
1516
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1517
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -1548,8 +1548,8 @@ class SDXLLongPromptWeightingPipeline(
1548
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1549
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1550
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
1551
- Flawed](https://arxiv.org/pdf/2305.08891.pdf) `guidance_scale` is defined as `φ` in equation 16. of
1552
- [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf).
1553
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
1554
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
1555
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
@@ -1872,7 +1872,7 @@ class SDXLLongPromptWeightingPipeline(
1872
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1873
 
1874
  if self.do_classifier_free_guidance and guidance_rescale > 0.0:
1875
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1876
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
1877
 
1878
  # compute the previous noisy sample x_t -> x_t-1
 
507
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
508
  """
509
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
510
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
511
  """
512
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
513
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
945
  def prepare_extra_step_kwargs(self, generator, eta):
946
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
947
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
948
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
949
  # and should be between [0, 1]
950
 
951
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
1383
  return self._clip_skip
1384
 
1385
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1386
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1387
  # corresponds to doing no classifier free guidance.
1388
  @property
1389
  def do_classifier_free_guidance(self):
 
1496
  forms a part of a "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refine Image
1497
  Quality**](https://huggingface.co/docs/diffusers/using-diffusers/sdxl#refine-image-quality).
1498
  guidance_scale (`float`, *optional*, defaults to 5.0):
1499
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1500
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1501
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1502
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1503
  usually at the expense of lower image quality.
1504
  negative_prompt (`str`):
 
1511
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1512
  The number of images to generate per prompt.
1513
  eta (`float`, *optional*, defaults to 0.0):
1514
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1515
  [`schedulers.DDIMScheduler`], will be ignored for others.
1516
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1517
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
1548
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1549
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1550
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
1551
+ Flawed](https://huggingface.co/papers/2305.08891) `guidance_scale` is defined as `φ` in equation 16. of
1552
+ [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891).
1553
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
1554
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
1555
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
 
1872
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1873
 
1874
  if self.do_classifier_free_guidance and guidance_rescale > 0.0:
1875
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1876
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
1877
 
1878
  # compute the previous noisy sample x_t -> x_t-1
main/masked_stable_diffusion_img2img.py CHANGED
@@ -73,7 +73,7 @@ class MaskedStableDiffusionImg2ImgPipeline(StableDiffusionImg2ImgPipeline):
73
  num_images_per_prompt (`int`, *optional*, defaults to 1):
74
  The number of images to generate per prompt.
75
  eta (`float`, *optional*, defaults to 0.0):
76
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
77
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
78
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
79
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -123,7 +123,7 @@ class MaskedStableDiffusionImg2ImgPipeline(StableDiffusionImg2ImgPipeline):
123
  batch_size = prompt_embeds.shape[0]
124
  device = self._execution_device
125
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
126
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
127
  # corresponds to doing no classifier free guidance.
128
  do_classifier_free_guidance = guidance_scale > 1.0
129
 
 
73
  num_images_per_prompt (`int`, *optional*, defaults to 1):
74
  The number of images to generate per prompt.
75
  eta (`float`, *optional*, defaults to 0.0):
76
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
77
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
78
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
79
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
123
  batch_size = prompt_embeds.shape[0]
124
  device = self._execution_device
125
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
126
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
127
  # corresponds to doing no classifier free guidance.
128
  do_classifier_free_guidance = guidance_scale > 1.0
129
 
main/masked_stable_diffusion_xl_img2img.py CHANGED
@@ -115,7 +115,7 @@ class MaskedStableDiffusionXLImg2ImgPipeline(StableDiffusionXLImg2ImgPipeline):
115
  num_images_per_prompt (`int`, *optional*, defaults to 1):
116
  The number of images to generate per prompt.
117
  eta (`float`, *optional*, defaults to 0.0):
118
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
119
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
120
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
121
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -438,7 +438,7 @@ class MaskedStableDiffusionXLImg2ImgPipeline(StableDiffusionXLImg2ImgPipeline):
438
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
439
 
440
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
441
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
442
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
443
 
444
  # compute the previous noisy sample x_t -> x_t-1
 
115
  num_images_per_prompt (`int`, *optional*, defaults to 1):
116
  The number of images to generate per prompt.
117
  eta (`float`, *optional*, defaults to 0.0):
118
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
119
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
120
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
121
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
438
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
439
 
440
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
441
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
442
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
443
 
444
  # compute the previous noisy sample x_t -> x_t-1
main/matryoshka.py CHANGED
@@ -125,7 +125,7 @@ EXAMPLE_DOC_STRING = """
125
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
126
  """
127
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
128
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
129
  """
130
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
131
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -278,7 +278,7 @@ def betas_for_alpha_bar(
278
  # Copied from diffusers.schedulers.scheduling_ddim.rescale_zero_terminal_snr
279
  def rescale_zero_terminal_snr(betas):
280
  """
281
- Rescales betas to have zero terminal SNR Based on https://arxiv.org/pdf/2305.08891.pdf (Algorithm 1)
282
 
283
 
284
  Args:
@@ -458,7 +458,7 @@ class MatryoshkaDDIMScheduler(SchedulerMixin, ConfigMixin):
458
  pixels from saturation at each step. We find that dynamic thresholding results in significantly better
459
  photorealism as well as better image-text alignment, especially when using very large guidance weights."
460
 
461
- https://arxiv.org/abs/2205.11487
462
  """
463
  dtype = sample.dtype
464
  batch_size, channels, *remaining_dims = sample.shape
@@ -501,7 +501,7 @@ class MatryoshkaDDIMScheduler(SchedulerMixin, ConfigMixin):
501
 
502
  self.num_inference_steps = num_inference_steps
503
 
504
- # "linspace", "leading", "trailing" corresponds to annotation of Table 2. of https://arxiv.org/abs/2305.08891
505
  if self.config.timestep_spacing == "linspace":
506
  timesteps = (
507
  np.linspace(0, self.config.num_train_timesteps - 1, num_inference_steps)
@@ -587,7 +587,7 @@ class MatryoshkaDDIMScheduler(SchedulerMixin, ConfigMixin):
587
  "Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler"
588
  )
589
 
590
- # See formulas (12) and (16) of DDIM paper https://arxiv.org/pdf/2010.02502.pdf
591
  # Ideally, read DDIM paper in-detail understanding
592
 
593
  # Notation (<variable name> -> <name in paper>
@@ -615,7 +615,7 @@ class MatryoshkaDDIMScheduler(SchedulerMixin, ConfigMixin):
615
  beta_prod_t = 1 - alpha_prod_t
616
 
617
  # 3. compute predicted original sample from predicted noise also called
618
- # "predicted x_0" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
619
  if self.config.prediction_type == "epsilon":
620
  pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
621
  pred_epsilon = model_output
@@ -669,7 +669,7 @@ class MatryoshkaDDIMScheduler(SchedulerMixin, ConfigMixin):
669
  else:
670
  pred_epsilon = (sample - alpha_prod_t ** (0.5) * pred_original_sample) / beta_prod_t ** (0.5)
671
 
672
- # 6. compute "direction pointing to x_t" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
673
  if len(model_output) > 1:
674
  pred_sample_direction = []
675
  for p_e, a_p_t_p in zip(pred_epsilon, alpha_prod_t_prev):
@@ -677,7 +677,7 @@ class MatryoshkaDDIMScheduler(SchedulerMixin, ConfigMixin):
677
  else:
678
  pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * pred_epsilon
679
 
680
- # 7. compute x_t without "random noise" of formula (12) from https://arxiv.org/pdf/2010.02502.pdf
681
  if len(model_output) > 1:
682
  prev_sample = []
683
  for p_o_s, p_s_d, a_p_t_p in zip(pred_original_sample, pred_sample_direction, alpha_prod_t_prev):
@@ -2660,7 +2660,7 @@ class MatryoshkaUNet2DConditionModel(
2660
  fn_recursive_set_attention_slice(module, reversed_slice_size)
2661
 
2662
  def enable_freeu(self, s1: float, s2: float, b1: float, b2: float):
2663
- r"""Enables the FreeU mechanism from https://arxiv.org/abs/2309.11497.
2664
 
2665
  The suffixes after the scaling factors represent the stage blocks where they are being applied.
2666
 
@@ -4065,7 +4065,7 @@ class MatryoshkaPipeline(
4065
  def prepare_extra_step_kwargs(self, generator, eta):
4066
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
4067
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
4068
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
4069
  # and should be between [0, 1]
4070
 
4071
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -4230,7 +4230,7 @@ class MatryoshkaPipeline(
4230
  return self._clip_skip
4231
 
4232
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
4233
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
4234
  # corresponds to doing no classifier free guidance.
4235
  @property
4236
  def do_classifier_free_guidance(self):
@@ -4309,7 +4309,7 @@ class MatryoshkaPipeline(
4309
  num_images_per_prompt (`int`, *optional*, defaults to 1):
4310
  The number of images to generate per prompt.
4311
  eta (`float`, *optional*, defaults to 0.0):
4312
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
4313
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
4314
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
4315
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -4340,7 +4340,7 @@ class MatryoshkaPipeline(
4340
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
4341
  guidance_rescale (`float`, *optional*, defaults to 0.0):
4342
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
4343
- Flawed](https://arxiv.org/pdf/2305.08891.pdf). Guidance rescale factor should fix overexposure when
4344
  using zero terminal SNR.
4345
  clip_skip (`int`, *optional*):
4346
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
@@ -4538,7 +4538,7 @@ class MatryoshkaPipeline(
4538
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
4539
 
4540
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
4541
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
4542
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
4543
 
4544
  # compute the previous noisy sample x_t -> x_t-1
 
125
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
126
  """
127
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
128
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
129
  """
130
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
131
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
278
  # Copied from diffusers.schedulers.scheduling_ddim.rescale_zero_terminal_snr
279
  def rescale_zero_terminal_snr(betas):
280
  """
281
+ Rescales betas to have zero terminal SNR Based on https://huggingface.co/papers/2305.08891 (Algorithm 1)
282
 
283
 
284
  Args:
 
458
  pixels from saturation at each step. We find that dynamic thresholding results in significantly better
459
  photorealism as well as better image-text alignment, especially when using very large guidance weights."
460
 
461
+ https://huggingface.co/papers/2205.11487
462
  """
463
  dtype = sample.dtype
464
  batch_size, channels, *remaining_dims = sample.shape
 
501
 
502
  self.num_inference_steps = num_inference_steps
503
 
504
+ # "linspace", "leading", "trailing" corresponds to annotation of Table 2. of https://huggingface.co/papers/2305.08891
505
  if self.config.timestep_spacing == "linspace":
506
  timesteps = (
507
  np.linspace(0, self.config.num_train_timesteps - 1, num_inference_steps)
 
587
  "Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler"
588
  )
589
 
590
+ # See formulas (12) and (16) of DDIM paper https://huggingface.co/papers/2010.02502
591
  # Ideally, read DDIM paper in-detail understanding
592
 
593
  # Notation (<variable name> -> <name in paper>
 
615
  beta_prod_t = 1 - alpha_prod_t
616
 
617
  # 3. compute predicted original sample from predicted noise also called
618
+ # "predicted x_0" of formula (12) from https://huggingface.co/papers/2010.02502
619
  if self.config.prediction_type == "epsilon":
620
  pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
621
  pred_epsilon = model_output
 
669
  else:
670
  pred_epsilon = (sample - alpha_prod_t ** (0.5) * pred_original_sample) / beta_prod_t ** (0.5)
671
 
672
+ # 6. compute "direction pointing to x_t" of formula (12) from https://huggingface.co/papers/2010.02502
673
  if len(model_output) > 1:
674
  pred_sample_direction = []
675
  for p_e, a_p_t_p in zip(pred_epsilon, alpha_prod_t_prev):
 
677
  else:
678
  pred_sample_direction = (1 - alpha_prod_t_prev - std_dev_t**2) ** (0.5) * pred_epsilon
679
 
680
+ # 7. compute x_t without "random noise" of formula (12) from https://huggingface.co/papers/2010.02502
681
  if len(model_output) > 1:
682
  prev_sample = []
683
  for p_o_s, p_s_d, a_p_t_p in zip(pred_original_sample, pred_sample_direction, alpha_prod_t_prev):
 
2660
  fn_recursive_set_attention_slice(module, reversed_slice_size)
2661
 
2662
  def enable_freeu(self, s1: float, s2: float, b1: float, b2: float):
2663
+ r"""Enables the FreeU mechanism from https://huggingface.co/papers/2309.11497.
2664
 
2665
  The suffixes after the scaling factors represent the stage blocks where they are being applied.
2666
 
 
4065
  def prepare_extra_step_kwargs(self, generator, eta):
4066
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
4067
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
4068
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
4069
  # and should be between [0, 1]
4070
 
4071
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
4230
  return self._clip_skip
4231
 
4232
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
4233
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
4234
  # corresponds to doing no classifier free guidance.
4235
  @property
4236
  def do_classifier_free_guidance(self):
 
4309
  num_images_per_prompt (`int`, *optional*, defaults to 1):
4310
  The number of images to generate per prompt.
4311
  eta (`float`, *optional*, defaults to 0.0):
4312
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
4313
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
4314
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
4315
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
4340
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
4341
  guidance_rescale (`float`, *optional*, defaults to 0.0):
4342
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
4343
+ Flawed](https://huggingface.co/papers/2305.08891). Guidance rescale factor should fix overexposure when
4344
  using zero terminal SNR.
4345
  clip_skip (`int`, *optional*):
4346
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
 
4538
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
4539
 
4540
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
4541
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
4542
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
4543
 
4544
  # compute the previous noisy sample x_t -> x_t-1
main/mixture_tiling.py CHANGED
@@ -298,7 +298,7 @@ class StableDiffusionTilingPipeline(DiffusionPipeline, StableDiffusionExtrasMixi
298
  text_embeddings = [[self.text_encoder(col.input_ids.to(self.device))[0] for col in row] for row in text_input]
299
 
300
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
301
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
302
  # corresponds to doing no classifier free guidance.
303
  do_classifier_free_guidance = guidance_scale > 1.0 # TODO: also active if any tile has guidance scale
304
  # get unconditional embeddings for classifier free guidance
@@ -318,7 +318,7 @@ class StableDiffusionTilingPipeline(DiffusionPipeline, StableDiffusionExtrasMixi
318
 
319
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
320
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
321
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
322
  # and should be between [0, 1]
323
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
324
  extra_step_kwargs = {}
 
298
  text_embeddings = [[self.text_encoder(col.input_ids.to(self.device))[0] for col in row] for row in text_input]
299
 
300
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
301
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
302
  # corresponds to doing no classifier free guidance.
303
  do_classifier_free_guidance = guidance_scale > 1.0 # TODO: also active if any tile has guidance scale
304
  # get unconditional embeddings for classifier free guidance
 
318
 
319
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
320
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
321
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
322
  # and should be between [0, 1]
323
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
324
  extra_step_kwargs = {}
main/mixture_tiling_sdxl.py CHANGED
@@ -201,7 +201,7 @@ def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
201
  r"""
202
  Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
203
  Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
204
- Flawed](https://arxiv.org/pdf/2305.08891.pdf).
205
 
206
  Args:
207
  noise_cfg (`torch.Tensor`):
@@ -631,7 +631,7 @@ class StableDiffusionXLTilingPipeline(
631
  def prepare_extra_step_kwargs(self, generator, eta):
632
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
633
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
634
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
635
  # and should be between [0, 1]
636
 
637
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -767,7 +767,7 @@ class StableDiffusionXLTilingPipeline(
767
  return self._clip_skip
768
 
769
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
770
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
771
  # corresponds to doing no classifier free guidance.
772
  @property
773
  def do_classifier_free_guidance(self):
@@ -839,9 +839,9 @@ class StableDiffusionXLTilingPipeline(
839
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
840
  expense of slower inference.
841
  guidance_scale (`float`, *optional*, defaults to 5.0):
842
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
843
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
844
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
845
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
846
  usually at the expense of lower image quality.
847
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -851,7 +851,7 @@ class StableDiffusionXLTilingPipeline(
851
  num_images_per_prompt (`int`, *optional*, defaults to 1):
852
  The number of images to generate per prompt.
853
  eta (`float`, *optional*, defaults to 0.0):
854
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
855
  [`schedulers.DDIMScheduler`], will be ignored for others.
856
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
857
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
201
  r"""
202
  Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
203
  Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
204
+ Flawed](https://huggingface.co/papers/2305.08891).
205
 
206
  Args:
207
  noise_cfg (`torch.Tensor`):
 
631
  def prepare_extra_step_kwargs(self, generator, eta):
632
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
633
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
634
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
635
  # and should be between [0, 1]
636
 
637
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
767
  return self._clip_skip
768
 
769
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
770
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
771
  # corresponds to doing no classifier free guidance.
772
  @property
773
  def do_classifier_free_guidance(self):
 
839
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
840
  expense of slower inference.
841
  guidance_scale (`float`, *optional*, defaults to 5.0):
842
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
843
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
844
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
845
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
846
  usually at the expense of lower image quality.
847
  negative_prompt (`str` or `List[str]`, *optional*):
 
851
  num_images_per_prompt (`int`, *optional*, defaults to 1):
852
  The number of images to generate per prompt.
853
  eta (`float`, *optional*, defaults to 0.0):
854
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
855
  [`schedulers.DDIMScheduler`], will be ignored for others.
856
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
857
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
main/mod_controlnet_tile_sr_sdxl.py CHANGED
@@ -637,7 +637,7 @@ class StableDiffusionXLControlNetTileSRPipeline(
637
  def prepare_extra_step_kwargs(self, generator, eta):
638
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
639
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
640
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
641
  # and should be between [0, 1]
642
 
643
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -1247,7 +1247,7 @@ class StableDiffusionXLControlNetTileSRPipeline(
1247
  return self._clip_skip
1248
 
1249
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1250
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1251
  # corresponds to doing no classifier free guidance.
1252
  @property
1253
  def do_classifier_free_guidance(self):
@@ -1335,8 +1335,8 @@ class StableDiffusionXLControlNetTileSRPipeline(
1335
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1336
  expense of slower inference.
1337
  guidance_scale (`float`, *optional*, defaults to 5.0):
1338
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1339
- `guidance_scale` is defined as `w` of equation 2. of [Imagen Paper](https://arxiv.org/pdf/2205.11487.pdf).
1340
  Guidance scale is enabled by setting `guidance_scale > 1`. Higher guidance scale encourages generating
1341
  images closely linked to the text `prompt`, usually at the expense of lower image quality.
1342
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -1346,7 +1346,7 @@ class StableDiffusionXLControlNetTileSRPipeline(
1346
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1347
  The number of images to generate per prompt.
1348
  eta (`float`, *optional*, defaults to 0.0):
1349
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1350
  [`schedulers.DDIMScheduler`], will be ignored for others.
1351
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1352
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
637
  def prepare_extra_step_kwargs(self, generator, eta):
638
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
639
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
640
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
641
  # and should be between [0, 1]
642
 
643
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
1247
  return self._clip_skip
1248
 
1249
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1250
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1251
  # corresponds to doing no classifier free guidance.
1252
  @property
1253
  def do_classifier_free_guidance(self):
 
1335
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1336
  expense of slower inference.
1337
  guidance_scale (`float`, *optional*, defaults to 5.0):
1338
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1339
+ `guidance_scale` is defined as `w` of equation 2. of [Imagen Paper](https://huggingface.co/papers/2205.11487).
1340
  Guidance scale is enabled by setting `guidance_scale > 1`. Higher guidance scale encourages generating
1341
  images closely linked to the text `prompt`, usually at the expense of lower image quality.
1342
  negative_prompt (`str` or `List[str]`, *optional*):
 
1346
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1347
  The number of images to generate per prompt.
1348
  eta (`float`, *optional*, defaults to 0.0):
1349
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1350
  [`schedulers.DDIMScheduler`], will be ignored for others.
1351
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1352
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
main/multilingual_stable_diffusion.py CHANGED
@@ -168,9 +168,9 @@ class MultilingualStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
168
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
169
  expense of slower inference.
170
  guidance_scale (`float`, *optional*, defaults to 7.5):
171
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
172
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
173
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
174
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
175
  usually at the expense of lower image quality.
176
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -179,7 +179,7 @@ class MultilingualStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
179
  num_images_per_prompt (`int`, *optional*, defaults to 1):
180
  The number of images to generate per prompt.
181
  eta (`float`, *optional*, defaults to 0.0):
182
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
183
  [`schedulers.DDIMScheduler`], will be ignored for others.
184
  generator (`torch.Generator`, *optional*):
185
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
@@ -263,7 +263,7 @@ class MultilingualStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
263
  text_embeddings = text_embeddings.view(bs_embed * num_images_per_prompt, seq_len, -1)
264
 
265
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
266
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
267
  # corresponds to doing no classifier free guidance.
268
  do_classifier_free_guidance = guidance_scale > 1.0
269
  # get unconditional embeddings for classifier free guidance
@@ -355,7 +355,7 @@ class MultilingualStableDiffusion(DiffusionPipeline, StableDiffusionMixin):
355
 
356
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
357
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
358
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
359
  # and should be between [0, 1]
360
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
361
  extra_step_kwargs = {}
 
168
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
169
  expense of slower inference.
170
  guidance_scale (`float`, *optional*, defaults to 7.5):
171
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
172
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
173
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
174
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
175
  usually at the expense of lower image quality.
176
  negative_prompt (`str` or `List[str]`, *optional*):
 
179
  num_images_per_prompt (`int`, *optional*, defaults to 1):
180
  The number of images to generate per prompt.
181
  eta (`float`, *optional*, defaults to 0.0):
182
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
183
  [`schedulers.DDIMScheduler`], will be ignored for others.
184
  generator (`torch.Generator`, *optional*):
185
  A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
 
263
  text_embeddings = text_embeddings.view(bs_embed * num_images_per_prompt, seq_len, -1)
264
 
265
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
266
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
267
  # corresponds to doing no classifier free guidance.
268
  do_classifier_free_guidance = guidance_scale > 1.0
269
  # get unconditional embeddings for classifier free guidance
 
355
 
356
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
357
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
358
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
359
  # and should be between [0, 1]
360
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
361
  extra_step_kwargs = {}
main/pipeline_animatediff_controlnet.py CHANGED
@@ -464,7 +464,7 @@ class AnimateDiffControlNetPipeline(
464
  def prepare_extra_step_kwargs(self, generator, eta):
465
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
466
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
467
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
468
  # and should be between [0, 1]
469
 
470
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -729,7 +729,7 @@ class AnimateDiffControlNetPipeline(
729
  return self._clip_skip
730
 
731
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
732
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
733
  # corresponds to doing no classifier free guidance.
734
  @property
735
  def do_classifier_free_guidance(self):
@@ -797,7 +797,7 @@ class AnimateDiffControlNetPipeline(
797
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
798
  pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`).
799
  eta (`float`, *optional*, defaults to 0.0):
800
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
801
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
802
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
803
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
464
  def prepare_extra_step_kwargs(self, generator, eta):
465
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
466
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
467
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
468
  # and should be between [0, 1]
469
 
470
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
729
  return self._clip_skip
730
 
731
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
732
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
733
  # corresponds to doing no classifier free guidance.
734
  @property
735
  def do_classifier_free_guidance(self):
 
797
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
798
  pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`).
799
  eta (`float`, *optional*, defaults to 0.0):
800
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
801
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
802
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
803
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
main/pipeline_animatediff_img2video.py CHANGED
@@ -581,7 +581,7 @@ class AnimateDiffImgToVideoPipeline(
581
  def prepare_extra_step_kwargs(self, generator, eta):
582
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
583
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
584
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
585
  # and should be between [0, 1]
586
 
587
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -790,7 +790,7 @@ class AnimateDiffImgToVideoPipeline(
790
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
791
  pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`).
792
  eta (`float`, *optional*, defaults to 0.0):
793
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
794
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
795
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
796
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -870,7 +870,7 @@ class AnimateDiffImgToVideoPipeline(
870
  device = self._execution_device
871
 
872
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
873
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
874
  # corresponds to doing no classifier free guidance.
875
  do_classifier_free_guidance = guidance_scale > 1.0
876
 
 
581
  def prepare_extra_step_kwargs(self, generator, eta):
582
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
583
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
584
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
585
  # and should be between [0, 1]
586
 
587
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
790
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
791
  pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`).
792
  eta (`float`, *optional*, defaults to 0.0):
793
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
794
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
795
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
796
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
870
  device = self._execution_device
871
 
872
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
873
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
874
  # corresponds to doing no classifier free guidance.
875
  do_classifier_free_guidance = guidance_scale > 1.0
876
 
main/pipeline_animatediff_ipex.py CHANGED
@@ -442,7 +442,7 @@ class AnimateDiffPipelineIpex(
442
  def prepare_extra_step_kwargs(self, generator, eta):
443
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
444
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
445
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
446
  # and should be between [0, 1]
447
 
448
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -555,7 +555,7 @@ class AnimateDiffPipelineIpex(
555
  return self._clip_skip
556
 
557
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
558
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
559
  # corresponds to doing no classifier free guidance.
560
  @property
561
  def do_classifier_free_guidance(self):
@@ -618,7 +618,7 @@ class AnimateDiffPipelineIpex(
618
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
619
  pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`).
620
  eta (`float`, *optional*, defaults to 0.0):
621
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
622
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
623
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
624
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
442
  def prepare_extra_step_kwargs(self, generator, eta):
443
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
444
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
445
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
446
  # and should be between [0, 1]
447
 
448
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
555
  return self._clip_skip
556
 
557
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
558
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
559
  # corresponds to doing no classifier free guidance.
560
  @property
561
  def do_classifier_free_guidance(self):
 
618
  The prompt or prompts to guide what to not include in image generation. If not defined, you need to
619
  pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`).
620
  eta (`float`, *optional*, defaults to 0.0):
621
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
622
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
623
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
624
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
main/pipeline_controlnet_xl_kolors.py CHANGED
@@ -462,7 +462,7 @@ class KolorsControlNetPipeline(
462
  def prepare_extra_step_kwargs(self, generator, eta):
463
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
464
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
465
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
466
  # and should be between [0, 1]
467
 
468
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -781,7 +781,7 @@ class KolorsControlNetPipeline(
781
  return self._guidance_scale
782
 
783
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
784
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
785
  # corresponds to doing no classifier free guidance.
786
  @property
787
  def do_classifier_free_guidance(self):
@@ -868,9 +868,9 @@ class KolorsControlNetPipeline(
868
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
869
  expense of slower inference.
870
  guidance_scale (`float`, *optional*, defaults to 7.5):
871
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
872
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
873
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
874
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
875
  usually at the expense of lower image quality.
876
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -880,7 +880,7 @@ class KolorsControlNetPipeline(
880
  num_images_per_prompt (`int`, *optional*, defaults to 1):
881
  The number of images to generate per prompt.
882
  eta (`float`, *optional*, defaults to 0.0):
883
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
884
  [`schedulers.DDIMScheduler`], will be ignored for others.
885
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
886
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
462
  def prepare_extra_step_kwargs(self, generator, eta):
463
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
464
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
465
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
466
  # and should be between [0, 1]
467
 
468
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
781
  return self._guidance_scale
782
 
783
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
784
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
785
  # corresponds to doing no classifier free guidance.
786
  @property
787
  def do_classifier_free_guidance(self):
 
868
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
869
  expense of slower inference.
870
  guidance_scale (`float`, *optional*, defaults to 7.5):
871
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
872
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
873
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
874
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
875
  usually at the expense of lower image quality.
876
  negative_prompt (`str` or `List[str]`, *optional*):
 
880
  num_images_per_prompt (`int`, *optional*, defaults to 1):
881
  The number of images to generate per prompt.
882
  eta (`float`, *optional*, defaults to 0.0):
883
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
884
  [`schedulers.DDIMScheduler`], will be ignored for others.
885
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
886
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
main/pipeline_controlnet_xl_kolors_img2img.py CHANGED
@@ -505,7 +505,7 @@ class KolorsControlNetImg2ImgPipeline(
505
  def prepare_extra_step_kwargs(self, generator, eta):
506
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
507
  # eta (η) is only used with the DDIMScheduler, it will be ignored for others.
508
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
509
  # and should be between [0, 1]
510
 
511
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -951,7 +951,7 @@ class KolorsControlNetImg2ImgPipeline(
951
  return self._guidance_scale
952
 
953
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
954
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
955
  # corresponds to doing no classifier free guidance.
956
  @property
957
  def do_classifier_free_guidance(self):
@@ -1046,9 +1046,9 @@ class KolorsControlNetImg2ImgPipeline(
1046
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1047
  expense of slower inference.
1048
  guidance_scale (`float`, *optional*, defaults to 7.5):
1049
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1050
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1051
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1052
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1053
  usually at the expense of lower image quality.
1054
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -1058,7 +1058,7 @@ class KolorsControlNetImg2ImgPipeline(
1058
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1059
  The number of images to generate per prompt.
1060
  eta (`float`, *optional*, defaults to 0.0):
1061
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1062
  [`schedulers.DDIMScheduler`], will be ignored for others.
1063
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1064
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
505
  def prepare_extra_step_kwargs(self, generator, eta):
506
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
507
  # eta (η) is only used with the DDIMScheduler, it will be ignored for others.
508
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
509
  # and should be between [0, 1]
510
 
511
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
951
  return self._guidance_scale
952
 
953
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
954
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
955
  # corresponds to doing no classifier free guidance.
956
  @property
957
  def do_classifier_free_guidance(self):
 
1046
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
1047
  expense of slower inference.
1048
  guidance_scale (`float`, *optional*, defaults to 7.5):
1049
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1050
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1051
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1052
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1053
  usually at the expense of lower image quality.
1054
  negative_prompt (`str` or `List[str]`, *optional*):
 
1058
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1059
  The number of images to generate per prompt.
1060
  eta (`float`, *optional*, defaults to 0.0):
1061
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1062
  [`schedulers.DDIMScheduler`], will be ignored for others.
1063
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1064
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
main/pipeline_controlnet_xl_kolors_inpaint.py CHANGED
@@ -556,7 +556,7 @@ class KolorsControlNetInpaintPipeline(
556
  def prepare_extra_step_kwargs(self, generator, eta):
557
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
558
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
559
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
560
  # and should be between [0, 1]
561
 
562
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -1035,7 +1035,7 @@ class KolorsControlNetInpaintPipeline(
1035
  return self._guidance_scale
1036
 
1037
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1038
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1039
  # corresponds to doing no classifier free guidance.
1040
  @property
1041
  def do_classifier_free_guidance(self):
@@ -1255,9 +1255,9 @@ class KolorsControlNetInpaintPipeline(
1255
  forms a part of a "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
1256
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output).
1257
  guidance_scale (`float`, *optional*, defaults to 7.5):
1258
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1259
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1260
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1261
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1262
  usually at the expense of lower image quality.
1263
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -1290,7 +1290,7 @@ class KolorsControlNetInpaintPipeline(
1290
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1291
  The number of images to generate per prompt.
1292
  eta (`float`, *optional*, defaults to 0.0):
1293
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1294
  [`schedulers.DDIMScheduler`], will be ignored for others.
1295
  generator (`torch.Generator`, *optional*):
1296
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
556
  def prepare_extra_step_kwargs(self, generator, eta):
557
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
558
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
559
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
560
  # and should be between [0, 1]
561
 
562
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
1035
  return self._guidance_scale
1036
 
1037
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1038
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1039
  # corresponds to doing no classifier free guidance.
1040
  @property
1041
  def do_classifier_free_guidance(self):
 
1255
  forms a part of a "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
1256
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output).
1257
  guidance_scale (`float`, *optional*, defaults to 7.5):
1258
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1259
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1260
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1261
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1262
  usually at the expense of lower image quality.
1263
  negative_prompt (`str` or `List[str]`, *optional*):
 
1290
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1291
  The number of images to generate per prompt.
1292
  eta (`float`, *optional*, defaults to 0.0):
1293
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1294
  [`schedulers.DDIMScheduler`], will be ignored for others.
1295
  generator (`torch.Generator`, *optional*):
1296
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
main/pipeline_demofusion_sdxl.py CHANGED
@@ -77,7 +77,7 @@ def gaussian_filter(latents, kernel_size=3, sigma=1.0):
77
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
78
  """
79
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
80
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
81
  """
82
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
83
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -383,7 +383,7 @@ class DemoFusionSDXLPipeline(
383
  def prepare_extra_step_kwargs(self, generator, eta):
384
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
385
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
386
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
387
  # and should be between [0, 1]
388
 
389
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -701,9 +701,9 @@ class DemoFusionSDXLPipeline(
701
  "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
702
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output)
703
  guidance_scale (`float`, *optional*, defaults to 5.0):
704
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
705
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
706
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
707
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
708
  usually at the expense of lower image quality.
709
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -716,7 +716,7 @@ class DemoFusionSDXLPipeline(
716
  num_images_per_prompt (`int`, *optional*, defaults to 1):
717
  The number of images to generate per prompt.
718
  eta (`float`, *optional*, defaults to 0.0):
719
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
720
  [`schedulers.DDIMScheduler`], will be ignored for others.
721
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
722
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -757,8 +757,8 @@ class DemoFusionSDXLPipeline(
757
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
758
  guidance_rescale (`float`, *optional*, defaults to 0.7):
759
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
760
- Flawed](https://arxiv.org/pdf/2305.08891.pdf) `guidance_scale` is defined as `φ` in equation 16. of
761
- [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf).
762
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
763
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
764
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
@@ -860,7 +860,7 @@ class DemoFusionSDXLPipeline(
860
  device = self._execution_device
861
 
862
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
863
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
864
  # corresponds to doing no classifier free guidance.
865
  do_classifier_free_guidance = guidance_scale > 1.0
866
 
@@ -977,7 +977,7 @@ class DemoFusionSDXLPipeline(
977
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
978
 
979
  if do_classifier_free_guidance and guidance_rescale > 0.0:
980
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
981
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
982
 
983
  # compute the previous noisy sample x_t -> x_t-1
@@ -1119,7 +1119,7 @@ class DemoFusionSDXLPipeline(
1119
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1120
 
1121
  if do_classifier_free_guidance and guidance_rescale > 0.0:
1122
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1123
  noise_pred = rescale_noise_cfg(
1124
  noise_pred, noise_pred_text, guidance_rescale=guidance_rescale
1125
  )
@@ -1215,7 +1215,7 @@ class DemoFusionSDXLPipeline(
1215
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1216
 
1217
  if do_classifier_free_guidance and guidance_rescale > 0.0:
1218
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1219
  noise_pred = rescale_noise_cfg(
1220
  noise_pred, noise_pred_text, guidance_rescale=guidance_rescale
1221
  )
 
77
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
78
  """
79
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
80
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
81
  """
82
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
83
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
383
  def prepare_extra_step_kwargs(self, generator, eta):
384
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
385
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
386
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
387
  # and should be between [0, 1]
388
 
389
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
701
  "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
702
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output)
703
  guidance_scale (`float`, *optional*, defaults to 5.0):
704
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
705
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
706
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
707
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
708
  usually at the expense of lower image quality.
709
  negative_prompt (`str` or `List[str]`, *optional*):
 
716
  num_images_per_prompt (`int`, *optional*, defaults to 1):
717
  The number of images to generate per prompt.
718
  eta (`float`, *optional*, defaults to 0.0):
719
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
720
  [`schedulers.DDIMScheduler`], will be ignored for others.
721
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
722
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
757
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
758
  guidance_rescale (`float`, *optional*, defaults to 0.7):
759
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
760
+ Flawed](https://huggingface.co/papers/2305.08891) `guidance_scale` is defined as `φ` in equation 16. of
761
+ [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891).
762
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
763
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
764
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
 
860
  device = self._execution_device
861
 
862
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
863
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
864
  # corresponds to doing no classifier free guidance.
865
  do_classifier_free_guidance = guidance_scale > 1.0
866
 
 
977
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
978
 
979
  if do_classifier_free_guidance and guidance_rescale > 0.0:
980
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
981
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
982
 
983
  # compute the previous noisy sample x_t -> x_t-1
 
1119
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1120
 
1121
  if do_classifier_free_guidance and guidance_rescale > 0.0:
1122
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1123
  noise_pred = rescale_noise_cfg(
1124
  noise_pred, noise_pred_text, guidance_rescale=guidance_rescale
1125
  )
 
1215
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1216
 
1217
  if do_classifier_free_guidance and guidance_rescale > 0.0:
1218
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1219
  noise_pred = rescale_noise_cfg(
1220
  noise_pred, noise_pred_text, guidance_rescale=guidance_rescale
1221
  )
main/pipeline_faithdiff_stable_diffusion_xl.py CHANGED
@@ -1077,7 +1077,7 @@ class LocalAttention:
1077
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
1078
  """
1079
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
1080
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
1081
 
1082
  Args:
1083
  noise_cfg (torch.Tensor): Noise configuration tensor.
@@ -1504,7 +1504,7 @@ class FaithDiffStableDiffusionXLPipeline(
1504
  def prepare_extra_step_kwargs(self, generator, eta):
1505
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
1506
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
1507
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
1508
  # and should be between [0, 1]
1509
 
1510
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -1729,7 +1729,7 @@ class FaithDiffStableDiffusionXLPipeline(
1729
  return self._clip_skip
1730
 
1731
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1732
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1733
  # corresponds to doing no classifier free guidance.
1734
  @property
1735
  def do_classifier_free_guidance(self):
@@ -1883,9 +1883,9 @@ class FaithDiffStableDiffusionXLPipeline(
1883
  Overlap factor for local attention tiling (between 0.0 and 1.0). Controls the overlap between adjacent
1884
  grid patches during processing. Defaults to 0.5.
1885
  guidance_scale (`float`, *optional*, defaults to 5.0):
1886
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1887
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1888
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1889
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1890
  usually at the expense of lower image quality.
1891
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -1898,7 +1898,7 @@ class FaithDiffStableDiffusionXLPipeline(
1898
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1899
  The number of images to generate per prompt.
1900
  eta (`float`, *optional*, defaults to 0.0):
1901
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1902
  [`schedulers.DDIMScheduler`], will be ignored for others.
1903
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1904
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -1933,8 +1933,8 @@ class FaithDiffStableDiffusionXLPipeline(
1933
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1934
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1935
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
1936
- Flawed](https://arxiv.org/pdf/2305.08891.pdf) `guidance_scale` is defined as `φ` in equation 16. of
1937
- [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf).
1938
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
1939
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
1940
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
@@ -2173,7 +2173,7 @@ class FaithDiffStableDiffusionXLPipeline(
2173
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
2174
 
2175
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
2176
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
2177
  noise_pred = rescale_noise_cfg(
2178
  noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale
2179
  )
 
1077
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
1078
  """
1079
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
1080
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
1081
 
1082
  Args:
1083
  noise_cfg (torch.Tensor): Noise configuration tensor.
 
1504
  def prepare_extra_step_kwargs(self, generator, eta):
1505
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
1506
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
1507
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
1508
  # and should be between [0, 1]
1509
 
1510
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
1729
  return self._clip_skip
1730
 
1731
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1732
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1733
  # corresponds to doing no classifier free guidance.
1734
  @property
1735
  def do_classifier_free_guidance(self):
 
1883
  Overlap factor for local attention tiling (between 0.0 and 1.0). Controls the overlap between adjacent
1884
  grid patches during processing. Defaults to 0.5.
1885
  guidance_scale (`float`, *optional*, defaults to 5.0):
1886
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1887
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1888
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1889
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1890
  usually at the expense of lower image quality.
1891
  negative_prompt (`str` or `List[str]`, *optional*):
 
1898
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1899
  The number of images to generate per prompt.
1900
  eta (`float`, *optional*, defaults to 0.0):
1901
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1902
  [`schedulers.DDIMScheduler`], will be ignored for others.
1903
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1904
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
1933
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1934
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1935
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
1936
+ Flawed](https://huggingface.co/papers/2305.08891) `guidance_scale` is defined as `φ` in equation 16. of
1937
+ [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891).
1938
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
1939
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
1940
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
 
2173
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
2174
 
2175
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
2176
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
2177
  noise_pred = rescale_noise_cfg(
2178
  noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale
2179
  )
main/pipeline_flux_differential_img2img.py CHANGED
@@ -756,9 +756,9 @@ class FluxDifferentialImg2ImgPipeline(DiffusionPipeline, FluxLoraLoaderMixin):
756
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
757
  passed will be used. Must be in descending order.
758
  guidance_scale (`float`, *optional*, defaults to 7.0):
759
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
760
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
761
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
762
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
763
  usually at the expense of lower image quality.
764
  num_images_per_prompt (`int`, *optional*, defaults to 1):
 
756
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
757
  passed will be used. Must be in descending order.
758
  guidance_scale (`float`, *optional*, defaults to 7.0):
759
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
760
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
761
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
762
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
763
  usually at the expense of lower image quality.
764
  num_images_per_prompt (`int`, *optional*, defaults to 1):
main/pipeline_flux_rf_inversion.py CHANGED
@@ -698,9 +698,9 @@ class RFInversionFluxPipeline(
698
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
699
  passed will be used. Must be in descending order.
700
  guidance_scale (`float`, *optional*, defaults to 7.0):
701
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
702
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
703
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
704
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
705
  usually at the expense of lower image quality.
706
  num_images_per_prompt (`int`, *optional*, defaults to 1):
@@ -849,7 +849,7 @@ class RFInversionFluxPipeline(
849
 
850
  if do_rf_inversion:
851
  y_0 = image_latents.clone()
852
- # 6. Denoising loop / Controlled Reverse ODE, Algorithm 2 from: https://arxiv.org/pdf/2410.10792
853
  with self.progress_bar(total=num_inference_steps) as progress_bar:
854
  for i, t in enumerate(timesteps):
855
  if do_rf_inversion:
@@ -884,7 +884,7 @@ class RFInversionFluxPipeline(
884
  eta_t = eta_t * (1 - i / num_inference_steps) ** eta_decay_power # Decay eta over the loop
885
  v_hat_t = v_t + eta_t * (v_t_cond - v_t)
886
 
887
- # SDE Eq: 17 from https://arxiv.org/pdf/2410.10792
888
  latents = latents + v_hat_t * (sigmas[i] - sigmas[i + 1])
889
  else:
890
  # compute the previous noisy sample x_t -> x_t-1
@@ -944,7 +944,7 @@ class RFInversionFluxPipeline(
944
  joint_attention_kwargs: Optional[Dict[str, Any]] = None,
945
  ):
946
  r"""
947
- Performs Algorithm 1: Controlled Forward ODE from https://arxiv.org/pdf/2410.10792
948
  Args:
949
  image (`PipelineImageInput`):
950
  Input for the image(s) that are to be edited. Multiple input images have to default to the same aspect
@@ -953,9 +953,9 @@ class RFInversionFluxPipeline(
953
  The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
954
  instead.
955
  source_guidance_scale (`float`, *optional*, defaults to 0.0):
956
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
957
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
958
- Paper](https://arxiv.org/pdf/2205.11487.pdf). For this algorithm, it's better to keep it 0.
959
  num_inversion_steps (`int`, *optional*, defaults to 28):
960
  The number of discretization steps.
961
  height (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
 
698
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
699
  passed will be used. Must be in descending order.
700
  guidance_scale (`float`, *optional*, defaults to 7.0):
701
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
702
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
703
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
704
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
705
  usually at the expense of lower image quality.
706
  num_images_per_prompt (`int`, *optional*, defaults to 1):
 
849
 
850
  if do_rf_inversion:
851
  y_0 = image_latents.clone()
852
+ # 6. Denoising loop / Controlled Reverse ODE, Algorithm 2 from: https://huggingface.co/papers/2410.10792
853
  with self.progress_bar(total=num_inference_steps) as progress_bar:
854
  for i, t in enumerate(timesteps):
855
  if do_rf_inversion:
 
884
  eta_t = eta_t * (1 - i / num_inference_steps) ** eta_decay_power # Decay eta over the loop
885
  v_hat_t = v_t + eta_t * (v_t_cond - v_t)
886
 
887
+ # SDE Eq: 17 from https://huggingface.co/papers/2410.10792
888
  latents = latents + v_hat_t * (sigmas[i] - sigmas[i + 1])
889
  else:
890
  # compute the previous noisy sample x_t -> x_t-1
 
944
  joint_attention_kwargs: Optional[Dict[str, Any]] = None,
945
  ):
946
  r"""
947
+ Performs Algorithm 1: Controlled Forward ODE from https://huggingface.co/papers/2410.10792
948
  Args:
949
  image (`PipelineImageInput`):
950
  Input for the image(s) that are to be edited. Multiple input images have to default to the same aspect
 
953
  The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
954
  instead.
955
  source_guidance_scale (`float`, *optional*, defaults to 0.0):
956
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
957
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
958
+ Paper](https://huggingface.co/papers/2205.11487). For this algorithm, it's better to keep it 0.
959
  num_inversion_steps (`int`, *optional*, defaults to 28):
960
  The number of discretization steps.
961
  height (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
main/pipeline_flux_semantic_guidance.py CHANGED
@@ -840,9 +840,9 @@ class FluxSemanticGuidancePipeline(
840
  their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is passed
841
  will be used.
842
  guidance_scale (`float`, *optional*, defaults to 7.0):
843
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
844
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
845
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
846
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
847
  usually at the expense of lower image quality.
848
  num_images_per_prompt (`int`, *optional*, defaults to 1):
 
840
  their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is passed
841
  will be used.
842
  guidance_scale (`float`, *optional*, defaults to 7.0):
843
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
844
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
845
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
846
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
847
  usually at the expense of lower image quality.
848
  num_images_per_prompt (`int`, *optional*, defaults to 1):
main/pipeline_flux_with_cfg.py CHANGED
@@ -626,9 +626,9 @@ class FluxCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFileMixi
626
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
627
  passed will be used. Must be in descending order.
628
  guidance_scale (`float`, *optional*, defaults to 7.0):
629
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
630
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
631
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
632
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
633
  usually at the expense of lower image quality.
634
  num_images_per_prompt (`int`, *optional*, defaults to 1):
 
626
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
627
  passed will be used. Must be in descending order.
628
  guidance_scale (`float`, *optional*, defaults to 7.0):
629
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
630
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
631
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
632
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
633
  usually at the expense of lower image quality.
634
  num_images_per_prompt (`int`, *optional*, defaults to 1):
main/pipeline_hunyuandit_differential_img2img.py CHANGED
@@ -150,7 +150,7 @@ def get_resize_crop_region_for_grid(src, tgt_size):
150
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
151
  """
152
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
153
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
154
  """
155
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
156
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -531,7 +531,7 @@ class HunyuanDiTDifferentialImg2ImgPipeline(DiffusionPipeline):
531
  def prepare_extra_step_kwargs(self, generator, eta):
532
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
533
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
534
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
535
  # and should be between [0, 1]
536
 
537
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -709,7 +709,7 @@ class HunyuanDiTDifferentialImg2ImgPipeline(DiffusionPipeline):
709
  return self._guidance_rescale
710
 
711
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
712
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
713
  # corresponds to doing no classifier free guidance.
714
  @property
715
  def do_classifier_free_guidance(self):
@@ -809,7 +809,7 @@ class HunyuanDiTDifferentialImg2ImgPipeline(DiffusionPipeline):
809
  num_images_per_prompt (`int`, *optional*, defaults to 1):
810
  The number of images to generate per prompt.
811
  eta (`float`, *optional*, defaults to 0.0):
812
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
813
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
814
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
815
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -846,7 +846,7 @@ class HunyuanDiTDifferentialImg2ImgPipeline(DiffusionPipeline):
846
  inputs will be passed.
847
  guidance_rescale (`float`, *optional*, defaults to 0.0):
848
  Rescale the noise_cfg according to `guidance_rescale`. Based on findings of [Common Diffusion Noise
849
- Schedules and Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
850
  original_size (`Tuple[int, int]`, *optional*, defaults to `(1024, 1024)`):
851
  The original size of the image. Used to calculate the time ids.
852
  target_size (`Tuple[int, int]`, *optional*):
@@ -1095,7 +1095,7 @@ class HunyuanDiTDifferentialImg2ImgPipeline(DiffusionPipeline):
1095
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1096
 
1097
  if self.do_classifier_free_guidance and guidance_rescale > 0.0:
1098
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1099
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
1100
 
1101
  # compute the previous noisy sample x_t -> x_t-1
 
150
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
151
  """
152
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
153
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
154
  """
155
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
156
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
531
  def prepare_extra_step_kwargs(self, generator, eta):
532
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
533
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
534
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
535
  # and should be between [0, 1]
536
 
537
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
709
  return self._guidance_rescale
710
 
711
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
712
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
713
  # corresponds to doing no classifier free guidance.
714
  @property
715
  def do_classifier_free_guidance(self):
 
809
  num_images_per_prompt (`int`, *optional*, defaults to 1):
810
  The number of images to generate per prompt.
811
  eta (`float`, *optional*, defaults to 0.0):
812
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
813
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
814
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
815
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
846
  inputs will be passed.
847
  guidance_rescale (`float`, *optional*, defaults to 0.0):
848
  Rescale the noise_cfg according to `guidance_rescale`. Based on findings of [Common Diffusion Noise
849
+ Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
850
  original_size (`Tuple[int, int]`, *optional*, defaults to `(1024, 1024)`):
851
  The original size of the image. Used to calculate the time ids.
852
  target_size (`Tuple[int, int]`, *optional*):
 
1095
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1096
 
1097
  if self.do_classifier_free_guidance and guidance_rescale > 0.0:
1098
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1099
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
1100
 
1101
  # compute the previous noisy sample x_t -> x_t-1
main/pipeline_kolors_differential_img2img.py CHANGED
@@ -462,7 +462,7 @@ class KolorsDifferentialImg2ImgPipeline(
462
  def prepare_extra_step_kwargs(self, generator, eta):
463
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
464
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
465
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
466
  # and should be between [0, 1]
467
 
468
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -764,7 +764,7 @@ class KolorsDifferentialImg2ImgPipeline(
764
  return self._guidance_scale
765
 
766
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
767
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
768
  # corresponds to doing no classifier free guidance.
769
  @property
770
  def do_classifier_free_guidance(self):
@@ -884,9 +884,9 @@ class KolorsDifferentialImg2ImgPipeline(
884
  "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
885
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output)
886
  guidance_scale (`float`, *optional*, defaults to 5.0):
887
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
888
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
889
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
890
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
891
  usually at the expense of lower image quality.
892
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -896,7 +896,7 @@ class KolorsDifferentialImg2ImgPipeline(
896
  num_images_per_prompt (`int`, *optional*, defaults to 1):
897
  The number of images to generate per prompt.
898
  eta (`float`, *optional*, defaults to 0.0):
899
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
900
  [`schedulers.DDIMScheduler`], will be ignored for others.
901
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
902
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
462
  def prepare_extra_step_kwargs(self, generator, eta):
463
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
464
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
465
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
466
  # and should be between [0, 1]
467
 
468
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
764
  return self._guidance_scale
765
 
766
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
767
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
768
  # corresponds to doing no classifier free guidance.
769
  @property
770
  def do_classifier_free_guidance(self):
 
884
  "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
885
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output)
886
  guidance_scale (`float`, *optional*, defaults to 5.0):
887
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
888
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
889
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
890
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
891
  usually at the expense of lower image quality.
892
  negative_prompt (`str` or `List[str]`, *optional*):
 
896
  num_images_per_prompt (`int`, *optional*, defaults to 1):
897
  The number of images to generate per prompt.
898
  eta (`float`, *optional*, defaults to 0.0):
899
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
900
  [`schedulers.DDIMScheduler`], will be ignored for others.
901
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
902
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
main/pipeline_kolors_inpainting.py CHANGED
@@ -98,7 +98,7 @@ EXAMPLE_DOC_STRING = """
98
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
99
  """
100
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
101
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
102
  """
103
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
104
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -673,7 +673,7 @@ class KolorsInpaintPipeline(
673
  def prepare_extra_step_kwargs(self, generator, eta):
674
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
675
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
676
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
677
  # and should be between [0, 1]
678
 
679
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -1066,7 +1066,7 @@ class KolorsInpaintPipeline(
1066
  return self._guidance_rescale
1067
 
1068
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1069
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1070
  # corresponds to doing no classifier free guidance.
1071
  @property
1072
  def do_classifier_free_guidance(self):
@@ -1206,9 +1206,9 @@ class KolorsInpaintPipeline(
1206
  forms a part of a "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
1207
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output).
1208
  guidance_scale (`float`, *optional*, defaults to 7.5):
1209
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1210
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1211
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1212
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1213
  usually at the expense of lower image quality.
1214
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -1238,7 +1238,7 @@ class KolorsInpaintPipeline(
1238
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1239
  The number of images to generate per prompt.
1240
  eta (`float`, *optional*, defaults to 0.0):
1241
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1242
  [`schedulers.DDIMScheduler`], will be ignored for others.
1243
  generator (`torch.Generator`, *optional*):
1244
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -1621,7 +1621,7 @@ class KolorsInpaintPipeline(
1621
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1622
 
1623
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1624
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1625
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1626
 
1627
  # compute the previous noisy sample x_t -> x_t-1
 
98
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
99
  """
100
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
101
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
102
  """
103
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
104
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
673
  def prepare_extra_step_kwargs(self, generator, eta):
674
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
675
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
676
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
677
  # and should be between [0, 1]
678
 
679
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
1066
  return self._guidance_rescale
1067
 
1068
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1069
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1070
  # corresponds to doing no classifier free guidance.
1071
  @property
1072
  def do_classifier_free_guidance(self):
 
1206
  forms a part of a "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
1207
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output).
1208
  guidance_scale (`float`, *optional*, defaults to 7.5):
1209
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1210
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1211
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1212
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1213
  usually at the expense of lower image quality.
1214
  negative_prompt (`str` or `List[str]`, *optional*):
 
1238
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1239
  The number of images to generate per prompt.
1240
  eta (`float`, *optional*, defaults to 0.0):
1241
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1242
  [`schedulers.DDIMScheduler`], will be ignored for others.
1243
  generator (`torch.Generator`, *optional*):
1244
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
1621
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1622
 
1623
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1624
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1625
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1626
 
1627
  # compute the previous noisy sample x_t -> x_t-1
main/pipeline_prompt2prompt.py CHANGED
@@ -61,7 +61,7 @@ logger = logging.get_logger(__name__)
61
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
62
  """
63
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
64
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
65
  """
66
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
67
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -449,7 +449,7 @@ class Prompt2PromptPipeline(
449
  def prepare_extra_step_kwargs(self, generator, eta):
450
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
451
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
452
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
453
  # and should be between [0, 1]
454
 
455
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -592,9 +592,9 @@ class Prompt2PromptPipeline(
592
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
593
  expense of slower inference.
594
  guidance_scale (`float`, *optional*, defaults to 7.5):
595
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
596
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
597
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
598
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
599
  usually at the expense of lower image quality.
600
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -603,7 +603,7 @@ class Prompt2PromptPipeline(
603
  num_images_per_prompt (`int`, *optional*, defaults to 1):
604
  The number of images to generate per prompt.
605
  eta (`float`, *optional*, defaults to 0.0):
606
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
607
  [`schedulers.DDIMScheduler`], will be ignored for others.
608
  generator (`torch.Generator`, *optional*):
609
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -641,7 +641,7 @@ class Prompt2PromptPipeline(
641
 
642
  guidance_rescale (`float`, *optional*, defaults to 0.0):
643
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
644
- Flawed](https://arxiv.org/pdf/2305.08891.pdf). Guidance rescale factor should fix overexposure when
645
  using zero terminal SNR.
646
 
647
  Returns:
@@ -678,7 +678,7 @@ class Prompt2PromptPipeline(
678
 
679
  device = self._execution_device
680
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
681
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
682
  # corresponds to doing no classifier free guidance.
683
  do_classifier_free_guidance = guidance_scale > 1.0
684
 
@@ -734,7 +734,7 @@ class Prompt2PromptPipeline(
734
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
735
 
736
  if do_classifier_free_guidance and guidance_rescale > 0.0:
737
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
738
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
739
 
740
  # compute the previous noisy sample x_t -> x_t-1
 
61
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
62
  """
63
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
64
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
65
  """
66
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
67
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
449
  def prepare_extra_step_kwargs(self, generator, eta):
450
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
451
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
452
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
453
  # and should be between [0, 1]
454
 
455
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
592
  The number of denoising steps. More denoising steps usually lead to a higher quality image at the
593
  expense of slower inference.
594
  guidance_scale (`float`, *optional*, defaults to 7.5):
595
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
596
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
597
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
598
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
599
  usually at the expense of lower image quality.
600
  negative_prompt (`str` or `List[str]`, *optional*):
 
603
  num_images_per_prompt (`int`, *optional*, defaults to 1):
604
  The number of images to generate per prompt.
605
  eta (`float`, *optional*, defaults to 0.0):
606
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
607
  [`schedulers.DDIMScheduler`], will be ignored for others.
608
  generator (`torch.Generator`, *optional*):
609
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
641
 
642
  guidance_rescale (`float`, *optional*, defaults to 0.0):
643
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
644
+ Flawed](https://huggingface.co/papers/2305.08891). Guidance rescale factor should fix overexposure when
645
  using zero terminal SNR.
646
 
647
  Returns:
 
678
 
679
  device = self._execution_device
680
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
681
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
682
  # corresponds to doing no classifier free guidance.
683
  do_classifier_free_guidance = guidance_scale > 1.0
684
 
 
734
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
735
 
736
  if do_classifier_free_guidance and guidance_rescale > 0.0:
737
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
738
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=guidance_rescale)
739
 
740
  # compute the previous noisy sample x_t -> x_t-1
main/pipeline_sdxl_style_aligned.py CHANGED
@@ -12,7 +12,7 @@
12
  # See the License for the specific language governing permissions and
13
  # limitations under the License.
14
  #
15
- # Based on [Style Aligned Image Generation via Shared Attention](https://arxiv.org/abs/2312.02133).
16
  # Authors: Amir Hertz, Andrey Voynov, Shlomi Fruchter, Daniel Cohen-Or
17
  # Project Page: https://style-aligned-gen.github.io/
18
  # Code: https://github.com/google/style-aligned
@@ -315,7 +315,7 @@ class SharedAttentionProcessor(AttnProcessor2_0):
315
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
316
  """
317
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
318
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
319
  """
320
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
321
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -396,7 +396,7 @@ class StyleAlignedSDXLPipeline(
396
  r"""
397
  Pipeline for text-to-image generation using Stable Diffusion XL.
398
 
399
- This pipeline also adds experimental support for [StyleAligned](https://arxiv.org/abs/2312.02133). It can
400
  be enabled/disabled using `.enable_style_aligned()` or `.disable_style_aligned()` respectively.
401
 
402
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
@@ -773,7 +773,7 @@ class StyleAlignedSDXLPipeline(
773
  def prepare_extra_step_kwargs(self, generator, eta):
774
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
775
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
776
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
777
  # and should be between [0, 1]
778
 
779
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -1272,7 +1272,7 @@ class StyleAlignedSDXLPipeline(
1272
  only_self_level: float = 0.0,
1273
  ):
1274
  r"""
1275
- Enables the StyleAligned mechanism as in https://arxiv.org/abs/2312.02133.
1276
 
1277
  Args:
1278
  share_group_norm (`bool`, defaults to `True`):
@@ -1356,7 +1356,7 @@ class StyleAlignedSDXLPipeline(
1356
  return self._clip_skip
1357
 
1358
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1359
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1360
  # corresponds to doing no classifier free guidance.
1361
  @property
1362
  def do_classifier_free_guidance(self):
@@ -1457,9 +1457,9 @@ class StyleAlignedSDXLPipeline(
1457
  "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
1458
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output)
1459
  guidance_scale (`float`, *optional*, defaults to 5.0):
1460
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
1461
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1462
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
1463
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1464
  usually at the expense of lower image quality.
1465
  negative_prompt (`str` or `List[str]`, *optional*):
@@ -1472,7 +1472,7 @@ class StyleAlignedSDXLPipeline(
1472
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1473
  The number of images to generate per prompt.
1474
  eta (`float`, *optional*, defaults to 0.0):
1475
- Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
1476
  [`schedulers.DDIMScheduler`], will be ignored for others.
1477
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1478
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
@@ -1509,8 +1509,8 @@ class StyleAlignedSDXLPipeline(
1509
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1510
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1511
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
1512
- Flawed](https://arxiv.org/pdf/2305.08891.pdf) `guidance_scale` is defined as `φ` in equation 16. of
1513
- [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf).
1514
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
1515
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
1516
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
@@ -1840,7 +1840,7 @@ class StyleAlignedSDXLPipeline(
1840
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1841
 
1842
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1843
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1844
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1845
 
1846
  # compute the previous noisy sample x_t -> x_t-1
 
12
  # See the License for the specific language governing permissions and
13
  # limitations under the License.
14
  #
15
+ # Based on [Style Aligned Image Generation via Shared Attention](https://huggingface.co/papers/2312.02133).
16
  # Authors: Amir Hertz, Andrey Voynov, Shlomi Fruchter, Daniel Cohen-Or
17
  # Project Page: https://style-aligned-gen.github.io/
18
  # Code: https://github.com/google/style-aligned
 
315
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
316
  """
317
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
318
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
319
  """
320
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
321
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
396
  r"""
397
  Pipeline for text-to-image generation using Stable Diffusion XL.
398
 
399
+ This pipeline also adds experimental support for [StyleAligned](https://huggingface.co/papers/2312.02133). It can
400
  be enabled/disabled using `.enable_style_aligned()` or `.disable_style_aligned()` respectively.
401
 
402
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
 
773
  def prepare_extra_step_kwargs(self, generator, eta):
774
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
775
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
776
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
777
  # and should be between [0, 1]
778
 
779
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
1272
  only_self_level: float = 0.0,
1273
  ):
1274
  r"""
1275
+ Enables the StyleAligned mechanism as in https://huggingface.co/papers/2312.02133.
1276
 
1277
  Args:
1278
  share_group_norm (`bool`, defaults to `True`):
 
1356
  return self._clip_skip
1357
 
1358
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1359
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1360
  # corresponds to doing no classifier free guidance.
1361
  @property
1362
  def do_classifier_free_guidance(self):
 
1457
  "Mixture of Denoisers" multi-pipeline setup, as elaborated in [**Refining the Image
1458
  Output**](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl#refining-the-image-output)
1459
  guidance_scale (`float`, *optional*, defaults to 5.0):
1460
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
1461
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
1462
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
1463
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
1464
  usually at the expense of lower image quality.
1465
  negative_prompt (`str` or `List[str]`, *optional*):
 
1472
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1473
  The number of images to generate per prompt.
1474
  eta (`float`, *optional*, defaults to 0.0):
1475
+ Corresponds to parameter eta (η) in the DDIM paper: https://huggingface.co/papers/2010.02502. Only applies to
1476
  [`schedulers.DDIMScheduler`], will be ignored for others.
1477
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1478
  One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
 
1509
  [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1510
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1511
  Guidance rescale factor proposed by [Common Diffusion Noise Schedules and Sample Steps are
1512
+ Flawed](https://huggingface.co/papers/2305.08891) `guidance_scale` is defined as `φ` in equation 16. of
1513
+ [Common Diffusion Noise Schedules and Sample Steps are Flawed](https://huggingface.co/papers/2305.08891).
1514
  Guidance rescale factor should fix overexposure when using zero terminal SNR.
1515
  original_size (`Tuple[int]`, *optional*, defaults to (1024, 1024)):
1516
  If `original_size` is not the same as `target_size` the image will appear to be down- or upsampled.
 
1840
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1841
 
1842
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1843
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1844
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1845
 
1846
  # compute the previous noisy sample x_t -> x_t-1
main/pipeline_stable_diffusion_3_differential_img2img.py CHANGED
@@ -654,7 +654,7 @@ class StableDiffusion3DifferentialImg2ImgPipeline(DiffusionPipeline):
654
  return self._clip_skip
655
 
656
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
657
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
658
  # corresponds to doing no classifier free guidance.
659
  @property
660
  def do_classifier_free_guidance(self):
@@ -725,9 +725,9 @@ class StableDiffusion3DifferentialImg2ImgPipeline(DiffusionPipeline):
725
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
726
  passed will be used. Must be in descending order.
727
  guidance_scale (`float`, *optional*, defaults to 5.0):
728
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
729
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
730
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
731
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
732
  usually at the expense of lower image quality.
733
  negative_prompt (`str` or `List[str]`, *optional*):
 
654
  return self._clip_skip
655
 
656
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
657
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
658
  # corresponds to doing no classifier free guidance.
659
  @property
660
  def do_classifier_free_guidance(self):
 
725
  in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
726
  passed will be used. Must be in descending order.
727
  guidance_scale (`float`, *optional*, defaults to 5.0):
728
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
729
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
730
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
731
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
732
  usually at the expense of lower image quality.
733
  negative_prompt (`str` or `List[str]`, *optional*):
main/pipeline_stable_diffusion_3_instruct_pix2pix.py CHANGED
@@ -759,7 +759,7 @@ class StableDiffusion3InstructPix2PixPipeline(
759
  return self._clip_skip
760
 
761
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
762
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
763
  # corresponds to doing no classifier free guidance.
764
  @property
765
  def do_classifier_free_guidance(self):
@@ -918,9 +918,9 @@ class StableDiffusion3InstructPix2PixPipeline(
918
  their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is passed
919
  will be used.
920
  guidance_scale (`float`, *optional*, defaults to 7.0):
921
- Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
922
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
923
- Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
924
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
925
  usually at the expense of lower image quality.
926
  image_guidance_scale (`float`, *optional*, defaults to 1.5):
 
759
  return self._clip_skip
760
 
761
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
762
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
763
  # corresponds to doing no classifier free guidance.
764
  @property
765
  def do_classifier_free_guidance(self):
 
918
  their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is passed
919
  will be used.
920
  guidance_scale (`float`, *optional*, defaults to 7.0):
921
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598).
922
  `guidance_scale` is defined as `w` of equation 2. of [Imagen
923
+ Paper](https://huggingface.co/papers/2205.11487). Guidance scale is enabled by setting `guidance_scale >
924
  1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
925
  usually at the expense of lower image quality.
926
  image_guidance_scale (`float`, *optional*, defaults to 1.5):
main/pipeline_stable_diffusion_boxdiff.py CHANGED
@@ -307,7 +307,7 @@ def register_attention_control(model, controller):
307
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
308
  """
309
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
310
- Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
311
  """
312
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
313
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -793,7 +793,7 @@ class StableDiffusionBoxDiffPipeline(
793
  def prepare_extra_step_kwargs(self, generator, eta):
794
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
795
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
796
- # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
797
  # and should be between [0, 1]
798
 
799
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
@@ -893,7 +893,7 @@ class StableDiffusionBoxDiffPipeline(
893
  return latents
894
 
895
  def enable_freeu(self, s1: float, s2: float, b1: float, b2: float):
896
- r"""Enables the FreeU mechanism as in https://arxiv.org/abs/2309.11497.
897
 
898
  The suffixes after the scaling factors represent the stages where they are being applied.
899
 
@@ -1021,7 +1021,7 @@ class StableDiffusionBoxDiffPipeline(
1021
  return self._clip_skip
1022
 
1023
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1024
- # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
1025
  # corresponds to doing no classifier free guidance.
1026
  @property
1027
  def do_classifier_free_guidance(self):
@@ -1365,7 +1365,7 @@ class StableDiffusionBoxDiffPipeline(
1365
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1366
  The number of images to generate per prompt.
1367
  eta (`float`, *optional*, defaults to 0.0):
1368
- Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies
1369
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
1370
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1371
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
@@ -1391,7 +1391,7 @@ class StableDiffusionBoxDiffPipeline(
1391
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1392
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1393
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
1394
- Flawed](https://arxiv.org/pdf/2305.08891.pdf). Guidance rescale factor should fix overexposure when
1395
  using zero terminal SNR.
1396
  clip_skip (`int`, *optional*):
1397
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
@@ -1661,7 +1661,7 @@ class StableDiffusionBoxDiffPipeline(
1661
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1662
 
1663
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1664
- # Based on 3.4. in https://arxiv.org/pdf/2305.08891.pdf
1665
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1666
 
1667
  # compute the previous noisy sample x_t -> x_t-1
 
307
  def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
308
  """
309
  Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
310
+ Sample Steps are Flawed](https://huggingface.co/papers/2305.08891). See Section 3.4
311
  """
312
  std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
313
  std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
 
793
  def prepare_extra_step_kwargs(self, generator, eta):
794
  # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
795
  # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
796
+ # eta corresponds to η in DDIM paper: https://huggingface.co/papers/2010.02502
797
  # and should be between [0, 1]
798
 
799
  accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
 
893
  return latents
894
 
895
  def enable_freeu(self, s1: float, s2: float, b1: float, b2: float):
896
+ r"""Enables the FreeU mechanism as in https://huggingface.co/papers/2309.11497.
897
 
898
  The suffixes after the scaling factors represent the stages where they are being applied.
899
 
 
1021
  return self._clip_skip
1022
 
1023
  # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
1024
+ # of the Imagen paper: https://huggingface.co/papers/2205.11487 . `guidance_scale = 1`
1025
  # corresponds to doing no classifier free guidance.
1026
  @property
1027
  def do_classifier_free_guidance(self):
 
1365
  num_images_per_prompt (`int`, *optional*, defaults to 1):
1366
  The number of images to generate per prompt.
1367
  eta (`float`, *optional*, defaults to 0.0):
1368
+ Corresponds to parameter eta (η) from the [DDIM](https://huggingface.co/papers/2010.02502) paper. Only applies
1369
  to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers.
1370
  generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
1371
  A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make
 
1391
  [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
1392
  guidance_rescale (`float`, *optional*, defaults to 0.0):
1393
  Guidance rescale factor from [Common Diffusion Noise Schedules and Sample Steps are
1394
+ Flawed](https://huggingface.co/papers/2305.08891). Guidance rescale factor should fix overexposure when
1395
  using zero terminal SNR.
1396
  clip_skip (`int`, *optional*):
1397
  Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
 
1661
  noise_pred = noise_pred_uncond + self.guidance_scale * (noise_pred_text - noise_pred_uncond)
1662
 
1663
  if self.do_classifier_free_guidance and self.guidance_rescale > 0.0:
1664
+ # Based on 3.4. in https://huggingface.co/papers/2305.08891
1665
  noise_pred = rescale_noise_cfg(noise_pred, noise_pred_text, guidance_rescale=self.guidance_rescale)
1666
 
1667
  # compute the previous noisy sample x_t -> x_t-1