diff options
| -rw-r--r-- | generate.py | 2 | ||||
| -rwxr-xr-x | imggen | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/generate.py b/generate.py index 9cbc167..95b2dd7 100644 --- a/generate.py +++ b/generate.py @@ -27,7 +27,7 @@ from diffusers import StableDiffusionXLPipeline, AutoencoderKL MODELS = { "sdxl": "stabilityai/stable-diffusion-xl-base-1.0", # default, general "realvis": "SG161222/RealVisXL_V5.0", # photoreal, permissive - "pony": "AstraliteHeart/pony-diffusion-v6-xl", # unrestricted, versatile + "pony": "kitty7779/ponyDiffusionV6XL", # unrestricted, versatile (ungated diffusers-format mirror) } DEFAULT_MODEL = "sdxl" # fp16-fix VAE avoids the fp32 upcast that OOMs a 12GB card at decode time. @@ -95,8 +95,16 @@ if daemon_up; then current="$(curl -s "${BASE}/status" | sed -n 's/.*"model": *"\([^"]*\)".*/\1/p')" if [ "$current" != "$MODEL" ]; then echo "swapping daemon model $current -> $MODEL ..." >&2 - curl -sf -X POST "${BASE}/model" -H 'Content-Type: application/json' \ - -d "{\"name\":\"$MODEL\"}" >/dev/null + # Capture body and status; a failed swap (bad/gated repo, OOM) must be + # surfaced, not silently swallowed by set -e killing the script. + swap_body="$(curl -s -w '\n%{http_code}' -X POST "${BASE}/model" \ + -H 'Content-Type: application/json' -d "{\"name\":\"$MODEL\"}")" + swap_code="${swap_body##*$'\n'}" + swap_msg="${swap_body%$'\n'*}" + if [ "$swap_code" != "200" ]; then + echo "swap to '$MODEL' failed (HTTP $swap_code): $swap_msg" >&2 + exit 1 + fi fi # Build JSON request. jq not assumed; hand-build (values are ours/simple). |
