You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noweverybodythathas`diffusers >= 0.4.0` installed can use our pipeline magically 🪄 as follows:
115
+
Another way to share your community pipeline is to upload the `one_step_unet.py` file directly to your preferred [model repository](https://huggingface.co/docs/hub/models-uploading) on the Hub. Instead of specifying the `one_step_unet.py` file, pass the model repository id to the `custom_pipeline` argument:
Another way to upload your custom_pipeline, besides sending a PR, is uploading the code that contains it to the Hugging Face Hub, [as exemplified here](https://huggingface.co/docs/diffusers/using-diffusers/custom_pipeline_overview#loading-custom-pipelines-from-the-hub).
123
+
Take a look at the following table to compare the two sharing workflows to help you decide the best option for you:
124
+
125
+
|| GitHub community pipeline | HF Hub community pipeline |
| review process | open a Pull Request on GitHub and undergo a review process from the Diffusers team before merging; may be slower | upload directly to a Hub repository without any review; this is the fastest workflow |
129
+
| visibility | included in the official Diffusers repository and documentation | included on your HF Hub profile and relies on your own usage/promotion to gain visibility |
132
130
133
-
**Try it out now - it works!**
131
+
<Tip>
134
132
135
-
In general, you will want to create much more sophisticated pipelines, so we recommend looking at existing pipelines here: [https://github.com/huggingface/diffusers/tree/main/examples/community](https://github.com/huggingface/diffusers/tree/main/examples/community).
133
+
💡 You can use whatever package you want in your community pipeline file - as long as the user has it installed, everything will work fine. Make sure you have one and only one pipeline class that inherits from `DiffusionPipeline` because this is automatically detected.
136
134
137
-
IMPORTANT:
138
-
You can use whatever package you want in your community pipeline file - as long as the user has it installed, everything will work fine. Make sure you have one and only one pipeline class that inherits from `DiffusionPipeline` as this will be automatically detected.
135
+
</Tip>
139
136
140
137
## How do community pipelines work?
141
-
A community pipeline is a class that has to inherit from ['DiffusionPipeline']:
142
-
and that has been added to `examples/community`[files](https://github.com/huggingface/diffusers/tree/main/examples/community).
143
-
The community can load the pipeline code via the custom_pipeline argument from DiffusionPipeline. See docs [here](https://huggingface.co/docs/diffusers/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained.custom_pipeline):
144
138
145
-
This means:
146
-
The model weights and configs of the pipeline should be loaded from the `pretrained_model_name_or_path`[argument](https://huggingface.co/docs/diffusers/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path):
147
-
whereas the code that powers the community pipeline is defined in a file added in [`examples/community`](https://github.com/huggingface/diffusers/tree/main/examples/community).
139
+
A community pipeline is a class that inherits from [`DiffusionPipeline`] which means:
140
+
141
+
- It can be loaded with the [`custom_pipeline`] argument.
142
+
- The model weights and scheduler configuration are loaded from [`pretrained_model_name_or_path`].
143
+
- The code that implements a feature in the community pipeline is defined in a `pipeline.py` file.
144
+
145
+
Sometimes you can't load all the pipeline components weights from an official repository. In this case, the other components should be passed directly to the pipeline:
148
146
149
-
Now, it might very well be that only some of your pipeline components weights can be downloaded from an official repo.
150
-
The other components should then be passed directly to init as is the case for the ClIP guidance notebook [here](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/CLIP_Guided_Stable_diffusion_with_diffusers.ipynb#scrollTo=z9Kglma6hjki).
147
+
```python
148
+
from diffusers import DiffusionPipeline
149
+
from transformers import CLIPFeatureExtractor, CLIPModel
The magic behind all of this is that we load the code directly from GitHub. You can check it out in more detail if you follow the functionality defined here:
167
+
The magic behind community pipelines is contained in the following code. It allows the community pipeline to be loaded from GitHub or the Hub, and it'll be available to all 🧨 Diffusers packages.
153
168
154
169
```python
155
170
# 2. Load the pipeline class, if using custom module then load it from the hub
0 commit comments