🌍 Diffusers provides a 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 PushToHubMixin:
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 use the PushToHubMixin to upload your files to the Hub.
You’ll need to log in to your Hub account with your access token first:
Copied
from boincai_hub import notebook_login
notebook_login()
Models
To push a model to the Hub, call push_to_hub() and specfiy the repository id of the model to be stored on the Hub:
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:
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 - Repo not found error.
To load a model, scheduler, or pipeline from a private or gated repositories, set use_auth_token=True:
Copied
model = ControlNet.from_pretrained("your-namespace/my-controlnet-model", use_auth_token=True)