[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
1faa0ca058
commit
fbb9b8156f
2 changed files with 7 additions and 8 deletions
|
|
@ -109,9 +109,11 @@ def _torchao_export_supported():
|
|||
Linux, and macOS are unaffected (torchao is real)."""
|
||||
try:
|
||||
from core._torchao_stub import is_win32_rocm
|
||||
|
||||
if is_win32_rocm():
|
||||
return False
|
||||
import unsloth.save as _us
|
||||
|
||||
return hasattr(_us, "_normalize_torchao_method")
|
||||
except Exception:
|
||||
return False
|
||||
|
|
@ -121,7 +123,6 @@ def _torchao_runtime_unavailable():
|
|||
"""True where portable torchao export cannot run (Windows ROCm): torchao is import-stubbed
|
||||
(its config classes return None) or torch.distributed is absent. False everywhere else."""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from core._torchao_stub import is_win32_rocm, _STUB_SENTINEL
|
||||
if is_win32_rocm():
|
||||
|
|
|
|||
|
|
@ -173,17 +173,15 @@ def _exec_func(rel, name):
|
|||
@pytest.mark.parametrize(
|
||||
("platform", "hip", "version", "expected"),
|
||||
[
|
||||
("win32", "6.4.0", "2.10.0+rocm6.4", True), # ROCm via torch.version.hip
|
||||
("win32", None, "2.10.0+rocm6.4", True), # ROCm via __version__ tag only
|
||||
("win32", None, "2.10.0+cu128", False), # Windows CUDA -> real torchao
|
||||
("win32", "6.4.0", "2.10.0+rocm6.4", True), # ROCm via torch.version.hip
|
||||
("win32", None, "2.10.0+rocm6.4", True), # ROCm via __version__ tag only
|
||||
("win32", None, "2.10.0+cu128", False), # Windows CUDA -> real torchao
|
||||
("linux", "6.4.0", "2.10.0+rocm6.4", False), # Linux ROCm -> real torchao
|
||||
("darwin", None, "2.10.0", False), # macOS
|
||||
("darwin", None, "2.10.0", False), # macOS
|
||||
],
|
||||
)
|
||||
def test_is_win32_rocm(monkeypatch, platform, hip, version, expected):
|
||||
fake_torch = types.SimpleNamespace(
|
||||
version = types.SimpleNamespace(hip = hip), __version__ = version
|
||||
)
|
||||
fake_torch = types.SimpleNamespace(version = types.SimpleNamespace(hip = hip), __version__ = version)
|
||||
monkeypatch.setattr(sys, "platform", platform)
|
||||
monkeypatch.setitem(sys.modules, "torch", fake_torch)
|
||||
assert _stub.is_win32_rocm() is expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue