[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
982b977296
commit
bebbda797d
3 changed files with 12 additions and 5 deletions
|
|
@ -267,7 +267,6 @@ def _apply_fp8_training(transformer, on_event) -> bool:
|
|||
LoRA modules. Never fatal: on any failure the run continues in bf16 with a warning."""
|
||||
try:
|
||||
from torchao.float8 import Float8LinearConfig, convert_to_float8_training
|
||||
|
||||
convert_to_float8_training(
|
||||
transformer,
|
||||
module_filter_fn = _fp8_module_filter,
|
||||
|
|
@ -827,7 +826,12 @@ def _sample_cached_latents(cache, idxs, variant_rng, device):
|
|||
return lat_a + lat_b * torch.randn_like(lat_a)
|
||||
|
||||
|
||||
def _should_compile(cfg, base_is_bnb, device, base_precision = "nf4") -> bool:
|
||||
def _should_compile(
|
||||
cfg,
|
||||
base_is_bnb,
|
||||
device,
|
||||
base_precision = "nf4",
|
||||
) -> bool:
|
||||
mode = (cfg.compile_transformer or "auto").strip().lower()
|
||||
if device != "cuda" or mode == "off":
|
||||
return False
|
||||
|
|
@ -844,7 +848,12 @@ def _should_compile(cfg, base_is_bnb, device, base_precision = "nf4") -> bool:
|
|||
|
||||
|
||||
def _maybe_compile_transformer(
|
||||
transformer, cfg, base_is_bnb, device, on_event, base_precision = "nf4"
|
||||
transformer,
|
||||
cfg,
|
||||
base_is_bnb,
|
||||
device,
|
||||
on_event,
|
||||
base_precision = "nf4",
|
||||
) -> bool:
|
||||
"""Regionally compile the transformer blocks (diffusers compile_repeated_blocks) after
|
||||
the LoRA is attached. Never fatal: a wrap failure falls back to eager with a warning
|
||||
|
|
|
|||
|
|
@ -140,7 +140,6 @@ def train_precision_modes() -> tuple[list[str], str]:
|
|||
recommended = "nf4"
|
||||
try:
|
||||
import torch
|
||||
|
||||
if torch.cuda.is_available():
|
||||
modes += ["bf16", "int8"]
|
||||
major, minor = torch.cuda.get_device_capability()
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ def test_train_precision_modes_no_cuda(monkeypatch):
|
|||
# Patch the torch module attribute the function imports so it observes a CPU-only box:
|
||||
# no CUDA -> the nf4-only floor with nf4 recommended, and it never raises.
|
||||
import torch
|
||||
|
||||
monkeypatch.setattr(torch.cuda, "is_available", lambda: False)
|
||||
assert train_precision_modes() == (["nf4"], "nf4")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue