install.ps1/uninstall.ps1: add UNSLOTH_INSTALL_REF + fix WSL symlink uninstall hole
install.ps1: fetch repo-versioned WSL-fallback assets (provision_llama_cuda.sh, unsloth.ico) from a configurable git ref via new UNSLOTH_INSTALL_REF env var (defaults to main, so existing users are byte-for-byte unaffected). Lets the ARM64+NVIDIA WSL-fallback GPU path be exercised end-to-end on a branch before it merges (provision_llama_cuda.sh does not exist on main until then). uninstall.ps1: the WSL cleanup rm -rf'd /root/.unsloth but left the ~/.local/bin/unsloth launcher symlink dangling, so `unsloth` still resolved on PATH after an uninstall. Also remove /root/.local/bin/unsloth and /home/*/.local/bin/unsloth. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
cc31b87850
commit
f102eccaa4
2 changed files with 20 additions and 4 deletions
18
install.ps1
18
install.ps1
|
|
@ -8,6 +8,9 @@
|
|||
# UNSLOTH_STUDIO_HOME / STUDIO_HOME = path -> install under that path
|
||||
# (DataDir nests inside; user PATH not modified persistently).
|
||||
# Default ($USERPROFILE\.unsloth\studio) is preserved when no env var is set.
|
||||
# UNSLOTH_INSTALL_REF = branch/tag/sha to fetch repo-versioned install assets
|
||||
# from (provision_llama_cuda.sh, the .ico); defaults to 'main'. Lets the
|
||||
# WSL-fallback GPU path be tested on a branch before it merges.
|
||||
|
||||
function Install-UnslothStudio {
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
|
@ -42,6 +45,15 @@ function Install-UnslothStudio {
|
|||
}
|
||||
}
|
||||
|
||||
# Git ref (branch/tag/sha) used to fetch repo-versioned install assets from
|
||||
# raw.githubusercontent.com: provision_llama_cuda.sh and the .ico. Defaults to
|
||||
# 'main' so existing users are byte-for-byte unaffected; set UNSLOTH_INSTALL_REF
|
||||
# to a branch to exercise the WSL-fallback path end-to-end before a PR merges.
|
||||
function Get-UnslothInstallRef {
|
||||
if ($env:UNSLOTH_INSTALL_REF -and $env:UNSLOTH_INSTALL_REF.Trim()) { return $env:UNSLOTH_INSTALL_REF.Trim() }
|
||||
return 'main'
|
||||
}
|
||||
|
||||
function Get-TauriTorchIndexFamily {
|
||||
param([string]$TorchIndexUrl)
|
||||
if ($SkipTorch) { return "none" }
|
||||
|
|
@ -519,7 +531,7 @@ function Install-UnslothStudio {
|
|||
if ($PSScriptRoot -and $PSScriptRoot.Trim()) {
|
||||
$bundledIcon = Join-Path $PSScriptRoot "studio\frontend\public\unsloth.ico"
|
||||
}
|
||||
$iconUrl = "https://raw.githubusercontent.com/unslothai/unsloth/main/studio/frontend/public/unsloth.ico"
|
||||
$iconUrl = "https://raw.githubusercontent.com/unslothai/unsloth/$(Get-UnslothInstallRef)/studio/frontend/public/unsloth.ico"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $appDir)) {
|
||||
[System.IO.Directory]::CreateDirectory($appDir) | Out-Null
|
||||
|
|
@ -1640,7 +1652,7 @@ shell.Run cmd, 0, False
|
|||
)
|
||||
Set-Content -LiteralPath $launcher -Value $L -Encoding UTF8
|
||||
$icon = Join-Path $appDir "unsloth.ico"
|
||||
try { if (-not (Test-Path -LiteralPath $icon)) { Invoke-WebRequest "https://raw.githubusercontent.com/unslothai/unsloth/main/studio/frontend/public/unsloth.ico" -OutFile $icon -UseBasicParsing -TimeoutSec 15 *> $null } } catch {}
|
||||
try { if (-not (Test-Path -LiteralPath $icon)) { Invoke-WebRequest "https://raw.githubusercontent.com/unslothai/unsloth/$(Get-UnslothInstallRef)/studio/frontend/public/unsloth.ico" -OutFile $icon -UseBasicParsing -TimeoutSec 15 *> $null } } catch {}
|
||||
$wsh = New-Object -ComObject WScript.Shell
|
||||
$lnks = @()
|
||||
$dd = [Environment]::GetFolderPath("Desktop"); if ($dd -and $dd.Trim()) { $lnks += (Join-Path $dd "Unsloth Studio.lnk") }
|
||||
|
|
@ -1678,7 +1690,7 @@ shell.Run cmd, 0, False
|
|||
if ($env:UNSLOTH_NO_LLAMA_CUDA -ne '1') {
|
||||
$prevEapL = $ErrorActionPreference; $ErrorActionPreference = "Continue"
|
||||
try {
|
||||
$_llamaUrl = "https://raw.githubusercontent.com/unslothai/unsloth/main/studio/scripts/provision_llama_cuda.sh"
|
||||
$_llamaUrl = "https://raw.githubusercontent.com/unslothai/unsloth/$(Get-UnslothInstallRef)/studio/scripts/provision_llama_cuda.sh"
|
||||
# Propagate UNSLOTH_LLAMA_BUILD_JOBS into the WSL build (Windows env
|
||||
# vars do not cross into WSL by default), so thermally/power-limited
|
||||
# laptops can cap the CUDA build's parallelism (`env` with no
|
||||
|
|
|
|||
|
|
@ -373,7 +373,11 @@ function Uninstall-UnslothStudio {
|
|||
# matches this very bash -lc (its argv contains the pattern) and would SIGKILL
|
||||
# the shell before a trailing rm -- so remove files first (guaranteed), then
|
||||
# best-effort kill via fuser by port (does not self-match) + pkill.
|
||||
$_clean = 'rm -rf /root/.unsloth /home/*/.unsloth /root/llama-cuda /root/provision_llama_cuda.sh /root/llama_cuda_build.log 2>/dev/null; fuser -k 8888/tcp 2>/dev/null; pkill -9 -f unsloth_studio 2>/dev/null; pkill -9 -f llama-server 2>/dev/null; true'
|
||||
# Also remove the `unsloth` launcher symlink install.sh drops at
|
||||
# ~/.local/bin/unsloth -> <venv>/bin/unsloth. rm -rf of ~/.unsloth
|
||||
# above deletes its target but leaves the symlink dangling, so the
|
||||
# `unsloth` command still resolves on PATH after an uninstall.
|
||||
$_clean = 'rm -rf /root/.unsloth /home/*/.unsloth /root/llama-cuda /root/provision_llama_cuda.sh /root/llama_cuda_build.log 2>/dev/null; rm -f /root/.local/bin/unsloth /home/*/.local/bin/unsloth 2>/dev/null; fuser -k 8888/tcp 2>/dev/null; pkill -9 -f unsloth_studio 2>/dev/null; pkill -9 -f llama-server 2>/dev/null; true'
|
||||
$_cands = @('', 'Ubuntu', 'Ubuntu-24.04', 'Ubuntu-22.04', 'Debian')
|
||||
if ($env:UNSLOTH_WSL_DISTRO) { $_cands = @($env:UNSLOTH_WSL_DISTRO) + $_cands }
|
||||
$_done = @{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue