Move $_NoTorch initialization before stale-venv detection in setup.ps1
$_NoTorch was defined at line 1672 but read at lines 1521/1533 in the stale-venv detection block. In PowerShell, reading an undefined variable returns $null, and -not $null evaluates to $true, so the $_NoTorch guards added in the previous commit were silently no-ops. Fix: move the $env:UNSLOTH_NO_TORCH check to before the stale-venv block so --no-torch mode is correctly respected in the torch tag comparison and ROCm repair decision.
This commit is contained in:
parent
f542c231dc
commit
e00eeffe2c
1 changed files with 7 additions and 4 deletions
|
|
@ -1510,6 +1510,11 @@ if (Test-Path $VenvDir -PathType Container) {
|
|||
$shouldRebuild = $true
|
||||
}
|
||||
|
||||
# --no-torch: skip ROCm torch repair and wheel install entirely.
|
||||
# Must be defined here (before stale-venv detection) because the
|
||||
# expectedTorchTag and $_NeedRocmRepair logic below depend on it.
|
||||
$_NoTorch = $env:UNSLOTH_NO_TORCH -in @("1", "true", "True", "TRUE")
|
||||
|
||||
# $_NeedRocmRepair is used later to override the version fast-path
|
||||
# ($SkipPythonDeps) so the ROCm install block still runs even when
|
||||
# the unsloth package is already at the latest version.
|
||||
|
|
@ -1666,10 +1671,8 @@ $env:TORCHINDUCTOR_CACHE_DIR = $TorchCacheDir
|
|||
[Environment]::SetEnvironmentVariable('TORCHINDUCTOR_CACHE_DIR', $TorchCacheDir, 'User')
|
||||
substep "TORCHINDUCTOR_CACHE_DIR set to $TorchCacheDir (avoids MAX_PATH issues)"
|
||||
|
||||
# --no-torch mode: skip the ROCm wheel path entirely. AMD users running
|
||||
# install.ps1 --no-torch get a Python 3.13 venv (fine for GGUF); entering
|
||||
# the ROCm block would hard-fail on the 3.12 version check for no reason.
|
||||
$_NoTorch = $env:UNSLOTH_NO_TORCH -in @("1", "true", "True", "TRUE")
|
||||
# $_NoTorch was already initialized earlier (before stale-venv detection)
|
||||
# so it is available here for the $CuTag selection.
|
||||
|
||||
if ($HasNvidiaSmi) {
|
||||
$CuTag = Get-PytorchCudaTag
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue