Where does the Hugging Face cache live, what is its on-disk layout, and which environment variables move it?
Problem. Weights land in an unexpected disk, fill a small home partition, or cannot be located by a second tool. Conditions. Python huggingface_hub and tools built on it. Method. Default cache is ~/.cache/huggingface/hub; HF_HOME moves the whole data root (token and cache), HF_HUB_CACHE moves only repository downloads (default $HF_HOME/hub); cache_dir= overrides per call; XDG_CACHE_HOME applies only when HF_HOME is unset. Layout per repo: models--<org>--<name>/ with refs/ (branch name to commit hash), blobs/ (files named by hash) and snapshots/<commit>/ (symlinks to blobs). Read files via the snapshots path, never copy from blobs. Failure modes. Setting only HF_HOME after a cache exists leaves the old cache behind; the old HUGGINGFACE_HUB_CACHE name is deprecated for HF_HUB_CACHE. Limitations. Docs show the layout of the hub cache only; ComfyUI model folders are a separate convention. Version/date: huggingface_hub docs main branch fetched 2026-10-24 (stamp per bibliography); behavio...
Structured fields
{
"citations": [
{
"url": "https://huggingface.co/docs/huggingface_hub/main/en/guides/manage-cache.md",
"note": "File-based caching; HF_HOME; HF_HUB_CACHE; Blobs; XDG_CACHE_HOME"
},
{
"url": "https://huggingface.co/docs/huggingface_hub/main/en/package_reference/environment_variables.md",
"note": "File-based caching; HF_HOME; HF_HUB_CACHE; Blobs; XDG_CACHE_HOME"
}
]
}Evidence claims
- [sourced_fact] Problem. Weights land in an unexpected disk, fill a small home partition, or cannot be located by a second tool. Conditions. Python huggingface_hub and tools built on it. Method. Default cache is ~/.cache/huggingface/hub; HF_HOME moves the whole data root (token and cache), HF_HUB_CACHE moves only repository downloads (default $HF_HOME/hub); cache_dir= overrides per call; XDG_CACHE_HOME applies only when HF_HOME is unset. Layout per repo: models--<org>--<name>/ with refs/ (branch name to commit hash), blobs/ (files named by hash) and snapshots/<commit>/ (symlinks to blobs). Read files via the snapshots path, never copy from blobs. Failure modes. Setting only HF_HOME after a cache exists leaves the old cache behind; the old HUGGINGFACE_HUB_CACHE name is deprecated for HF_HUB_CACHE. Limitations. Docs show the layout of the hub cache only; ComfyUI model folders are a separate convention. Version/date: huggingface_hub docs main branch fetched 2026-10-24 (stamp per bibliography); behaviour may differ in older releases. · locator: File-based caching; HF_HOME; HF_HUB_CACHE; Blobs; XDG_CACHE_HOME source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |