Repository management operations for HuggingFace Hub.
Provides create, delete, update, and move operations for repositories (models, datasets, and spaces).
Examples
# Create a new model repository
{:ok, url} = HfHub.Repo.create("my-org/my-model", private: true)
# Create a space with Gradio
{:ok, url} = HfHub.Repo.create("my-space",
repo_type: :space,
space_sdk: "gradio"
)
# Delete a repository
:ok = HfHub.Repo.delete("my-org/old-model")
# Update settings
:ok = HfHub.Repo.update_settings("my-model", private: true, gated: :auto)
# Move/rename a repository
{:ok, url} = HfHub.Repo.move("old-name", "new-org/new-name")
Summary
Functions
Creates a new repository on the Hugging Face Hub.
Deletes a repository.
Checks if a repository exists.
Checks if a file exists in a repository.
Moves (renames) a repository.
Checks if a revision exists.
Updates repository settings.
Types
Functions
@spec create( String.t(), keyword() ) :: {:ok, HfHub.Repo.RepoUrl.t()} | {:error, term()}
Creates a new repository on the Hugging Face Hub.
Options
:token- Authentication token:repo_type- Type of repository (:model, :dataset, :space). Defaults to :model.:private- Whether the repository should be private. Defaults to false.:exist_ok- If true, do not error if repo already exists. Defaults to false.:space_sdk- SDK to use for spaces ("gradio", "streamlit", "docker", "static").:space_hardware- Hardware to use for spaces.
Examples
{:ok, url} = HfHub.Repo.create("my-model")
{:ok, url} = HfHub.Repo.create("my-dataset", repo_type: :dataset)
Deletes a repository.
Options
:token- Authentication token:repo_type- Type of repository. Defaults to :model.:missing_ok- If true, do not error if repo does not exist. Defaults to false.
Checks if a repository exists.
Using HEAD request to check existence. For models: /repo_id For datasets: /datasets/repo_id For spaces: /spaces/repo_id
Checks if a file exists in a repository.
@spec move(String.t(), String.t(), keyword()) :: {:ok, HfHub.Repo.RepoUrl.t()} | {:error, term()}
Moves (renames) a repository.
Options
:token- Authentication token:repo_type- Type of repository. Defaults to :model.
Checks if a revision exists.
Uses the repo info endpoint to check for valid revision. This is effectively checking if we can get info about a specific revision.
Updates repository settings.
Options
:token- Authentication token:repo_type- Type of repository. Defaults to :model.:private- Set visibility:gated- Set gated status (:auto, :manual, false)