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

0 commit comments

Comments
 (0)