File tree Expand file tree Collapse file tree 1 file changed +9
-21
lines changed Expand file tree Collapse file tree 1 file changed +9
-21
lines changed Original file line number Diff line number Diff line change 1313
1414
1515def 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,\n please 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,\n please report an issue!" ,
61+ )
62+ else :
63+ raise e
7664 except Exception :
7765 traceback .print_exc ()
7866 print_dedented (
You can’t perform that action at this time.
0 commit comments