HuggingfaceClient.Hub.Repositories.Snapshots (huggingface_client v0.1.0)

Copy Markdown View Source

Snapshot download — mirrors snapshotDownload from @huggingface/hub.

Downloads an entire repository at a specific revision to a local cache directory using the same layout as the Python huggingface_hub library:

~/.cache/huggingface/hub/
  models--gpt2/
    refs/
      main          <- contains the commit SHA
    snapshots/
      abc123def.../
        config.json
        tokenizer.json
        ...

This makes snapshots compatible with tools that use the HuggingFace cache directory convention.

Summary

Functions

Returns the default HF Hub cache directory.

Downloads a full repository. See HuggingfaceClient.snapshot_download/2.

Builds the local folder name for a repo, matching the Python library layout.

Functions

default_cache_dir()

@spec default_cache_dir() :: String.t()

Returns the default HF Hub cache directory.

download(repo, opts)

@spec download(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, Exception.t()}

Downloads a full repository. See HuggingfaceClient.snapshot_download/2.

repo_folder_name(repo_name, type)

@spec repo_folder_name(String.t(), atom()) :: String.t()

Builds the local folder name for a repo, matching the Python library layout.

Examples

"models--gpt2"                             # model
"datasets--rajpurkar--squad"              # dataset
"spaces--gradio--hello_world"             # space