Skip to content

Commit 308afcf

Browse files
Tests: xfail opcheck for 4bit quantization with floating storage dtypes
1 parent fa9facf commit 308afcf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

bitsandbytes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
if torch.cuda.is_available():
3535
from .backends.cuda import ops as cuda_ops
3636

37-
if torch.xpu.is_available():
37+
if hasattr(torch, "xpu") and torch.xpu.is_available():
3838
from .backends.xpu import ops as xpu_ops
3939

4040

bitsandbytes/backends/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
1.0,
3131
],
3232
dtype=torch.float32,
33-
device="xpu" if torch.xpu.is_available() else "cpu", # Only cpu/xpu use this table for now.
33+
device="xpu"
34+
if hasattr(torch, "xpu") and torch.xpu.is_available()
35+
else "cpu", # Only cpu/xpu use this table for now.
3436
)
3537
_FP4_QUANT_TABLE = torch.tensor(
3638
[
@@ -52,6 +54,8 @@
5254
-0.2500,
5355
],
5456
dtype=torch.float32,
55-
device="xpu" if torch.xpu.is_available() else "cpu", # Only cpu/xpu use this table for now.
57+
device="xpu"
58+
if hasattr(torch, "xpu") and torch.xpu.is_available()
59+
else "cpu", # Only cpu/xpu use this table for now.
5660
)
5761
CODE = {"nf4": _NF4_QUANT_TABLE, "fp4": _FP4_QUANT_TABLE}

0 commit comments

Comments
 (0)