Skip to content

Commit 1a6a647

Browse files
authored
[docs] More API fixes (#3640)
* part 2 of api fixes * move randn_tensor * add to toctree * apply feedback * more feedback
1 parent 995bbcb commit 1a6a647

19 files changed

+161
-151
lines changed

docs/source/en/_toctree.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,16 @@
144144
title: Outputs
145145
- local: api/loaders
146146
title: Loaders
147+
- local: api/utilities
148+
title: Utilities
147149
title: Main Classes
148150
- sections:
149151
- local: api/pipelines/overview
150152
title: Overview
151153
- local: api/pipelines/alt_diffusion
152154
title: AltDiffusion
155+
- local: api/pipelines/attend_and_excite
156+
title: Attend and Excite
153157
- local: api/pipelines/audio_diffusion
154158
title: Audio Diffusion
155159
- local: api/pipelines/audioldm
@@ -164,24 +168,32 @@
164168
title: DDIM
165169
- local: api/pipelines/ddpm
166170
title: DDPM
171+
- local: api/pipelines/diffedit
172+
title: DiffEdit
167173
- local: api/pipelines/dit
168174
title: DiT
169175
- local: api/pipelines/if
170176
title: IF
177+
- local: api/pipelines/pix2pix
178+
title: InstructPix2Pix
171179
- local: api/pipelines/kandinsky
172180
title: Kandinsky
173181
- local: api/pipelines/latent_diffusion
174182
title: Latent Diffusion
183+
- local: api/pipelines/panorama
184+
title: MultiDiffusion Panorama
175185
- local: api/pipelines/paint_by_example
176186
title: PaintByExample
187+
- local: api/pipelines/pix2pix_zero
188+
title: Pix2Pix Zero
177189
- local: api/pipelines/pndm
178190
title: PNDM
179191
- local: api/pipelines/repaint
180192
title: RePaint
181-
- local: api/pipelines/stable_diffusion_safe
182-
title: Safe Stable Diffusion
183193
- local: api/pipelines/score_sde_ve
184194
title: Score SDE VE
195+
- local: api/pipelines/self_attention_guidance
196+
title: Self-Attention Guidance
185197
- local: api/pipelines/semantic_stable_diffusion
186198
title: Semantic Guidance
187199
- local: api/pipelines/spectrogram_diffusion
@@ -199,31 +211,21 @@
199211
title: Depth-to-Image
200212
- local: api/pipelines/stable_diffusion/image_variation
201213
title: Image-Variation
202-
- local: api/pipelines/stable_diffusion/upscale
203-
title: Super-Resolution
214+
- local: api/pipelines/stable_diffusion/stable_diffusion_safe
215+
title: Safe Stable Diffusion
216+
- local: api/pipelines/stable_diffusion/stable_diffusion_2
217+
title: Stable Diffusion 2
204218
- local: api/pipelines/stable_diffusion/latent_upscale
205219
title: Stable-Diffusion-Latent-Upscaler
206-
- local: api/pipelines/stable_diffusion/pix2pix
207-
title: InstructPix2Pix
208-
- local: api/pipelines/stable_diffusion/attend_and_excite
209-
title: Attend and Excite
210-
- local: api/pipelines/stable_diffusion/pix2pix_zero
211-
title: Pix2Pix Zero
212-
- local: api/pipelines/stable_diffusion/self_attention_guidance
213-
title: Self-Attention Guidance
214-
- local: api/pipelines/stable_diffusion/panorama
215-
title: MultiDiffusion Panorama
216-
- local: api/pipelines/stable_diffusion/model_editing
217-
title: Text-to-Image Model Editing
218-
- local: api/pipelines/stable_diffusion/diffedit
219-
title: DiffEdit
220+
- local: api/pipelines/stable_diffusion/upscale
221+
title: Super-Resolution
220222
title: Stable Diffusion
221-
- local: api/pipelines/stable_diffusion_2
222-
title: Stable Diffusion 2
223223
- local: api/pipelines/stable_unclip
224224
title: Stable unCLIP
225225
- local: api/pipelines/stochastic_karras_ve
226226
title: Stochastic Karras VE
227+
- local: api/pipelines/model_editing
228+
title: Text-to-Image Model Editing
227229
- local: api/pipelines/text_to_video
228230
title: Text-to-Video
229231
- local: api/pipelines/text_to_video_zero

docs/source/en/api/diffusion_pipeline.mdx

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,25 @@ specific language governing permissions and limitations under the License.
1212

1313
# Pipelines
1414

15-
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.
15+
The [`DiffusionPipeline`] is the easiest way to load any pretrained diffusion pipeline from the [Hub](https://huggingface.co/models?library=diffusers) and use it for inference.
1616

1717
<Tip>
1818

19-
One should not use the Diffusion Pipeline class for training or fine-tuning a diffusion model. Individual
20-
components of diffusion pipelines are usually trained individually, so we suggest to directly work
21-
with [`UNetModel`] and [`UNetConditionModel`].
19+
You shouldn't use the [`DiffusionPipeline`] class for training or finetuning a diffusion model. Individual
20+
components (for example, [`UNetModel`] and [`UNetConditionModel`]) of diffusion pipelines are usually trained individually, so we suggest directly working with instead.
2221

2322
</Tip>
2423

25-
Any diffusion pipeline that is loaded with [`~DiffusionPipeline.from_pretrained`] will automatically
26-
detect the pipeline type, *e.g.* [`StableDiffusionPipeline`] and consequently load each component of the
27-
pipeline and pass them into the `__init__` function of the pipeline, *e.g.* [`~StableDiffusionPipeline.__init__`].
24+
The pipeline type (for example [`StableDiffusionPipeline`]) of any diffusion pipeline loaded with [`~DiffusionPipeline.from_pretrained`] is automatically
25+
detected and pipeline components are loaded and passed to the `__init__` function of the pipeline.
2826

2927
Any pipeline object can be saved locally with [`~DiffusionPipeline.save_pretrained`].
3028

3129
## DiffusionPipeline
30+
3231
[[autodoc]] DiffusionPipeline
3332
- all
3433
- __call__
3534
- device
3635
- to
3736
- components
38-
39-
## ImagePipelineOutput
40-
By default diffusion pipelines return an object of class
41-
42-
[[autodoc]] pipelines.ImagePipelineOutput
43-
44-
## AudioPipelineOutput
45-
By default diffusion pipelines return an object of class
46-
47-
[[autodoc]] pipelines.AudioPipelineOutput
48-
49-
## ImageTextPipelineOutput
50-
By default diffusion pipelines return an object of class
51-
52-
[[autodoc]] ImageTextPipelineOutput

docs/source/en/api/outputs.mdx

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ specific language governing permissions and limitations under the License.
1212

1313
# BaseOutputs
1414

15-
All models have outputs that are instances of subclasses of [`~utils.BaseOutput`]. Those are
16-
data structures containing all the information returned by the model, but that can also be used as tuples or
15+
All models have outputs that are subclasses of [`~utils.BaseOutput`]. Those are
16+
data structures containing all the information returned by the model, but they can also be used as tuples or
1717
dictionaries.
1818

19-
Let's see how this looks in an example:
19+
For example:
2020

2121
```python
2222
from diffusers import DDIMPipeline
@@ -25,31 +25,45 @@ pipeline = DDIMPipeline.from_pretrained("google/ddpm-cifar10-32")
2525
outputs = pipeline()
2626
```
2727

28-
The `outputs` object is a [`~pipelines.ImagePipelineOutput`], as we can see in the
29-
documentation of that class below, it means it has an image attribute.
28+
The `outputs` object is a [`~pipelines.ImagePipelineOutput`] which means it has an image attribute.
3029

31-
You can access each attribute as you would usually do, and if that attribute has not been returned by the model, you will get `None`:
30+
You can access each attribute as you normally would or with a keyword lookup, and if that attribute is not returned by the model, you will get `None`:
3231

3332
```python
3433
outputs.images
35-
```
36-
37-
or via keyword lookup
38-
39-
```python
4034
outputs["images"]
4135
```
4236

43-
When considering our `outputs` object as tuple, it only considers the attributes that don't have `None` values.
44-
Here for instance, we could retrieve images via indexing:
37+
When considering the `outputs` object as a tuple, it only considers the attributes that don't have `None` values.
38+
For instance, retrieving an image by indexing into it returns the tuple `(outputs.images)`:
4539

4640
```python
4741
outputs[:1]
4842
```
4943

50-
which will return the tuple `(outputs.images)` for instance.
44+
<Tip>
45+
46+
To check a specific pipeline or model output, refer to its corresponding API documentation.
47+
48+
</Tip>
5149

5250
## BaseOutput
5351

5452
[[autodoc]] utils.BaseOutput
5553
- to_tuple
54+
55+
## ImagePipelineOutput
56+
57+
[[autodoc]] pipelines.ImagePipelineOutput
58+
59+
## FlaxImagePipelineOutput
60+
61+
[[autodoc]] pipelines.pipeline_flax_utils.FlaxImagePipelineOutput
62+
63+
## AudioPipelineOutput
64+
65+
[[autodoc]] pipelines.AudioPipelineOutput
66+
67+
## ImageTextPipelineOutput
68+
69+
[[autodoc]] ImageTextPipelineOutput
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)