fix: address review feedback on install paths

- Add missing --upgrade-package unsloth-zoo flag to local, default,
  and fallback install paths in install.sh and install.ps1
- Merge identical elseif/else branches in install.ps1 fallback section
- Merge identical StudioLocalInstall/default branches in install.ps1
  fresh-env section into a single else block
- Honor --package override in install.sh so custom package names
  (fork/test aliases) are not silently replaced by git defaults
- Consistent package order (unsloth then zoo) across all paths
This commit is contained in:
Daniel Han 2026-04-02 18:12:05 +00:00
commit 6d20440341
2 changed files with 18 additions and 18 deletions

View file

@ -870,10 +870,8 @@ shell.Run cmd, 0, False
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --no-deps -r $NoTorchReq }
}
}
} elseif ($StudioLocalInstall) {
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth $DefaultUnslothPkg $DefaultZooPkg }
} else {
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth $DefaultUnslothPkg $DefaultZooPkg }
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth --upgrade-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg }
}
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
@ -891,24 +889,18 @@ shell.Run cmd, 0, False
} else {
# Fallback: GPU detection failed to produce a URL -- let uv resolve torch
substep "installing unsloth (this may take a few minutes)..."
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth --upgrade-package unsloth-zoo $DefaultUnslothPkg $DefaultZooPkg --torch-backend=auto }
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
return
}
if ($StudioLocalInstall) {
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython $DefaultZooPkg $DefaultUnslothPkg --torch-backend=auto }
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
return
}
substep "overlaying local repo (editable)..."
$overlayExit = Invoke-InstallCommand { uv pip install --python $VenvPython -e $RepoRoot --no-deps }
if ($overlayExit -ne 0) {
Write-Host "[ERROR] Failed to overlay local repo (exit code $overlayExit)" -ForegroundColor Red
return
}
} else {
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython $DefaultUnslothPkg $DefaultZooPkg --torch-backend=auto }
if ($baseInstallExit -ne 0) {
Write-Host "[ERROR] Failed to install unsloth (exit code $baseInstallExit)" -ForegroundColor Red
return
}
}
}

View file

@ -68,6 +68,12 @@ for arg in "$@"; do
esac
done
# Honor --package override: if the user passed a custom package name,
# use it instead of the maintainer default for the unsloth install target.
if [ "$PACKAGE_NAME" != "unsloth" ]; then
_DEFAULT_UNSLOTH_PKG="$PACKAGE_NAME"
fi
if [ "$_VERBOSE" = true ]; then
export UNSLOTH_VERBOSE=1
fi
@ -1089,22 +1095,24 @@ elif [ -n "$TORCH_INDEX_URL" ]; then
fi
elif [ "$STUDIO_LOCAL_INSTALL" = true ]; then
run_install_cmd "install unsloth (local)" uv pip install --python "$_VENV_PY" \
--upgrade-package unsloth "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG"
--upgrade-package unsloth --upgrade-package unsloth-zoo "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG"
substep "overlaying local repo (editable)..."
run_install_cmd "overlay local repo" uv pip install --python "$_VENV_PY" -e "$_REPO_ROOT" --no-deps
else
run_install_cmd "install unsloth" uv pip install --python "$_VENV_PY" \
--upgrade-package unsloth "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG"
--upgrade-package unsloth --upgrade-package unsloth-zoo "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG"
fi
else
# Fallback: GPU detection failed to produce a URL -- let uv resolve torch
substep "installing unsloth (this may take a few minutes)..."
if [ "$STUDIO_LOCAL_INSTALL" = true ]; then
run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" "$_DEFAULT_ZOO_PKG" "$_DEFAULT_UNSLOTH_PKG" --torch-backend=auto
run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" \
--upgrade-package unsloth --upgrade-package unsloth-zoo "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" --torch-backend=auto
substep "overlaying local repo (editable)..."
run_install_cmd "overlay local repo" uv pip install --python "$_VENV_PY" -e "$_REPO_ROOT" --no-deps
else
run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" --torch-backend=auto
run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" \
--upgrade-package unsloth --upgrade-package unsloth-zoo "$_DEFAULT_UNSLOTH_PKG" "$_DEFAULT_ZOO_PKG" --torch-backend=auto
fi
fi