Bottom Line: It is 100% safe to delete ~/.cache/huggingface or clear specific model checkpoints. Doing so will not corrupt your Python code; Hugging Face will simply re-download models on demand when you run your scripts.
What is the Hugging Face Cache Folder?
Located at ~/.cache/huggingface on Linux/macOS or %USERPROFILE%\.cache\huggingface on Windows, this folder is created automatically by the Hugging Face transformers, diffusers, and datasets Python libraries.
When you load an AI model (like Llama, Stable Diffusion, Whisper, or BERT) in Python, Hugging Face downloads the model weights, tokenizer files, and datasets into this cache directory. Because modern Large Language Models (LLMs) and diffusion models range from 2 GB to 20 GB+ per model, running a few AI experiments can quickly fill your drive with 50 GB to 100 GB+ of cached weights.
Can You Delete ~/.cache/huggingface?
✅ Yes, it is completely safe to delete.
- No code risk: Your Python scripts, project files, and training scripts remain 100% safe.
- Auto-redownload: The next time you run
from_pretrained("model-name"), Hugging Face will automatically download the required model weights again.
How to Safely Clean Up Hugging Face Cache
Method 1: Using the Official Hugging Face CLI Tool (Recommended)
Hugging Face includes a built-in CLI utility to inspect and selectively delete cached models:
- Install/update the
huggingface_hubpackage:pip install -U huggingface_hub - Launch the interactive cache manager:
huggingface-cli delete-cache - Use the arrow keys and spacebar to select old, unused model weights to delete, then press Enter.
Method 2: Manual Cache Deletion
To wipe the entire cache and reclaim all space instantly:
# macOS / Linux
rm -rf ~/.cache/huggingface
# Windows (Command Prompt)
rmdir /s /q %USERPROFILE%\.cache\huggingface
# Windows (PowerShell)
Remove-Item -Recurse -Force $env:USERPROFILE\.cache\huggingface
Related Guides
- Learn about deleting Python pycache folders.
- How to safely clear pip cache.
- Check if you can delete Python venv folders.
Discussion
Loading authentication...