File size: 730 Bytes
5e97736
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# sitecustomize.py — loaded automatically by Python on startup
import os, pathlib

cache = os.environ.get("HF_CACHE_DIR", "/tmp/hf-cache")
pathlib.Path(cache).mkdir(parents=True, exist_ok=True)
pathlib.Path("/tmp/pycache").mkdir(parents=True, exist_ok=True)

# Make ALL libraries use /tmp and never touch "~/.cache" -> "/.cache"
os.environ.setdefault("HOME", "/tmp")
os.environ.setdefault("XDG_CACHE_HOME", cache)
os.environ.setdefault("HF_HOME", cache)
os.environ.setdefault("HUGGINGFACE_HUB_CACHE", cache)
os.environ.setdefault("TRANSFORMERS_CACHE", cache)
os.environ.setdefault("HF_DATASETS_CACHE", f"{cache}/datasets")
os.environ.setdefault("TORCH_HOME", cache)
os.environ.setdefault("PYTHONPYCACHEPREFIX", "/tmp/pycache")