Hugging Face "No space left on device" filling the HF cache in CI
A model or dataset download exhausted the runner disk, so the write to the HF cache fails with No space left on device. Model weights are large; a small root volume fills fast when several are pulled.
What this error means
A download aborts with "OSError: [Errno 28] No space left on device" while writing into the huggingface cache directory.
OSError: [Errno 28] No space left on device:
'/root/.cache/huggingface/hub/models--org--big-model/blobs/...tmp'Common causes
Large weights exceed the runner disk
Multi-gigabyte checkpoints, several at once, fill the default root volume of a standard runner.
An accumulating cache never pruned
A cache restored and grown across runs keeps stale model blobs that eat disk.
How to fix it
Point HF_HOME at a larger volume and free space
- Set
HF_HOMEto a mount with more free space. - Remove unused tool caches at the start of the job to reclaim disk.
- Download only the models the job needs.
env:
HF_HOME: /mnt/large/hf-cachePrune the HF cache
Delete stale revisions so the cache does not grow without bound.
pip install "huggingface_hub[cli]"
huggingface-cli delete-cacheHow to prevent it
- Store the HF cache on a volume sized for your models.
- Prune old revisions with
delete-cacheregularly. - Download only required models and datasets in CI.