File size: 1,063 Bytes
d4101a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$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
    }
}