When you run a Hugging Face model directly with llama-cli, for example:
|
|
the download is handled by llama.cpp. Current releases place -hf downloads in the standard Hugging Face Hub cache.
Default cache locations
For the current Hub download path, HF_HUB_CACHE has priority. If it is unset, the path is $HF_HOME/hub; otherwise it is derived from XDG_CACHE_HOME, and finally from the user’s default cache directory. LLAMA_CACHE, often mentioned in older guides, is a llama.cpp-specific or legacy setting and should not be presented as the highest-priority variable for the current standard -hf Hub cache.
| System | Default cache directory |
|---|---|
| Linux | ~/.cache/huggingface/hub |
| macOS | ~/.cache/huggingface/hub |
| Windows | %USERPROFILE%\.cache\huggingface\hub |
On Windows, %USERPROFILE% normally points to:
|
|
so the default cache is approximately:
|
|
Check the path the process will actually use
Linux and macOS:
|
|
Windows PowerShell:
|
|
Variables set by systemd, a container, or an IDE may not appear in your current terminal. Check the service, Compose file, or launch script as well, and confirm the path from the actual llama-cli download log and files on disk.
Change the cache directory
Use HF_HUB_CACHE when you only want to move Hub model files. Use HF_HOME when you want to move Hugging Face tokens, assets, and the Hub cache together.
Windows Command Prompt:
|
|
Windows PowerShell:
|
|
|
|
Migrate the cache safely
Stop every downloader, llama-cli process, and service using the cache. Copy first, verify, switch the variable, and only then deal with the old directory:
|
|
After the byte totals are close and a minimal inference succeeds from the new path, persist HF_HUB_CACHE in the shell, service, or container configuration. Keep the old directory until another normal startup succeeds. For shared caches, restrict write access so another user cannot replace model files.
Summary
- Current
llama-cli -hfdownloads use the standard Hugging Face Hub cache. - Linux/macOS default:
~/.cache/huggingface/hub. - Windows default:
%USERPROFILE%\.cache\huggingface\hub. - Use
HF_HUB_CACHEfor the model cache orHF_HOMEfor all Hugging Face data. - Migrate by stopping, copying, checking, switching, testing, and only then archiving the old directory.
References: