Address the round of Codex review findings on the merged diffusion phases

Memory planning and dense-quant path: size a local diffusers base's
resident companions from its on-disk VAE and text-encoder weights instead
of folding them to zero, feed the distilled variant hint into the runtime
headroom estimate so turbo and schnell models are not over-reserved, place
group-offload companions resident before attaching the transformer hooks
so a failed placement falls back to whole-module offload instead of
crashing, and bail out of the dense transformer download before it starts
when the requested quant scheme is unsupported so the load falls back to
GGUF cleanly.

sd.cpp stack: scrub the native path lease secret from sd-cli child env,
redact native load-progress errors, forward the resolved accelerator when
auto-installing a forced-native binary, release stale diffusion GPU
ownership on CPU-native loads, and remove the sd.cpp install tree on
uninstall.

Prequant and scripts: reject prequant artifacts missing base_model_id
when a base is requested, expanduser before checkpoint existence checks,
record and validate the int8 exclusion filter and fp8 fast-accum in
checkpoint metadata, make verify_prequant_backend allowlist its local
checkpoint and fail on missing or bad LPIPS and on load-peak regressions,
average only finite PSNR values in diffusion_quality, and reset the
process-wide attention backend between perf probe variants.

API and UI: normalize attention_backend casing before Literal validation,
close hidden popovers when leaving the Images page, and clear the stale
quant label when loading a direct local GGUF file.
This commit is contained in:
Daniel Han 2026-07-02 03:26:46 +00:00
commit a9e5a80654
21 changed files with 495 additions and 32 deletions

View file

@ -116,6 +116,19 @@ def test_runtime_env_prepends_binary_dir_to_lib_path():
assert "/existing" in env[var]
def test_runtime_env_scrubs_native_path_lease_secret(monkeypatch):
# The sd-cli child is an external process and must never receive the native-path
# lease secret; every launch (version + generate/upscale) funnels through runtime_env.
monkeypatch.setenv("UNSLOTH_STUDIO_NATIVE_PATH_LEASE_SECRET", "top-secret")
from_os = runtime_env("/opt/sdcpp/bin/sd-cli")
assert "UNSLOTH_STUDIO_NATIVE_PATH_LEASE_SECRET" not in from_os
from_base = runtime_env(
"/opt/sdcpp/bin/sd-cli",
{"UNSLOTH_STUDIO_NATIVE_PATH_LEASE_SECRET": "top-secret"},
)
assert "UNSLOTH_STUDIO_NATIVE_PATH_LEASE_SECRET" not in from_base
def test_runtime_env_handles_missing_lib_path():
var = eng._lib_path_var()
env = runtime_env("/opt/sdcpp/bin/sd-cli", {})