You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mock BNBNativeLibrary that raises an error when trying to use native library
97
-
functionality without successfully loading the library.
98
-
Any method or attribute access will raise a RuntimeError with a message that
99
-
points to the original error and provides troubleshooting steps.
96
+
Mock library handler that defers errors until native methods are called.
97
+
98
+
This class serves as a fallback when the native bitsandbytes library fails to load.
99
+
It captures the original error and generates detailed troubleshooting guidance.
100
+
101
+
Key behaviors:
102
+
- Allows attribute access and method assignment without immediate errors
103
+
- Throws a RuntimeError with diagnostic information only when a native method is called, as otherwise it would error out on import, breaking backward compatibility
104
+
- Handles both missing CUDA dependencies and version mismatch scenarios
105
+
106
+
Error scenarios covered:
107
+
1. Missing shared library dependencies (e.g., libcudart.so not in LD_LIBRARY_PATH or through PyTorch CUDA installation)
108
+
2. CUDA version mismatch between PyTorch and available pre-compiled binaries
109
+
3. Completely missing pre-compiled binaries when CUDA is detected
110
+
4. Custom BNB_CUDA_VERSION override but mismatch
111
+
5. CPU-only installation attempts when GPU functionality is requested
0 commit comments