From ce2bf151ce7ea1861012a7f6391f78e97370c6ce Mon Sep 17 00:00:00 2001 From: Titus von Koeller <9048635+Titus-von-Koeller@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:58:24 +0200 Subject: [PATCH] Sanity check: Add check for `lib` being None --- bitsandbytes/diagnostics/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bitsandbytes/diagnostics/main.py b/bitsandbytes/diagnostics/main.py index a7f0c901e..7a88bca26 100644 --- a/bitsandbytes/diagnostics/main.py +++ b/bitsandbytes/diagnostics/main.py @@ -13,6 +13,21 @@ def sanity_check(): + from bitsandbytes.cextension import lib + + if lib is None: + print_dedented( + """ + Couldn't load the bitsandbytes library, likely due to missing binaries. + Please ensure bitsandbytes is properly installed. + + For source installations, compile the binaries with `cmake -DCOMPUTE_BACKEND=cuda -S .`. + See the documentation for more details if needed. + + Trying a simple check anyway, but this will likely fail... + """ + ) + from bitsandbytes.optim import Adam p = torch.nn.Parameter(torch.rand(10, 10).cuda())