Skip to content

Commit f6fb328

Browse files
[Outputs] Improve syntax (#423)
* [Outputs] Improve syntax * improve more * fix docstring return * correct all * uP Co-authored-by: Mishig Davaadorj <[email protected]>
1 parent 1a79969 commit f6fb328

26 files changed

+162
-76
lines changed

docs/source/api/diffusion_pipeline.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
1010
specific language governing permissions and limitations under the License.
1111
-->
1212

13-
# Diffusion Pipeline
13+
# Pipelines
1414

1515
The [`DiffusionPipeline`] is the easiest way to load any pretrained diffusion pipeline from the [Hub](https://huggingface.co/models?library=diffusers) and to use it in inference.
1616

@@ -28,6 +28,12 @@ pipeline and pass them into the `__init__` function of the pipeline, *e.g.* [`~S
2828

2929
Any pipeline object can be saved locally with [`~DiffusionPipeline.save_pretrained`].
3030

31+
## DiffusionPipeline
3132
[[autodoc]] DiffusionPipeline
3233
- from_pretrained
3334
- save_pretrained
35+
36+
## ImagePipelineOutput
37+
By default diffusion pipelines return an object of class
38+
39+
[[autodoc]] pipeline_utils.ImagePipelineOutput

docs/source/api/pipelines/ddim.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ The original codebase of this paper can be found [here](https://github.com/ermon
1717
| [pipeline_ddim.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ddim/pipeline_ddim.py) | *Unconditional Image Generation* | - |
1818

1919

20-
## API
21-
22-
[[autodoc]] pipelines.ddim.pipeline_ddim.DDIMPipeline
20+
## DDIMPipeline
21+
[[autodoc]] DDIMPipeline
2322
- __call__

docs/source/api/pipelines/ddpm.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ The original codebase of this paper can be found [here](https://github.com/hojon
1919
| [pipeline_ddpm.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ddpm/pipeline_ddpm.py) | *Unconditional Image Generation* | - |
2020

2121

22-
## API
23-
24-
[[autodoc]] pipelines.ddpm.pipeline_ddpm.DDPMPipeline
22+
# DDPMPipeline
23+
[[autodoc]] DDPMPipeline
2524
- __call__

docs/source/api/pipelines/latent_diffusion.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ The original codebase can be found [here](https://github.com/CompVis/latent-diff
2525
## Examples:
2626

2727

28-
## API
29-
28+
## LDMTextToImagePipeline
3029
[[autodoc]] pipelines.latent_diffusion.pipeline_latent_diffusion.LDMTextToImagePipeline
3130
- __call__

docs/source/api/pipelines/latent_diffusion_uncond.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ The original codebase can be found [here](https://github.com/CompVis/latent-diff
2424

2525
## Examples:
2626

27-
## API
28-
29-
[[autodoc]] pipelines.latent_diffusion_uncond.pipeline_latent_diffusion_uncond.LDMPipeline
27+
## LDMPipeline
28+
[[autodoc]] LDMPipeline
3029
- __call__

docs/source/api/pipelines/pndm.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ The original codebase can be found [here](https://github.com/luping-liu/PNDM).
1717
| [pipeline_pndm.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pndm/pipeline_pndm.py) | *Unconditional Image Generation* | - |
1818

1919

20-
## API
21-
20+
## PNDMPipeline
2221
[[autodoc]] pipelines.pndm.pipeline_pndm.PNDMPipeline
2322
- __call__
2423

docs/source/api/pipelines/score_sde_ve.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ This pipeline implements the Variance Expanding (VE) variant of the method.
1818
|---|---|:---:|
1919
| [pipeline_score_sde_ve.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py) | *Unconditional Image Generation* | - |
2020

21-
## API
22-
23-
[[autodoc]] pipelines.score_sde_ve.pipeline_score_sde_ve.ScoreSdeVePipeline
21+
## ScoreSdeVePipeline
22+
[[autodoc]] ScoreSdeVePipeline
2423
- __call__
2524

docs/source/api/pipelines/stable_diffusion.mdx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,31 @@ For more details about how Stable Diffusion works and how it differs from the ba
88

99
*Tips*:
1010
- To tweak your prompts on a specific result you liked, you can generate your own latents, as demonstrated in the following notebook: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pcuenca/diffusers-examples/blob/main/notebooks/stable-diffusion-seeds.ipynb)
11-
- TODO: some interesting Tips
1211

12+
*Overview*:
1313
| Pipeline | Tasks | Colab | Demo
1414
|---|---|:---:|:---:|
1515
| [pipeline_stable_diffusion.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py) | *Text-to-Image Generation* | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb) | [🤗 Stable Diffusion](https://huggingface.co/spaces/stabilityai/stable-diffusion)
1616
| [pipeline_stable_diffusion_img2img.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py) | *Image-to-Image Text-Guided Generation* | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/patil-suraj/Notebooks/blob/master/image_2_image_using_diffusers.ipynb) | [🤗 Diffuse the Rest](https://huggingface.co/spaces/huggingface/diffuse-the-rest)
1717
| [pipeline_stable_diffusion_inpaint.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py) | **Experimental***Text-Guided Image Inpainting* | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/patil-suraj/Notebooks/blob/master/in_painting_with_stable_diffusion_using_diffusers.ipynb) | Coming soon
1818

19+
## StableDiffusionPipelineOutput
20+
[[autodoc]] pipelines.stable_diffusion.StableDiffusionPipelineOutput
21+
22+
## StableDiffusionPipeline
1923
[[autodoc]] StableDiffusionPipeline
20-
- __init__
21-
- __call__
22-
- enable_attention_slicing
23-
- disable_attention_slicing
24+
- __call__
25+
- enable_attention_slicing
26+
- disable_attention_slicing
2427

28+
## StableDiffusionImg2ImgPipeline
2529
[[autodoc]] StableDiffusionImg2ImgPipeline
26-
- __init__
27-
- __call__
28-
- enable_attention_slicing
29-
- disable_attention_slicing
30+
- __call__
31+
- enable_attention_slicing
32+
- disable_attention_slicing
3033

34+
## StableDiffusionInpaintPipeline
3135
[[autodoc]] StableDiffusionInpaintPipeline
32-
- __init__
33-
- __call__
34-
- enable_attention_slicing
35-
- disable_attention_slicing
36-
36+
- __call__
37+
- enable_attention_slicing
38+
- disable_attention_slicing

docs/source/api/pipelines/stochastic_karras_ve.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ This pipeline implements the Stochastic sampling tailored to the Variance-Expand
1818
| [pipeline_stochastic_karras_ve.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py) | *Unconditional Image Generation* | - |
1919

2020

21-
## API
22-
23-
[[autodoc]] pipelines.stochastic_karras_ve.pipeline_stochastic_karras_ve.KarrasVePipeline
21+
## KarrasVePipeline
22+
[[autodoc]] KarrasVePipeline
2423
- __call__

src/diffusers/pipelines/ddim/pipeline_ddim.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,26 @@ def __call__(
5252
) -> Union[ImagePipelineOutput, Tuple]:
5353
r"""
5454
Args:
55-
batch_size (:obj:`int`, *optional*, defaults to 1):
55+
batch_size (`int`, *optional*, defaults to 1):
5656
The number of images to generate.
57-
generator (:obj:`torch.Generator`, *optional*):
57+
generator (`torch.Generator`, *optional*):
5858
A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
5959
deterministic.
60-
eta (:obj:`float`, *optional*, defaults to 0.0):
60+
eta (`float`, *optional*, defaults to 0.0):
6161
The eta parameter which controls the scale of the variance (0 is DDIM and 1 is one type of DDPM).
62-
num_inference_steps (:obj:`int`, *optional*, defaults to 50):
62+
num_inference_steps (`int`, *optional*, defaults to 50):
6363
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
6464
expense of slower inference.
65-
output_type (:obj:`str`, *optional*, defaults to :obj:`"pil"`):
65+
output_type (`str`, *optional*, defaults to `"pil"`):
6666
The output format of the generate image. Choose between
6767
[PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `nd.array`.
68-
return_dict (:obj:`bool`, *optional*, defaults to :obj:`True`):
68+
return_dict (`bool`, *optional*, defaults to `True`):
6969
Whether or not to return a [`~pipeline_utils.ImagePipelineOutput`] instead of a plain tuple.
70+
71+
Returns:
72+
[`~pipeline_utils.ImagePipelineOutput`] or `tuple`: [`~pipelines.utils.ImagePipelineOutput`] if
73+
`return_dict` is True, otherwise a `tuple. When returning a tuple, the first element is a list with the
74+
generated images.
7075
"""
7176

7277
if "torch_device" in kwargs:

0 commit comments

Comments
 (0)