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
Copy file name to clipboardExpand all lines: docs/source/en/using-diffusers/push_to_hub.md
+28-21Lines changed: 28 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,29 +10,42 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
10
10
specific language governing permissions and limitations under the License.
11
11
-->
12
12
13
-
# Push files to the Hub
14
-
15
13
[[open-in-colab]]
16
14
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:
18
18
19
19
1. creates a repository on the Hub
20
20
2. saves your model, scheduler, or pipeline files so they can be reloaded later
21
21
3. uploads folder containing these files to the Hub
22
22
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).
24
26
25
-
You'll need to log in to your Hub account with your access [token](https://huggingface.co/settings/tokens) first:
27
+
<hfoptionsid="login">
28
+
<hfoptionid="notebook">
26
29
27
30
```py
28
31
from huggingface_hub import notebook_login
29
32
30
33
notebook_login()
31
34
```
32
35
36
+
</hfoption>
37
+
<hfoptionid="hf CLI">
38
+
39
+
```bash
40
+
hf auth login
41
+
```
42
+
43
+
</hfoption>
44
+
</hfoptions>
45
+
33
46
## Models
34
47
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.
36
49
37
50
```py
38
51
from diffusers import ControlNetModel
@@ -48,23 +61,17 @@ controlnet = ControlNetModel(
48
61
controlnet.push_to_hub("my-controlnet-model")
49
62
```
50
63
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:
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.
58
65
59
-
Now you can reload the model from your repository on the Hub:
66
+
Load the model again with [`~DiffusionPipeline.from_pretrained`].
60
67
61
68
```py
62
69
model = ControlNetModel.from_pretrained("your-namespace/my-controlnet-model")
63
70
```
64
71
65
72
## Scheduler
66
73
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.
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.
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`].
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`].
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