Skip to content

Commit ebfda25

Browse files
cleanup python -m bnb to align with changes
1 parent f1d9d80 commit ebfda25

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

bitsandbytes/diagnostics/main.py

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313

1414

1515
def sanity_check():
16-
from bitsandbytes.cextension import lib
17-
18-
if lib is None:
19-
print_dedented(
20-
"""
21-
Couldn't load the bitsandbytes library, likely due to missing binaries.
22-
Please ensure bitsandbytes is properly installed.
23-
24-
For source installations, compile the binaries with `cmake -DCOMPUTE_BACKEND=cuda -S .`.
25-
See the documentation for more details if needed.
26-
27-
Trying a simple check anyway, but this will likely fail...
28-
""",
29-
)
30-
3116
from bitsandbytes.optim import Adam
3217

3318
p = torch.nn.Parameter(torch.rand(10, 10).cuda())
@@ -67,12 +52,15 @@ def main():
6752
print("SUCCESS!")
6853
print("Installation was successful!")
6954
return
70-
except ImportError:
71-
print(
72-
f"WARNING: {__package__} is currently running as CPU-only!\n"
73-
"Therefore, 8-bit optimizers and GPU quantization are unavailable.\n\n"
74-
f"If you think that this is so erroneously,\nplease report an issue!",
75-
)
55+
except RuntimeError as e:
56+
if "not available in CPU-only" in str(e):
57+
print(
58+
f"WARNING: {__package__} is currently running as CPU-only!\n"
59+
"Therefore, 8-bit optimizers and GPU quantization are unavailable.\n\n"
60+
f"If you think that this is so erroneously,\nplease report an issue!",
61+
)
62+
else:
63+
raise e
7664
except Exception:
7765
traceback.print_exc()
7866
print_dedented(

0 commit comments

Comments
 (0)