Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6a8b3c9

Browse files
Merge branch 'main' into allow-non-list-component
2 parents 9d86c3b + c2e5ece commit 6a8b3c9

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

‎docs/source/en/_toctree.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- local: using-diffusers/other-formats
3030
title: Model files and layouts
3131
- local: using-diffusers/push_to_hub
32-
title: Push files to the Hub
32+
title: Sharing pipelines and models
3333

3434
- title: Adapters
3535
isExpanded: false

‎docs/source/en/using-diffusers/push_to_hub.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,42 @@ 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-
# Push files to the Hub
14-
1513
[[open-in-colab]]
1614

17-
🤗 Diffusers provides a [`~diffusers.utils.PushToHubMixin`] for uploading your model, scheduler, or pipeline to the Hub. It is an easy way to store your files on the Hub, and also allows you to share your work with others. Under the hood, the [`~diffusers.utils.PushToHubMixin`]:
15+
# Sharing pipelines and models
16+
17+
Share your pipeline or models and schedulers on the Hub with the [`~diffusers.utils.PushToHubMixin`] class. This class:
1818

1919
1. creates a repository on the Hub
2020
2. saves your model, scheduler, or pipeline files so they can be reloaded later
2121
3. uploads folder containing these files to the Hub
2222

23-
This guide will show you how to use the [`~diffusers.utils.PushToHubMixin`] to upload your files to the Hub.
23+
This guide will show you how to upload your files to the Hub with the [`~diffusers.utils.PushToHubMixin`] class.
24+
25+
Log in to your Hugging Face account with your access [token](https://huggingface.co/settings/tokens).
2426

25-
You'll need to log in to your Hub account with your access [token](https://huggingface.co/settings/tokens) first:
27+
<hfoptions id="login">
28+
<hfoption id="notebook">
2629

2730
```py
2831
from huggingface_hub import notebook_login
2932

3033
notebook_login()
3134
```
3235

36+
</hfoption>
37+
<hfoption id="hf CLI">
38+
39+
```bash
40+
hf auth login
41+
```
42+
43+
</hfoption>
44+
</hfoptions>
45+
3346
## Models
3447

35-
To push a model to the Hub, call [`~diffusers.utils.PushToHubMixin.push_to_hub`] and specify the repository id of the model to be stored on the Hub:
48+
To push a model to the Hub, call [`~diffusers.utils.PushToHubMixin.push_to_hub`] and specify the repository id of the model.
3649

3750
```py
3851
from diffusers import ControlNetModel
@@ -48,23 +61,17 @@ controlnet = ControlNetModel(
4861
controlnet.push_to_hub("my-controlnet-model")
4962
```
5063

51-
For models, you can also specify the [*variant*](loading#checkpoint-variants) of the weights to push to the Hub. For example, to push `fp16` weights:
52-
53-
```py
54-
controlnet.push_to_hub("my-controlnet-model", variant="fp16")
55-
```
56-
57-
The [`~diffusers.utils.PushToHubMixin.push_to_hub`] function saves the model's `config.json` file and the weights are automatically saved in the `safetensors` format.
64+
The [`~diffusers.utils.PushToHubMixin.push_to_hub`] method saves the model's `config.json` file and the weights are automatically saved as safetensors files.
5865

59-
Now you can reload the model from your repository on the Hub:
66+
Load the model again with [`~DiffusionPipeline.from_pretrained`].
6067

6168
```py
6269
model = ControlNetModel.from_pretrained("your-namespace/my-controlnet-model")
6370
```
6471

6572
## Scheduler
6673

67-
To push a scheduler to the Hub, call [`~diffusers.utils.PushToHubMixin.push_to_hub`] and specify the repository id of the scheduler to be stored on the Hub:
74+
To push a scheduler to the Hub, call [`~diffusers.utils.PushToHubMixin.push_to_hub`] and specify the repository id of the scheduler.
6875

6976
```py
7077
from diffusers import DDIMScheduler
@@ -81,15 +88,15 @@ scheduler.push_to_hub("my-controlnet-scheduler")
8188

8289
The [`~diffusers.utils.PushToHubMixin.push_to_hub`] function saves the scheduler's `scheduler_config.json` file to the specified repository.
8390

84-
Now you can reload the scheduler from your repository on the Hub:
91+
Load the scheduler again with [`~SchedulerMixin.from_pretrained`].
8592

8693
```py
8794
scheduler = DDIMScheduler.from_pretrained("your-namepsace/my-controlnet-scheduler")
8895
```
8996

9097
## Pipeline
9198

92-
You can also push an entire pipeline with all it's components to the Hub. For example, initialize the components of a [`StableDiffusionPipeline`]with the parameters you want:
99+
To push a pipeline to the Hub, initialize the pipeline components with your desired parameters.
93100

94101
```py
95102
from diffusers import (
@@ -143,7 +150,7 @@ text_encoder = CLIPTextModel(text_encoder_config)
143150
tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
144151
```
145152

146-
Pass all of the components to the [`StableDiffusionPipeline`] and call [`~diffusers.utils.PushToHubMixin.push_to_hub`] to push the pipeline to the Hub:
153+
Pass all components to the pipeline and call [`~diffusers.utils.PushToHubMixin.push_to_hub`].
147154

148155
```py
149156
components = {
@@ -160,18 +167,18 @@ pipeline = StableDiffusionPipeline(**components)
160167
pipeline.push_to_hub("my-pipeline")
161168
```
162169

163-
The [`~diffusers.utils.PushToHubMixin.push_to_hub`] function saves each component to a subfolder in the repository. Now you can reload the pipeline from your repository on the Hub:
170+
The [`~diffusers.utils.PushToHubMixin.push_to_hub`] method saves each component to a subfolder in the repository. Load the pipeline again with [`~DiffusionPipeline.from_pretrained`].
164171

165172
```py
166173
pipeline = StableDiffusionPipeline.from_pretrained("your-namespace/my-pipeline")
167174
```
168175

169176
## Privacy
170177

171-
Set `private=True` in the [`~diffusers.utils.PushToHubMixin.push_to_hub`] function to keep your model, scheduler, or pipeline files private:
178+
Set `private=True` in [`~diffusers.utils.PushToHubMixin.push_to_hub`] to keep a model, scheduler, or pipeline files private.
172179

173180
```py
174181
controlnet.push_to_hub("my-controlnet-model-private", private=True)
175182
```
176183

177-
Private repositories are only visible to you, and other users won't be able to clone the repository and your repository won't appear in search results. Even if a user has the URL to your private repository, they'll receive a `404 - Sorry, we can't find the page you are looking for`. You must be [logged in](https://huggingface.co/docs/huggingface_hub/quick-start#login) to load a model from a private repository.
184+
Private repositories are only visible to you. Other users won't be able to clone the repository and it won't appear in search results. Even if a user has the URL to your private repository, they'll receive a `404 - Sorry, we can't find the page you are looking for`. You must be [logged in](https://huggingface.co/docs/huggingface_hub/quick-start#login) to load a model from a private repository.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /