Skip to content

Commit 40762d5

Browse files
committed
feedback
1 parent 101cd95 commit 40762d5

File tree

3 files changed

+43
-48
lines changed

3 files changed

+43
-48
lines changed

docs/source/en/using-diffusers/custom_pipeline_overview.md

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

1717
## Community pipelines
1818

19-
Community pipelines are any [`DiffusionPipeline`] class that are different from the original implementation as specified in their paper (for example, the [`StableDiffusionControlNetPipeline`] corresponds to the [Text-to-Image Generation with ControlNet Conditioning](https://arxiv.org/abs/2302.05543) paper). They provide additional functionality or extend the original implementation of a pipeline.
19+
Community pipelines are any [`DiffusionPipeline`] class that are different from the original paper implementation (for example, the [`StableDiffusionControlNetPipeline`] corresponds to the [Text-to-Image Generation with ControlNet Conditioning](https://arxiv.org/abs/2302.05543) paper). They provide additional functionality or extend the original implementation of a pipeline.
2020

2121
There are many cool community pipelines like [Marigold Depth Estimation](https://github.com/huggingface/diffusers/tree/main/examples/community#marigold-depth-estimation) or [InstantID](https://github.com/huggingface/diffusers/tree/main/examples/community#instantid-pipeline), and you can find all the official community pipelines [here](https://github.com/huggingface/diffusers/tree/main/examples/community).
2222

23-
There are two types of community pipelines, those stored on the Hugging Face Hub and those stored on Diffusers GitHub repository. Refer to this [table](./contribute_pipeline#share-your-pipeline) for a comparison of Hub vs GitHub community pipelines.
23+
There are two types of community pipelines, those stored on the Hugging Face Hub and those stored on Diffusers GitHub repository. Hub pipelines are completely customizable (scheduler, models, pipeline code, etc.) while Diffusers GitHub pipelines are only limited to custom pipeline code. Refer to this [table](./contribute_pipeline#share-your-pipeline) for a more detailed comparison of Hub vs GitHub community pipelines.
2424

2525
<hfoptions id="community">
2626
<hfoption id="Hub pipelines">
@@ -85,7 +85,7 @@ By default, community pipelines are loaded from the latest stable version of Dif
8585
<hfoptions id="version">
8686
<hfoption id="main">
8787

88-
For example, to load from the `main` branch:
88+
For example, to load from the main branch:
8989

9090
```py
9191
pipeline = DiffusionPipeline.from_pretrained(
@@ -101,7 +101,7 @@ pipeline = DiffusionPipeline.from_pretrained(
101101
</hfoption>
102102
<hfoption id="older version">
103103

104-
For example, to load from a previous version of Diffusers like `v0.25.0`:
104+
For example, to load from a previous version of Diffusers like v0.25.0:
105105

106106
```py
107107
pipeline = DiffusionPipeline.from_pretrained(
@@ -129,6 +129,7 @@ from diffusers import DiffusionPipeline
129129

130130
pipe_sd = DiffusionPipeline.from_pretrained("emilianJR/CyberRealistic_V3", torch_dtype=torch.float16)
131131
pipe_sd.to("cuda")
132+
# load long prompt weighting pipeline
132133
pipe_lpw = DiffusionPipeline.from_pipe(
133134
pipe_sd,
134135
custom_pipeline="lpw_stable_diffusion",
@@ -152,11 +153,11 @@ out_lpw
152153
<div class="flex gap-4">
153154
<div>
154155
<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/from_pipe_lpw.png" />
155-
<figcaption class="mt-2 text-center text-sm text-gray-500">Stable Diffusion</figcaption>
156+
<figcaption class="mt-2 text-center text-sm text-gray-500">Stable Diffusion with long prompt weighting</figcaption>
156157
</div>
157158
<div>
158159
<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/from_pipe_non_lpw.png" />
159-
<figcaption class="mt-2 text-center text-sm text-gray-500">Stable Diffusion with long prompt weighting</figcaption>
160+
<figcaption class="mt-2 text-center text-sm text-gray-500">Stable Diffusion</figcaption>
160161
</div>
161162
</div>
162163

@@ -166,7 +167,7 @@ Community components allow users to build pipelines that may have customized com
166167

167168
This section shows how users should use community components to build a community pipeline.
168169

169-
You'll use the [showlab/show-1-base](https://huggingface.co/showlab/show-1-base) pipeline checkpoint as an example. So, let's start loading the components:
170+
You'll use the [showlab/show-1-base](https://huggingface.co/showlab/show-1-base) pipeline checkpoint as an example.
170171

171172
1. Import and load the text encoder from Transformers:
172173

@@ -202,13 +203,13 @@ In steps 4 and 5, the custom [UNet](https://github.com/showlab/Show-1/blob/main/
202203

203204
4. Now you'll load a [custom UNet](https://github.com/showlab/Show-1/blob/main/showone/models/unet_3d_condition.py), which in this example, has already been implemented in [showone_unet_3d_condition.py](https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py) for your convenience. You'll notice the [`UNet3DConditionModel`] class name is changed to `ShowOneUNet3DConditionModel` because [`UNet3DConditionModel`] already exists in Diffusers. Any components needed for the `ShowOneUNet3DConditionModel` class should be placed in showone_unet_3d_condition.py.
204205

205-
Once this is done, you can initialize the UNet:
206+
Once this is done, you can initialize the UNet:
206207

207-
```python
208-
from showone_unet_3d_condition import ShowOneUNet3DConditionModel
208+
```python
209+
from showone_unet_3d_condition import ShowOneUNet3DConditionModel
209210

210-
unet = ShowOneUNet3DConditionModel.from_pretrained(pipe_id, subfolder="unet")
211-
```
211+
unet = ShowOneUNet3DConditionModel.from_pretrained(pipe_id, subfolder="unet")
212+
```
212213

213214
5. Finally, you'll load the custom pipeline code. For this example, it has already been created for you in [pipeline_t2v_base_pixel.py](https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/pipeline_t2v_base_pixel.py). This script contains a custom `TextToVideoIFPipeline` class for generating videos from text. Just like the custom UNet, any code needed for the custom pipeline to work should go in pipeline_t2v_base_pixel.py.
214215

@@ -235,7 +236,7 @@ Push the pipeline to the Hub to share with the community!
235236
pipeline.push_to_hub("custom-t2v-pipeline")
236237
```
237238

238-
After the pipeline is successfully pushed, you need a couple of changes:
239+
After the pipeline is successfully pushed, you need to make a few changes:
239240

240241
1. Change the `_class_name` attribute in [model_index.json](https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/model_index.json#L2) to `"pipeline_t2v_base_pixel"` and `"TextToVideoIFPipeline"`.
241242
2. Upload `showone_unet_3d_condition.py` to the [unet](https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py) subfolder.

0 commit comments

Comments
 (0)