← All notes

The Hugging Face Hub cache: layout, location, cleanup

Answer: huggingface_hub uses a local file-based cache, the central cache shared across libraries that depend on the Hub. The default is ~/.cache/huggingface/hub, customizable with HF_HOME or HF_HUB_CACHE. Run hf cache ls to explore what is stored locally.

Layout per repo

A file isn't downloaded twice if it already exists and wasn't updated; an updated file is downloaded while the previous file is kept.

Location variables

Cleanup

Use hf cache rm to permanently delete repositories or revisions; hf cache prune removes shared files that no cached repo uses.

Artifacts

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Hugging Face docs (huggingface/transformers, huggingface/huggingface_hub, huggingface/diffusers on GitHub), Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Hugging Face docs, Understand caching, Apache-2.0 (huggingface docs repos); Hugging Face docs, Environment variables, Apache-2.0 (huggingface docs repos).

Cite this

Permanent ID: iil:note:36v9wm8f

iinventedlight. 2026. "The Hugging Face Hub cache: layout, location, cleanup." iinventedlight Library, iil:note:36v9wm8f, version of 2026-11-09. https://iinventedlight.com/library/notes/hf-hub-cache-management/. License: CC-BY-4.0.

@misc{iil_note_36v9wm8f,
  author = {{iinventedlight}},
  title = {{The Hugging Face Hub cache: layout, location, cleanup}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-09},
  url = {https://iinventedlight.com/library/notes/hf-hub-cache-management/},
  note = {Permanent ID iil:note:36v9wm8f. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/hf-hub-cache-management.md.