[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
a9e5a80654
commit
dd792c6312
6 changed files with 16 additions and 5 deletions
|
|
@ -296,7 +296,9 @@ def _compare(
|
|||
if all(x == math.inf for x in xs):
|
||||
return math.inf
|
||||
vals = [
|
||||
_PERFECT_MATCH_PSNR if x == math.inf else x for x in xs if math.isfinite(x) or x == math.inf
|
||||
_PERFECT_MATCH_PSNR if x == math.inf else x
|
||||
for x in xs
|
||||
if math.isfinite(x) or x == math.inf
|
||||
]
|
||||
return round(sum(vals) / len(vals), 4) if vals else None
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,9 @@ def run(
|
|||
try:
|
||||
pipe.transformer.set_attention_backend("native")
|
||||
except Exception as exc: # noqa: BLE001 — best-effort isolation
|
||||
print(f" [{tag}] attn(native-reset)={type(exc).__name__}:{str(exc)[:60]}", flush = True)
|
||||
print(
|
||||
f" [{tag}] attn(native-reset)={type(exc).__name__}:{str(exc)[:60]}", flush = True
|
||||
)
|
||||
if fbcache is not None:
|
||||
try:
|
||||
from diffusers.hooks import FirstBlockCacheConfig, apply_first_block_cache
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ def run(mode, steps, seed, res):
|
|||
print("FAIL: runtime reference image missing; run --mode runtime first", flush = True)
|
||||
return 1
|
||||
from PIL import Image
|
||||
|
||||
lp = _lpips(np.array(Image.open(ref_path).convert("RGB")), np.array(img))
|
||||
print(f"[prequant] LPIPS_vs_runtime={lp}", flush = True)
|
||||
if lp is None:
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ _INSTALL_ACCELERATOR = {"rocm": "rocm", "cuda": "cuda", "xpu": "vulkan"}
|
|||
def _install_accelerator_for(backend: str) -> str:
|
||||
return _INSTALL_ACCELERATOR.get(backend, "auto")
|
||||
|
||||
|
||||
# The engine the current (or most recent) load committed to, and why a non-native
|
||||
# choice was made. Mutated only under _lock during selection.
|
||||
_lock = threading.Lock()
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ def _resolve_checkpoint_path(source: PrequantSource, hf_token: Optional[str]) ->
|
|||
"""The local file path for ``source``, downloading from the Hub if needed; None if absent."""
|
||||
if source.kind == "path":
|
||||
import os
|
||||
|
||||
# Expand ~ once: the allowlist gate (_local_prequant_path_allowed) already
|
||||
# expands it, so a "~/..." path that passed the gate must be expanded here too
|
||||
# or os.path.isfile() sees the literal "~" and silently skips a real checkpoint.
|
||||
|
|
@ -277,7 +278,9 @@ def _validate_checkpoint(
|
|||
_warn(
|
||||
logger,
|
||||
scheme,
|
||||
ValueError(f"checkpoint metadata missing base_model_id; refusing for base {base!r}"),
|
||||
ValueError(
|
||||
f"checkpoint metadata missing base_model_id; refusing for base {base!r}"
|
||||
),
|
||||
)
|
||||
return False
|
||||
if not _same_base_model(ckpt_base, base):
|
||||
|
|
@ -300,13 +303,14 @@ def _validate_checkpoint(
|
|||
ckpt_excludes = meta.get("exclude_name_tokens")
|
||||
if ckpt_excludes is not None:
|
||||
from .diffusion_transformer_quant import exclude_tokens_for_scheme
|
||||
|
||||
expected = tuple(exclude_tokens_for_scheme(scheme))
|
||||
if tuple(ckpt_excludes) != expected:
|
||||
_warn(
|
||||
logger,
|
||||
scheme,
|
||||
ValueError(f"checkpoint exclude_name_tokens {tuple(ckpt_excludes)!r} != {expected!r}"),
|
||||
ValueError(
|
||||
f"checkpoint exclude_name_tokens {tuple(ckpt_excludes)!r} != {expected!r}"
|
||||
),
|
||||
)
|
||||
return False
|
||||
# fp8 fast-accum is baked into the saved kernels; only enforce when the caller forces it.
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ class SdCppDiffusionBackend:
|
|||
# asset-fetch / local-path / cache-IO failure can embed absolute paths
|
||||
# (e.g. /home/<user>/...), and the diffusers load path scrubs the same way.
|
||||
from utils.native_path_leases import redact_native_paths
|
||||
|
||||
with self._lock:
|
||||
if self._load_token == _load_token and self._loading is not None:
|
||||
self._loading.error = redact_native_paths(str(exc))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue