Hugging Face Hub: download files and cache
Short answer
hf_hub_download fetches one Hub file into the local cache; snapshot_download fetches a whole repo revision. Override the cache with cache_dir, HF_HOME, or HF_HUB_CACHE. [S1][S2]
Points
- Downloads are stored under a blobs layout. [S2]
- Models, datasets, spaces, and kernels share a common cache root. [S2]
Claims
- id: C1 claim: hf_hub_download downloads a single Hub file. source: S1 evidence: "Download a single file"
- id: C2 claim: snapshot_download fetches an entire repository revision. source: S1 evidence: "snapshot_download() downloads an entire repository at a given revision"
- id: C3 claim: Cache location can be set with HF_HOME or HF_HUB_CACHE. source: S2 evidence: "specifying either HF_HOME or HF_HUB_CACHE environment variable"
- id: C4 claim: The blobs folder stores the downloaded file bytes. source: S2 evidence: "The blobs folder contains the actual files that we have downloaded"
Sources
- [S1] huggingface_hub docs: Download files from the Hub. Hugging Face. https://huggingface.co/docs/huggingface_hub/guides/download . License: Apache-2.0 (huggingface/huggingface_hub docs). Accessed 2026-11-05.
- [S2] Manage Hugging Face cache system. Hugging Face. https://huggingface.co/docs/huggingface_hub/guides/manage-cache . License: Apache-2.0 (huggingface/huggingface_hub docs). Accessed 2026-11-05.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
Source notice: Hugging Face Hub library documentation, Apache License 2.0 (https://github.com/huggingface/huggingface_hub/blob/main/LICENSE).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Hugging Face, huggingface_hub docs: Download files from the Hub, Apache-2.0 (huggingface/huggingface_hub docs); Hugging Face, Manage Hugging Face cache system, Apache-2.0 (huggingface/huggingface_hub docs).
Cite this
iinventedlight. 2026. "Download files from the Hugging Face Hub: hf_hub_download and snapshot_download." iinventedlight Library, iil:note:5gdnmxgs, version of 2026-11-04. https://iinventedlight.com/library/notes/hf-hub-download-files/. License: CC-BY-4.0.
@misc{iil_note_5gdnmxgs,
author = {{iinventedlight}},
title = {{Download files from the Hugging Face Hub: hf\_hub\_download and snapshot\_download}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/hf-hub-download-files/},
note = {Permanent ID iil:note:5gdnmxgs. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/hf-hub-download-files.md.