[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
acc604ffaf
commit
e9db36a7ca
3 changed files with 10 additions and 3 deletions
|
|
@ -304,6 +304,7 @@ def native_bf16_supported() -> bool:
|
|||
guard so all three stay in sync."""
|
||||
try:
|
||||
import torch
|
||||
|
||||
if not torch.cuda.is_available():
|
||||
return False
|
||||
is_rocm = bool(getattr(getattr(torch, "version", None), "hip", None))
|
||||
|
|
|
|||
|
|
@ -146,7 +146,9 @@ def test_bf16_unsupported_reason(monkeypatch):
|
|||
# report is_bf16_supported() True, so the gate is native compute capability (major >= 8), not
|
||||
# is_bf16_supported() -- otherwise the emulation case would slip through and evict-then-fail.
|
||||
monkeypatch.setattr(torch.cuda, "is_available", lambda: True)
|
||||
monkeypatch.setattr(torch.cuda, "is_bf16_supported", lambda *a, **k: True) # emulation reports True
|
||||
monkeypatch.setattr(
|
||||
torch.cuda, "is_bf16_supported", lambda *a, **k: True
|
||||
) # emulation reports True
|
||||
monkeypatch.setattr(torch.cuda, "get_device_capability", lambda *a, **k: (7, 5)) # Turing
|
||||
assert "bfloat16" in (bf16_unsupported_reason("flux.1") or "")
|
||||
|
||||
|
|
@ -168,7 +170,9 @@ def test_native_bf16_supported_gates_on_capability(monkeypatch):
|
|||
from core.training.diffusion_train_common import native_bf16_supported
|
||||
|
||||
monkeypatch.setattr(torch.cuda, "is_available", lambda: True)
|
||||
monkeypatch.setattr(torch.cuda, "is_bf16_supported", lambda *a, **k: True) # emulation reports True
|
||||
monkeypatch.setattr(
|
||||
torch.cuda, "is_bf16_supported", lambda *a, **k: True
|
||||
) # emulation reports True
|
||||
monkeypatch.setattr(torch.cuda, "get_device_capability", lambda *a, **k: (7, 5)) # Turing
|
||||
assert native_bf16_supported() is False
|
||||
monkeypatch.setattr(torch.cuda, "get_device_capability", lambda *a, **k: (8, 0)) # Ampere
|
||||
|
|
|
|||
|
|
@ -311,7 +311,9 @@ def test_train_precision_modes_pre_ampere_is_nf4_only(monkeypatch):
|
|||
import torch
|
||||
|
||||
monkeypatch.setattr(torch.cuda, "is_available", lambda: True)
|
||||
monkeypatch.setattr(torch.cuda, "is_bf16_supported", lambda *a, **k: True) # emulation reports True
|
||||
monkeypatch.setattr(
|
||||
torch.cuda, "is_bf16_supported", lambda *a, **k: True
|
||||
) # emulation reports True
|
||||
monkeypatch.setattr(torch.cuda, "get_device_capability", lambda *a, **k: (7, 5)) # Turing
|
||||
modes, recommended = train_precision_modes()
|
||||
assert modes == ["nf4"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue