Skip to content

Commit bcd61fd

Browse files
jeongiinstevhliua-r-r-o-wsayakpaul
authored
[docs] add docstrings in pipline_stable_diffusion.py (#9590)
* fix the issue on flux dreambooth lora training * update : origin main code * docs: update pipeline_stable_diffusion docstring * docs: update pipeline_stable_diffusion docstring * Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py Co-authored-by: Steven Liu <[email protected]> * fix: style * fix: style * fix: copies * make fix-copies * remove extra newline --------- Co-authored-by: Steven Liu <[email protected]> Co-authored-by: Aryan <[email protected]> Co-authored-by: Sayak Paul <[email protected]>
1 parent d27ecc5 commit bcd61fd

File tree

60 files changed

+354
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+354
-114
lines changed

src/diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,21 @@
113113

114114
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
115115
def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
116-
"""
117-
Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
118-
Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
116+
r"""
117+
Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
118+
Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
119+
Flawed](https://arxiv.org/pdf/2305.08891.pdf).
120+
121+
Args:
122+
noise_cfg (`torch.Tensor`):
123+
The predicted noise tensor for the guided diffusion process.
124+
noise_pred_text (`torch.Tensor`):
125+
The predicted noise tensor for the text-guided diffusion process.
126+
guidance_rescale (`float`, *optional*, defaults to 0.0):
127+
A rescale factor applied to the noise predictions.
128+
129+
Returns:
130+
noise_cfg (`torch.Tensor`): The rescaled noise prediction tensor.
119131
"""
120132
std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
121133
std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -135,7 +147,7 @@ def retrieve_timesteps(
135147
sigmas: Optional[List[float]] = None,
136148
**kwargs,
137149
):
138-
"""
150+
r"""
139151
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
140152
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
141153

src/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def retrieve_timesteps(
119119
sigmas: Optional[List[float]] = None,
120120
**kwargs,
121121
):
122-
"""
122+
r"""
123123
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
124124
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
125125

src/diffusers/pipelines/animatediff/pipeline_animatediff_video2video_controlnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def retrieve_timesteps(
131131
sigmas: Optional[List[float]] = None,
132132
**kwargs,
133133
):
134-
"""
134+
r"""
135135
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
136136
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
137137

src/diffusers/pipelines/aura_flow/pipeline_aura_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def retrieve_timesteps(
5353
sigmas: Optional[List[float]] = None,
5454
**kwargs,
5555
):
56-
"""
56+
r"""
5757
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
5858
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
5959

src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def retrieve_timesteps(
8686
sigmas: Optional[List[float]] = None,
8787
**kwargs,
8888
):
89-
"""
89+
r"""
9090
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
9191
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
9292

src/diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def retrieve_timesteps(
9393
sigmas: Optional[List[float]] = None,
9494
**kwargs,
9595
):
96-
"""
96+
r"""
9797
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
9898
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
9999

src/diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def retrieve_timesteps(
8888
sigmas: Optional[List[float]] = None,
8989
**kwargs,
9090
):
91-
"""
91+
r"""
9292
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
9393
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
9494

src/diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def retrieve_timesteps(
9494
sigmas: Optional[List[float]] = None,
9595
**kwargs,
9696
):
97-
"""
97+
r"""
9898
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
9999
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
100100

src/diffusers/pipelines/cogview3/pipeline_cogview3plus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def retrieve_timesteps(
5757
sigmas: Optional[List[float]] = None,
5858
**kwargs,
5959
):
60-
"""
60+
r"""
6161
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
6262
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
6363

src/diffusers/pipelines/controlnet/pipeline_controlnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def retrieve_timesteps(
101101
sigmas: Optional[List[float]] = None,
102102
**kwargs,
103103
):
104-
"""
104+
r"""
105105
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
106106
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
107107

src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,21 @@ def retrieve_latents(
137137

138138
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
139139
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
140+
r"""
141+
Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
142+
Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
143+
Flawed](https://arxiv.org/pdf/2305.08891.pdf).
144+
145+
Args:
146+
noise_cfg (`torch.Tensor`):
147+
The predicted noise tensor for the guided diffusion process.
148+
noise_pred_text (`torch.Tensor`):
149+
The predicted noise tensor for the text-guided diffusion process.
150+
guidance_rescale (`float`, *optional*, defaults to 0.0):
151+
A rescale factor applied to the noise predictions.
152+
153+
Returns:
154+
noise_cfg (`torch.Tensor`): The rescaled noise prediction tensor.
143155
"""
144156
std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
145157
std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)

src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def retrieve_timesteps(
122122
sigmas: Optional[List[float]] = None,
123123
**kwargs,
124124
):
125-
"""
125+
r"""
126126
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
127127
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
128128

src/diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,21 @@ def get_resize_crop_region_for_grid(src, tgt_size):
141141

142142
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
143143
def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
144-
"""
145-
Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
146-
Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
144+
r"""
145+
Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
146+
Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
147+
Flawed](https://arxiv.org/pdf/2305.08891.pdf).
148+
149+
Args:
150+
noise_cfg (`torch.Tensor`):
151+
The predicted noise tensor for the guided diffusion process.
152+
noise_pred_text (`torch.Tensor`):
153+
The predicted noise tensor for the text-guided diffusion process.
154+
guidance_rescale (`float`, *optional*, defaults to 0.0):
155+
A rescale factor applied to the noise predictions.
156+
157+
Returns:
158+
noise_cfg (`torch.Tensor`): The rescaled noise prediction tensor.
147159
"""
148160
std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
149161
std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)

