[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
514f4c60fe
commit
a3593ba78a
5 changed files with 16 additions and 11 deletions
|
|
@ -459,7 +459,6 @@ def _device_identity(idx: int) -> Optional[tuple]:
|
|||
props cannot be queried (a stubbed/old torch): identity is then treated as
|
||||
unknown and the check stays best-effort rather than blocking the engage."""
|
||||
import torch
|
||||
|
||||
try:
|
||||
return (
|
||||
str(torch.cuda.get_device_name(idx)),
|
||||
|
|
|
|||
|
|
@ -368,7 +368,6 @@ def quantize_text_encoders(
|
|||
# offload's Module.to() hard-crashes on). Fail the load for that; a clean
|
||||
# miss (nothing swapped, e.g. layerwise fp8) stays best-effort dense.
|
||||
from .diffusion_transformer_quant import raise_if_partially_quantized
|
||||
|
||||
raise_if_partially_quantized(encoder, what = f"text_encoder_quant {mode}:{attr}", exc = exc)
|
||||
_warn(logger, f"{mode}:{attr}", exc)
|
||||
return mode if cast else None
|
||||
|
|
|
|||
|
|
@ -473,11 +473,7 @@ def _views_for(pipe: Any, fam: VideoFamily) -> tuple[Any, ...]:
|
|||
|
||||
|
||||
def _step_cache_all_or_none(
|
||||
pipe: Any,
|
||||
fam: VideoFamily,
|
||||
engage_fn: Any,
|
||||
*,
|
||||
logger: Any,
|
||||
pipe: Any, fam: VideoFamily, engage_fn: Any, *, logger: Any
|
||||
) -> tuple[Optional[str], Optional[str]]:
|
||||
"""Run ``engage_fn(view, expert_name)`` (apply_step_cache or the auto toggle) over
|
||||
every expert and enforce ALL-OR-NONE, mirroring the transactional quant loop: on a
|
||||
|
|
@ -1514,6 +1510,7 @@ class VideoBackend:
|
|||
cache_request = (
|
||||
auto_cache_mode(fam.name) if default_cache_steps >= FBCACHE_MIN_STEPS else None
|
||||
)
|
||||
|
||||
# Each expert view passes the pipe attribute it exposes as ``transformer`` (the
|
||||
# expert-view iteration contract): a dual-expert MoE's second view passes
|
||||
# expert="transformer_2" so MagCache resolves THAT expert's calibrated curve --
|
||||
|
|
|
|||
|
|
@ -779,7 +779,11 @@ def test_quantize_transformer_partial_failure_raises(monkeypatch):
|
|||
monkeypatch.setattr(tq, "_make_quant_config", lambda scheme, fast_accum = None: "cfg")
|
||||
tqz = types.ModuleType("torchao.quantization")
|
||||
|
||||
def _convert_one_then_boom(module, config, filter_fn = None):
|
||||
def _convert_one_then_boom(
|
||||
module,
|
||||
config,
|
||||
filter_fn = None,
|
||||
):
|
||||
module._swapped = True # the in-place swap of the first submodule
|
||||
raise RuntimeError("OOM mid-conversion")
|
||||
|
||||
|
|
@ -798,7 +802,11 @@ def test_quantize_transformer_clean_failure_still_falls_back_dense(monkeypatch):
|
|||
monkeypatch.setattr(tq, "_make_quant_config", lambda scheme, fast_accum = None: "cfg")
|
||||
tqz = types.ModuleType("torchao.quantization")
|
||||
|
||||
def _boom(module, config, filter_fn = None):
|
||||
def _boom(
|
||||
module,
|
||||
config,
|
||||
filter_fn = None,
|
||||
):
|
||||
raise RuntimeError("failed before any swap")
|
||||
|
||||
tqz.quantize_ = _boom
|
||||
|
|
|
|||
|
|
@ -2101,7 +2101,8 @@ def test_step_cache_all_or_none_rolls_back_second_expert_failure(monkeypatch):
|
|||
monkeypatch.setattr(
|
||||
video,
|
||||
"_disengage_step_cache",
|
||||
lambda transformer, *, reason, logger = None: disengaged.append((transformer, reason)) or True,
|
||||
lambda transformer, *, reason, logger = None: disengaged.append((transformer, reason))
|
||||
or True,
|
||||
)
|
||||
calls: list = []
|
||||
|
||||
|
|
@ -2128,7 +2129,8 @@ def test_step_cache_all_or_none_rolls_back_first_expert_failure(monkeypatch):
|
|||
lambda transformer, *, reason, logger = None: disengaged.append(transformer) or True,
|
||||
)
|
||||
mode, reason = video._step_cache_all_or_none(
|
||||
pipe, fam,
|
||||
pipe,
|
||||
fam,
|
||||
lambda view, expert_name: "magcache" if expert_name == "transformer_2" else None,
|
||||
logger = None,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue