Studio: tighten image-generation fix comments and docstrings

This commit is contained in:
Daniel Han 2026-07-13 13:31:31 +00:00
commit 53912b2f99
20 changed files with 161 additions and 246 deletions

View file

@ -370,11 +370,9 @@ function Uninstall-UnslothStudio {
if ($defaultSdCpp -and (Test-Path -LiteralPath $defaultSdCpp) -and (Test-Path -LiteralPath (Join-Path $defaultSdCpp ".unsloth-studio-owned") -PathType Leaf)) {
$defaultSdCppToStop = $defaultSdCpp
}
# Custom/env-mode sd.cpp builds sit BESIDE each custom root at <parent>\stable-diffusion.cpp
# (find_sd_cpp_binary resolves from UNSLOTH_STUDIO_HOME.parent), so a running owned sd-server
# there is outside every root above ($knownRoots holds the custom root, not its sibling). We
# delete those marker-owned dirs below, so add them to the handle scan too -- gated on the same
# owner marker as the delete, matching the default-root handling.
# Custom/env-mode sd.cpp builds sit BESIDE each custom root at <parent>\stable-diffusion.cpp,
# outside $knownRoots. We delete those marker-owned dirs below, so add them to the handle scan
# too, gated on the same owner marker.
$customSdCppToStop = @()
foreach ($r in $customRoots) {
$sdc = Join-Path (Split-Path -LiteralPath $r -Parent) "stable-diffusion.cpp"

View file

@ -35,12 +35,9 @@ _pkill_escape() {
printf '%s' "$1" | sed -e 's:[][\\.^$*+?{|}()/]:\\&:g'
}
# Owned sd.cpp roots (default + custom siblings), each gated on the install-time
# owner marker. Native diffusion builds beside a custom/env root at
# <parent>/stable-diffusion.cpp (find_sd_cpp_binary resolves from
# UNSLOTH_STUDIO_HOME.parent) and at $HOME/.unsloth/stable-diffusion.cpp by default.
# The marker is mandatory so we never stop a user-managed sd-server from an
# unrelated checkout that happens to sit at one of these paths.
# Owned sd.cpp roots (default $HOME/.unsloth/stable-diffusion.cpp + each custom root's
# <parent>/stable-diffusion.cpp sibling), each gated on the install-time owner marker so we never
# stop a user-managed sd-server from an unrelated checkout at one of these paths.
_owned_sd_cpp_roots() {
_default_sd="$HOME/.unsloth/stable-diffusion.cpp"
[ -f "$_default_sd/.unsloth-studio-owned" ] && printf '%s\n' "$_default_sd"
@ -51,10 +48,8 @@ _owned_sd_cpp_roots() {
done
}
# pkill resident sd-server / sd-cli whose executable lives under an owned sd.cpp
# root, BEFORE that tree is removed below: a live native server keeps running
# after its binary is unlinked. Anchored on the owned root so an unrelated
# checkout's sd-server is never matched.
# pkill resident sd-server / sd-cli under an owned sd.cpp root before that tree is removed (a live
# native server keeps running after its binary is unlinked). Anchored on the owned root.
_stop_owned_sd_cpp_processes() {
_signal="$1"
command -v pkill >/dev/null 2>&1 || return 0