HubCloneHubClone
Hub / Uploading Models

Join the HubClone community

and get access to the augmented documentation experience

  • Collaborate on models, datasets and Spaces
  • Faster examples with accelerated inference
  • Switch between documentation themes

to get started

Uploading models

To share a model you first create a model repository, then add its files. You can do this from the browser, from Python, from the CLI or with plain Git.

Using the web interface

Create a repository from the New → Model menu, then use Add file → Upload files on the Files and versions tab. This is fine for small checkpoints and README edits.

Using the client library

The Python client uploads folders in parallel, retries failed parts and works well for multi-gigabyte checkpoints.

from huggingface_hub import HfApi

api = HfApi()
api.create_repo("your-username/my-model", exist_ok=True)
api.upload_folder(
    folder_path="./checkpoint",
    repo_id="your-username/my-model",
    commit_message="Upload checkpoint",
)

Supported formats

FormatRecommended for
SafetensorsDefault choice: fast to load and cannot run code on load
GGUFQuantized models for local runtimes
ONNXCross-framework inference engines
PyTorch pickleLegacy checkpoints only (scanned for unsafe code)

Upload from a library

Many libraries can push directly to the Hub with a push_to_hub method. They also write a basic model card and the metadata the Hub needs to show the right widget.

Tip:

Safetensors is preferred for security and performance; the Hub shows a dedicated parameter count for it.