[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-07-27 07:18:10 +00:00
commit 283af88f53
6 changed files with 14 additions and 9 deletions

View file

@ -179,7 +179,6 @@ def _pip_requirement(backend: str, package: str) -> str:
return package
try:
from diffusers.models.attention_dispatch import _REQUIRED_SAGE_VERSION as floor
if isinstance(floor, str) and floor.strip():
return f"sageattention>={floor.strip()}"
except Exception: # noqa: BLE001 — older/newer diffusers may not expose it; keep the static pin

View file

@ -16377,7 +16377,10 @@ async def generate_diffusion_image(
"loras": (
[f"{l.id}:{l.weight:g}" for l in request.loras]
if request.loras
else [f"{name}:{weight:g}" for name, weight in result.get("active_loras") or []]
else [
f"{name}:{weight:g}"
for name, weight in result.get("active_loras") or []
]
),
"controlnet": (
f"{request.controlnet.id}:{request.controlnet.control_type}:"

View file

@ -3318,7 +3318,6 @@ def _arch_to_task(arch: Optional[str], name_hints: tuple[Optional[str], ...] = (
# Same shape as the video branch: the arch is shared, so let the family detection the
# loader itself uses decide, trying each hint separately (a repo id, then a filename).
from core.inference.diffusion_families import detect_family_for_pick, family_gguf_loadable
for hint in name_hints:
if not hint:
continue

View file

@ -1397,9 +1397,9 @@ def test_arch_to_task_agrees_with_the_loader_on_ambiguous_archs():
loader_accepts = True
except (ValueError, FileNotFoundError):
loader_accepts = False
assert (task == "text-to-image") == loader_accepts, (
f"{fam.name}: picker task={task} but loader accepts={loader_accepts}"
)
assert (
task == "text-to-image"
) == loader_accepts, f"{fam.name}: picker task={task} but loader accepts={loader_accepts}"
def _clear_chat_delete_guards(monkeypatch):

View file

@ -207,7 +207,6 @@ def test_disk_gate_matches_download_for_bf16_published_families(monkeypatch):
# Families that publish bf16 download what they occupy (measured 0.99-1.07x), so the two
# numbers stay equal and no factor entry is needed.
import core.inference.diffusion_auto_policy as ap
for name in ("flux.1", "flux.2-dev", "qwen-image", "krea-2", "hidream-i1"):
est = ap.estimate_dense_quant(_fam(name), "int8")
assert est.download_transformer_mib == est.transient_transformer_mib, name

View file

@ -75,14 +75,19 @@ def test_metal_text_encoder_flag_reaches_both_command_builders(monkeypatch):
binary = "sd-server", files = files, host = "127.0.0.1", port = 1234
)
cli = build_sd_cpp_command(
binary = "sd-cli", files = files, params = SdCppGenParams(prompt = "x"),
binary = "sd-cli",
files = files,
params = SdCppGenParams(prompt = "x"),
output_path = "/o/x.png",
)
assert server.count("--clip-on-cpu") == 1
assert cli.count("--clip-on-cpu") == 1
# An offload policy that already pins the encoder must not emit it twice.
dual = build_sd_cpp_server_command(
binary = "sd-server", files = files, host = "127.0.0.1", port = 1234,
binary = "sd-server",
files = files,
host = "127.0.0.1",
port = 1234,
offload = offload_flags("model"),
)
assert dual.count("--clip-on-cpu") == 1