$ErrorActionPreference = "Stop" $root = Split-Path -Parent $PSScriptRoot $repoRoot = Split-Path -Parent (Split-Path -Parent $root) $env:UV_CACHE_DIR = Join-Path $repoRoot ".cache\uv" Remove-Item Env:\HF_HOME -ErrorAction SilentlyContinue $env:HF_HUB_CACHE = Join-Path $root "hf_cache" $env:HUGGINGFACE_HUB_CACHE = $env:HF_HUB_CACHE $env:HF_XET_CACHE = Join-Path $root "hf_cache\xet" $env:HF_ASSETS_CACHE = Join-Path $root "hf_cache\assets" $env:HF_MODULES_CACHE = Join-Path $root "hf_cache\modules" $env:HF_DATASETS_CACHE = Join-Path $root "hf_cache\datasets" $env:TORCH_HOME = Join-Path $root "torch_cache" $env:TORCHINDUCTOR_CACHE_DIR = Join-Path $root "torch_cache" $env:TRITON_CACHE_DIR = Join-Path $root "triton_cache" $env:TMP = Join-Path $root "tmp" $env:TEMP = Join-Path $root "tmp" $env:PYTHONUTF8 = "1" $env:PYTHONIOENCODING = "utf-8" $env:PYTHONUNBUFFERED = "1" foreach ($d in @($env:HF_HUB_CACHE, $env:HF_XET_CACHE, $env:TORCH_HOME, $env:TMP)) { if (-not (Test-Path $d)) { New-Item -ItemType Directory -Force -Path $d | Out-Null } }