Path: blob/main/diffusers_doc/en/push_to_hub.ipynb
5547 views
Sharing pipelines and models
Share your pipeline or models and schedulers on the Hub with the PushToHubMixin class. This class:
creates a repository on the Hub
saves your model, scheduler, or pipeline files so they can be reloaded later
uploads folder containing these files to the Hub
This guide will show you how to upload your files to the Hub with the PushToHubMixin class.
Log in to your Hugging Face account with your access token.
Models
To push a model to the Hub, call push_to_hub() and specify the repository id of the model.
The push_to_hub() method saves the model's config.json
file and the weights are automatically saved as safetensors files.
Load the model again with from_pretrained().
Scheduler
To push a scheduler to the Hub, call push_to_hub() and specify the repository id of the scheduler.
The push_to_hub() function saves the scheduler's scheduler_config.json
file to the specified repository.
Load the scheduler again with from_pretrained().
Pipeline
To push a pipeline to the Hub, initialize the pipeline components with your desired parameters.
Pass all components to the pipeline and call push_to_hub().
The push_to_hub() method saves each component to a subfolder in the repository. Load the pipeline again with from_pretrained().
Privacy
Set private=True
in push_to_hub() to keep a model, scheduler, or pipeline files private.
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 to load a model from a private repository.