If you have ever run a HuggingFace model download on RunPod and come back to find your cache gone, this is why.The defau...

If you have ever run a HuggingFace model download on RunPod and come back to find your cache gone, this is why.The default is wrong for rented GPU podsHuggingFace sets HF_HOME to ~/.cache/huggingface when no environment variable overrides it. On a standard Linux machine that is fine your home directory persists.On RunPod, your home directory is on the container volume, which is ephemeral. When the pod stops, it is gone.RunPod has two storage layers: the container volume, which is ephemeral, and the network volume mounted at /workspace, which persists across pod restarts. HF_HOME defaults to the wrong one.This means every model download, every tokeniser, every dataset you pulled via datasets.load_dataset() gone on pod restart. You pay to download them again on the next run.On large models that is not a minor inconvenience. A 7B model download at pod startup adds minutes and real cost every single time.The fix is one line in your startup script:export HF_HOME=/workspace/.cache/huggingfac...

Read Original

Related