src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def retrieve_timesteps(
8383
sigmas: Optional[List[float]] = None,
8484
**kwargs,
8585
):
86-
"""
86+
r"""
8787
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
8888
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
8989

src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet_inpainting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def retrieve_timesteps(
108108
sigmas: Optional[List[float]] = None,
109109
**kwargs,
110110
):
111-
"""
111+
r"""
112112
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
113113
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
114114

src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,21 @@
6565

6666
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
6767
def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
68-
"""
69-
Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
70-
Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
68+
r"""
69+
Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
70+
Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
71+
Flawed](https://arxiv.org/pdf/2305.08891.pdf).
72+
73+
Args:
74+
noise_cfg (`torch.Tensor`):
75+
The predicted noise tensor for the guided diffusion process.
76+
noise_pred_text (`torch.Tensor`):
77+
The predicted noise tensor for the text-guided diffusion process.
78+
guidance_rescale (`float`, *optional*, defaults to 0.0):
79+
A rescale factor applied to the noise predictions.
80+
81+
Returns:
82+
noise_cfg (`torch.Tensor`): The rescaled noise prediction tensor.
7183
"""
7284
std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
7385
std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)
@@ -87,7 +99,7 @@ def retrieve_timesteps(
8799
sigmas: Optional[List[float]] = None,
88100
**kwargs,
89101
):
90-
"""
102+
r"""
91103
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
92104
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
93105

src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def retrieve_timesteps(
127127
sigmas: Optional[List[float]] = None,
128128
**kwargs,
129129
):
130-
"""
130+
r"""
131131
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
132132
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
133133

src/diffusers/pipelines/flux/pipeline_flux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def retrieve_timesteps(
8686
sigmas: Optional[List[float]] = None,
8787
**kwargs,
8888
):
89-
"""
89+
r"""
9090
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
9191
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
9292

src/diffusers/pipelines/flux/pipeline_flux_controlnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def retrieve_timesteps(
106106
sigmas: Optional[List[float]] = None,
107107
**kwargs,
108108
):
109-
"""
109+
r"""
110110
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
111111
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
112112

src/diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def retrieve_timesteps(
118118
sigmas: Optional[List[float]] = None,
119119
**kwargs,
120120
):
121-
"""
121+
r"""
122122
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
123123
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
124124

src/diffusers/pipelines/flux/pipeline_flux_controlnet_inpainting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def retrieve_timesteps(
120120
sigmas: Optional[List[float]] = None,
121121
**kwargs,
122122
):
123-
"""
123+
r"""
124124
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
125125
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
126126

src/diffusers/pipelines/flux/pipeline_flux_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def retrieve_timesteps(
108108
sigmas: Optional[List[float]] = None,
109109
**kwargs,
110110
):
111-
"""
111+
r"""
112112
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
113113
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
114114

src/diffusers/pipelines/flux/pipeline_flux_inpaint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def retrieve_timesteps(
105105
sigmas: Optional[List[float]] = None,
106106
**kwargs,
107107
):
108-
"""
108+
r"""
109109
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
110110
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
111111

src/diffusers/pipelines/hunyuandit/pipeline_hunyuandit.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,21 @@ def get_resize_crop_region_for_grid(src, tgt_size):
125125

126126
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
127127
def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
128-
"""
129-
Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
130-
Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
128+
r"""
129+
Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
130+
Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
131+
Flawed](https://arxiv.org/pdf/2305.08891.pdf).
132+
133+
Args:
134+
noise_cfg (`torch.Tensor`):
135+
The predicted noise tensor for the guided diffusion process.
136+
noise_pred_text (`torch.Tensor`):
137+
The predicted noise tensor for the text-guided diffusion process.
138+
guidance_rescale (`float`, *optional*, defaults to 0.0):
139+
A rescale factor applied to the noise predictions.
140+
141+
Returns:
142+
noise_cfg (`torch.Tensor`): The rescaled noise prediction tensor.
131143
"""
132144
std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
133145
std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)

