fix(install,studio): address Codex round-4 review (6 of 7 comments real)
- install.sh: gate the new aarch64 bitsandbytes block on SKIP_TORCH=false -- with --no-torch/UNSLOTH_NO_TORCH (GGUF-only install) it would have pulled torch back into the venv through bitsandbytes' dependencies. - studio worker: in the new Spark OOM-guard section, decide PYTORCH_CUDA_ALLOC_CONF (expandable_segments) BEFORE the guard's first CUDA touch -- get_device_properties initializes the CUDA allocator, after which the env var is ignored, and the later `import unsloth` (patch_dgx_spark_memory_config) is too late for the worker process. Uses the same CUDA-free nvidia-smi name sniff, append-don't-override, and UNSLOTH_NO_EXPANDABLE_SEGMENTS opt-out as the library patch. Live-verified on the N1X: env set while torch.cuda.is_initialized() is still False. - uninstall.ps1: only run `fuser -k 8888/tcp` in a probed WSL distro when an Unsloth install actually exists there (checked BEFORE the rm deletes the marker) -- an unrelated listener on 8888 (e.g. Jupyter) in a clean distro must survive a Windows-side uninstall. The Unsloth-specific pkills stay unconditional. - install.ps1 + uninstall.ps1: persist the chosen WSL distro to %LOCALAPPDATA%\Unsloth\wsl-distro.txt at install; uninstall reads it (before removing the directory) and prepends it to the cleanup candidates, so a custom UNSLOTH_WSL_DISTRO install is cleaned without the env var being set again at uninstall time. - provision_llama_cuda.sh: honor UNSLOTH_LLAMA_PR (numeric-validated, best-effort fetch of pull/N/head after clone) so a provisioned tree matches a PR pin the way setup.sh does; and require only llama-server in the main cmake build (mirroring setup.sh), building the helper targets (llama-cli/quantize/mtmd-cli/gguf-split) best-effort afterwards -- an older UNSLOTH_LLAMA_TAG pin lacking a newer helper target no longer fails the whole provision. Not changed: the "--tauri rejection doesn't restore the venv rollback" comment is incorrect -- the rejection returns through Exit-InstallFailure, which itself calls Restore-StudioVenvRollback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ca8c1b434d
commit
c31a6e876d
5 changed files with 79 additions and 4 deletions
|
|
@ -344,6 +344,19 @@ function Uninstall-UnslothStudio {
|
|||
# %LOCALAPPDATA%\Unsloth (not "Unsloth Studio") with a PATH entry -- all missed by the cleanup above.
|
||||
_Step "Removing WSL-fallback artifacts (shim, launcher, PATH entry, WSL install)..."
|
||||
$unslothDir = if ($env:LOCALAPPDATA) { Join-Path $env:LOCALAPPDATA "Unsloth" } else { $null }
|
||||
# The installer records its WSL distro in wsl-distro.txt so a custom
|
||||
# UNSLOTH_WSL_DISTRO install is cleanable without the env var being set again
|
||||
# at uninstall time. Read it BEFORE the directory is removed below.
|
||||
$_recordedDistro = $null
|
||||
if ($unslothDir) {
|
||||
try {
|
||||
$_distroFile = Join-Path $unslothDir "wsl-distro.txt"
|
||||
if (Test-Path -LiteralPath $_distroFile) {
|
||||
$_recordedDistro = (Get-Content -LiteralPath $_distroFile -ErrorAction SilentlyContinue | Select-Object -First 1)
|
||||
if ($_recordedDistro) { $_recordedDistro = $_recordedDistro.Trim() }
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
if ($unslothDir) {
|
||||
$shimDir = (Join-Path $unslothDir "bin").TrimEnd('\', '/')
|
||||
try {
|
||||
|
|
@ -379,8 +392,13 @@ function Uninstall-UnslothStudio {
|
|||
# touching /home/*/.unsloth would erase an unrelated WSL user's own Unsloth/cache that this
|
||||
# installer never created. pkill patterns use the [x]-regex self-exclusion trick: '[u]nsloth_studio'
|
||||
# keeps the shell's own argv from matching while real processes still match. Same for '[l]lama-server'.
|
||||
$_clean = 'rm -rf /root/.unsloth /root/llama-cuda /root/provision_llama_cuda.sh /root/llama_cuda_build.log 2>/dev/null; rm -f /root/.local/bin/unsloth 2>/dev/null; fuser -k 8888/tcp 2>/dev/null; pkill -9 -f ''[u]nsloth_studio'' 2>/dev/null; pkill -9 -f ''[l]lama-server'' 2>/dev/null; true'
|
||||
# The port-8888 kill is gated on an Unsloth install actually existing in the
|
||||
# distro (checked BEFORE the rm deletes the marker): a probed distro with an
|
||||
# unrelated listener on 8888 (Jupyter etc.) must not lose it. The pkills are
|
||||
# already Unsloth-specific, so they stay unconditional.
|
||||
$_clean = '_had=0; if [ -d /root/.unsloth ] || [ -L /root/.local/bin/unsloth ]; then _had=1; fi; rm -rf /root/.unsloth /root/llama-cuda /root/provision_llama_cuda.sh /root/llama_cuda_build.log 2>/dev/null; rm -f /root/.local/bin/unsloth 2>/dev/null; if [ $_had -eq 1 ]; then fuser -k 8888/tcp 2>/dev/null; fi; pkill -9 -f ''[u]nsloth_studio'' 2>/dev/null; pkill -9 -f ''[l]lama-server'' 2>/dev/null; true'
|
||||
$_cands = @('', 'Ubuntu', 'Ubuntu-24.04', 'Ubuntu-22.04', 'Debian')
|
||||
if ($_recordedDistro) { $_cands = @($_recordedDistro) + $_cands }
|
||||
if ($env:UNSLOTH_WSL_DISTRO) { $_cands = @($env:UNSLOTH_WSL_DISTRO) + $_cands }
|
||||
$_done = @{}
|
||||
foreach ($d in $_cands) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue