Skip to content

Commit be47d49

Browse files
test
1 parent e82c4da commit be47d49

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bitsandbytes/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# LICENSE file in the root directory of this source tree.
55

66

7+
import importlib
78
import sys
89

910
import torch
@@ -37,8 +38,13 @@
3738
if hasattr(torch, "xpu") and torch.xpu.is_available():
3839
from .backends.xpu import ops as xpu_ops
3940

40-
if hasattr(torch, "hpu") and torch.hpu.is_available():
41-
from .backends.hpu import ops as hpu_ops
41+
42+
if importlib.util.find_spec("habana_frameworks.torch"):
43+
# In case not automatically imported
44+
import habana_frameworks.torch # type: ignore # noqa: I001
45+
46+
if hasattr(torch, "hpu") and torch.hpu.is_available():
47+
from .backends.hpu import ops as hpu_ops
4248

4349

4450
def _import_backends():

0 commit comments

Comments
 (0)