[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-04 09:46:38 +00:00
commit 3347ef5a24
4 changed files with 17 additions and 13 deletions

View file

@ -996,7 +996,10 @@ class DiffusionBackend:
# as-is, so auto is the DEFAULT. An explicit "none"/"off" pins
# GGUF-as-is and an explicit scheme pins that scheme. The overwritten
# "auto" still records source=auto in the resolved provenance.
if transformer_quant is None or str(transformer_quant).strip().lower() in ("", "auto"):
if transformer_quant is None or str(transformer_quant).strip().lower() in (
"",
"auto",
):
transformer_quant = TQ_AUTO
# Default-on fast path: load the DENSE bf16 transformer and torchao-quantise it

View file

@ -135,6 +135,7 @@ def _hf_cache_free_mib() -> Optional[int]:
"""Free MiB on the filesystem holding the HF model cache (None when unprobeable)."""
try:
import shutil
try:
from huggingface_hub.constants import HF_HUB_CACHE as cache_dir
except Exception: # noqa: BLE001 -- hub missing/old: probe the conventional path

View file

@ -1750,15 +1750,17 @@ class DiffusionLoadRequest(BaseModel):
"memory-vs-quality tradeoff (shifts fine detail), not free; "
"pairs well with balanced mode.",
)
transformer_quant: Optional[Literal["auto", "none", "off", "int8", "fp8", "nvfp4", "mxfp8"]] = Field(
None,
description = "Transformer compute dtype. UNSET or auto (the default) picks the "
"fastest precision the hardware supports: the DENSE bf16 transformer "
"is loaded instead of the GGUF and torchao-quantised onto the "
"low-precision tensor cores (data-center fp8, consumer/Ampere int8), "
"falling back to the GGUF when the device, VRAM or disk cannot take "
"it. none/off pins running the GGUF as-is; an explicit scheme forces "
"that scheme. Dense path needs CUDA + bf16.",
transformer_quant: Optional[Literal["auto", "none", "off", "int8", "fp8", "nvfp4", "mxfp8"]] = (
Field(
None,
description = "Transformer compute dtype. UNSET or auto (the default) picks the "
"fastest precision the hardware supports: the DENSE bf16 transformer "
"is loaded instead of the GGUF and torchao-quantised onto the "
"low-precision tensor cores (data-center fp8, consumer/Ampere int8), "
"falling back to the GGUF when the device, VRAM or disk cannot take "
"it. none/off pins running the GGUF as-is; an explicit scheme forces "
"that scheme. Dense path needs CUDA + bf16.",
)
)
transformer_quant_fast_accum: Optional[bool] = Field(
None,

View file

@ -151,9 +151,7 @@ def test_candidate_disk_gate_unprobeable_disk_passes(monkeypatch):
_patch_selector(monkeypatch, scheme = "int8")
monkeypatch.setattr(ap, "_hf_cache_free_mib", lambda: None)
est = resolve_dense_quant_candidate(
fam = _fam("z-image"), target = object(), requested = "auto"
)
est = resolve_dense_quant_candidate(fam = _fam("z-image"), target = object(), requested = "auto")
assert isinstance(est, DenseQuantEstimate)