summaryrefslogtreecommitdiff
path: root/bitsandbytes/cextension.py
diff options
context:
space:
mode:
authorTitus von Koeller <titus@vonkoeller.com>2022-08-01 03:31:48 -0700
committerTitus von Koeller <titus@vonkoeller.com>2022-08-01 03:31:48 -0700
commitbfa0e33294f2b1dc25e65a33be2397f989824298 (patch)
tree396b5d722fdd79da068882ca7376e3636fcb3bb8 /bitsandbytes/cextension.py
parent597a8521b29e90958c31e47421016494da998648 (diff)
ran black and isort for coherent code formatting
Diffstat (limited to 'bitsandbytes/cextension.py')
-rw-r--r--bitsandbytes/cextension.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/bitsandbytes/cextension.py b/bitsandbytes/cextension.py
index 4bc7bf7..bc11474 100644
--- a/bitsandbytes/cextension.py
+++ b/bitsandbytes/cextension.py
@@ -1,6 +1,7 @@
import ctypes as ct
import os
from warnings import warn
+
from bitsandbytes.cuda_setup import evaluate_cuda_setup
@@ -8,17 +9,21 @@ class CUDALibrary_Singleton(object):
_instance = None
def __init__(self):
- raise RuntimeError('Call get_instance() instead')
+ raise RuntimeError("Call get_instance() instead")
def initialize(self):
self.context = {}
binary_name = evaluate_cuda_setup()
- if not os.path.exists(os.path.dirname(__file__) + f'/{binary_name}'):
- print(f'TODO: compile library for specific version: {binary_name}')
- print('defaulting to libbitsandbytes.so')
- self.lib = ct.cdll.LoadLibrary(os.path.dirname(__file__) + '/libbitsandbytes.so')
+ if not os.path.exists(os.path.dirname(__file__) + f"/{binary_name}"):
+ print(f"TODO: compile library for specific version: {binary_name}")
+ print("defaulting to libbitsandbytes.so")
+ self.lib = ct.cdll.LoadLibrary(
+ os.path.dirname(__file__) + "/libbitsandbytes.so"
+ )
else:
- self.lib = ct.cdll.LoadLibrary(os.path.dirname(__file__) + f'/{binary_name}')
+ self.lib = ct.cdll.LoadLibrary(
+ os.path.dirname(__file__) + f"/{binary_name}"
+ )
@classmethod
def get_instance(cls):
@@ -35,6 +40,8 @@ try:
lib.get_cusparse.restype = ct.c_void_p
COMPILED_WITH_CUDA = True
except AttributeError:
- warn("The installed version of bitsandbytes was compiled without GPU support. "
- "8-bit optimizers and GPU quantization are unavailable.")
+ warn(
+ "The installed version of bitsandbytes was compiled without GPU support. "
+ "8-bit optimizers and GPU quantization are unavailable."
+ )
COMPILED_WITH_CUDA = False