src/diffusers/pipelines/kolors/pipeline_kolors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def retrieve_timesteps(
7070
sigmas: Optional[List[float]] = None,
7171
**kwargs,
7272
):
73-
"""
73+
r"""
7474
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
7575
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
7676

src/diffusers/pipelines/kolors/pipeline_kolors_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def retrieve_timesteps(
8989
sigmas: Optional[List[float]] = None,
9090
**kwargs,
9191
):
92-
"""
92+
r"""
9393
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
9494
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
9595

src/diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def retrieve_timesteps(
6666
sigmas: Optional[List[float]] = None,
6767
**kwargs,
6868
):
69-
"""
69+
r"""
7070
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
7171
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
7272

src/diffusers/pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def retrieve_timesteps(
7070
sigmas: Optional[List[float]] = None,
7171
**kwargs,
7272
):
73-
"""
73+
r"""
7474
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
7575
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
7676

src/diffusers/pipelines/latte/pipeline_latte.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def retrieve_timesteps(
7676
sigmas: Optional[List[float]] = None,
7777
**kwargs,
7878
):
79-
"""
79+
r"""
8080
Calls the scheduler's `set_timesteps` method and retrieves timesteps from the scheduler after the call. Handles
8181
custom timesteps. Any kwargs will be supplied to `scheduler.set_timesteps`.
8282

src/diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,21 @@ def __call__(
234234

235235
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.rescale_noise_cfg
236236
def rescale_noise_cfg(noise_cfg, noise_pred_text, guidance_rescale=0.0):
237-
"""
238-
Rescale `noise_cfg` according to `guidance_rescale`. Based on findings of [Common Diffusion Noise Schedules and
239-
Sample Steps are Flawed](https://arxiv.org/pdf/2305.08891.pdf). See Section 3.4
237+
r"""
238+
Rescales `noise_cfg` tensor based on `guidance_rescale` to improve image quality and fix overexposure. Based on
239+
Section 3.4 from [Common Diffusion Noise Schedules and Sample Steps are
240+
Flawed](https://arxiv.org/pdf/2305.08891.pdf).
241+
242+
Args:
243+
noise_cfg (`torch.Tensor`):
244+
The predicted noise tensor for the guided diffusion process.
245+
noise_pred_text (`torch.Tensor`):
246+
The predicted noise tensor for the text-guided diffusion process.
247+
guidance_rescale (`float`, *optional*, defaults to 0.0):
248+
A rescale factor applied to the noise predictions.
249+
250+
Returns:
251+
noise_cfg (`torch.Tensor`): The rescaled noise prediction tensor.
240252
"""
241253
std_text = noise_pred_text.std(dim=list(range(1, noise_pred_text.ndim)), keepdim=True)
242254
std_cfg = noise_cfg.std(dim=list(range(1, noise_cfg.ndim)), keepdim=True)

0 commit comments

Comments
 (0)