gausubash's picture
Enable ZeroGPU for Chronos forecasts
8396be4 verified
Raw
History Blame Contribute Delete
749 Bytes
from __future__ import annotations
import os
from pathlib import Path
def configure_runtime() -> None:
"""Use writable paths on Hugging Face Spaces (default cache is often not writable)."""
cache_root = Path(os.environ.get("HF_HOME", "/tmp/huggingface"))
cache_root.mkdir(parents=True, exist_ok=True)
(cache_root / "hub").mkdir(parents=True, exist_ok=True)
(cache_root / "xet").mkdir(parents=True, exist_ok=True)
os.environ["HF_HOME"] = str(cache_root)
os.environ["HUGGINGFACE_HUB_CACHE"] = str(cache_root / "hub")
os.environ["HF_HUB_DISABLE_XET"] = "1"
os.environ["HF_HUB_DISABLE_SYMLINKS_WARNING"] = "1"
os.environ["GRADIO_TEMP_DIR"] = os.environ.get("GRADIO_TEMP_DIR", "/tmp/gradio")