Use the Hugging Face CLI to inspect cached repositories and preview a deletion before applying it. The cache may contain multiple revisions and shared file data, so manually deleting random blob files is a poor way to recover storage.
This is useful after experimenting with local models, embeddings, or datasets. First stop the jobs using the cache and record any exact revisions required by ongoing work.
Check your installed command support
hf cache --help
hf cache ls
hf cache ls --revisions
These commands reflect the current Hugging Face cache-management documentation. Older releases can expose different commands; use the help for your installed version rather than substituting a filesystem deletion when syntax fails.
Find the repository and revision responsible for the space. A model you no longer use and an older revision needed to reproduce a result are different candidates, even when they belong to the same repository.
Preview one explicit removal
This example previews removal of a cached repository. Use an identifier from your own inventory and read the proposed deletion:
hf cache rm model/bert-base-cased --dry-run
If that is the repository you intend to remove, rerun without the dry-run flag and review the confirmation:
hf cache rm model/bert-base-cased
Do not skip confirmation while learning how your cache is organized. Record the repository and revision details first, so you have more than a vague model name if you need to restore the experiment.
Understand shared data before estimating savings
The cache manager understands references between revisions and stored blobs. The number displayed next to a model directory is therefore not always the amount an individual removal can free. Use the removal preview and then measure the actual disk result.
A useful cleanup log includes the selected repository, the preview’s estimate, and the measured space afterward. If they differ, investigate the remaining cache rather than repeatedly deleting more files to reach an arbitrary target.
Preview broader pruning separately
hf cache prune --dry-run
Review the entries proposed by your installed version before running an actual prune. An unreferenced revision can still matter to your own reproducibility plan, so a tool’s cleanup classification is not a substitute for knowing what your project needs.
If a preview is unexpectedly empty, check whether the tool is inspecting the cache your application actually uses. Environments and custom cache-directory settings can point different processes at different locations. Use the documented cache-directory option for your version once you have identified the intended path.
Protect experiments and custom work
Keep fine-tuning outputs, custom adapters, evaluation results, and project configuration outside a casual cache-removal decision. A downloaded model may be replaceable; your uncommitted experimental work may not be. Test recovery of important artifacts before retiring their only accessible copy.
Also consider network constraints. Re-downloading a large model on a slow or metered connection can outweigh the benefit of a short-lived cleanup. Keep a compact set for offline work and remove completed experiments intentionally.
If the cache is small, inspect LM Studio downloads and Ollama models separately. Similar model names across applications do not mean they share one removable directory.