From 0905ad743f887ef396fedb0b364cfec04d8acd26 Mon Sep 17 00:00:00 2001 From: jianan-gu Date: Thu, 8 Feb 2024 07:32:13 -0800 Subject: [PATCH] fix import issue --- bitsandbytes/__init__.py | 4 +++- bitsandbytes/backends/__init__.py | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/bitsandbytes/__init__.py b/bitsandbytes/__init__.py index 512fd2455..e7eb6af6f 100644 --- a/bitsandbytes/__init__.py +++ b/bitsandbytes/__init__.py @@ -17,7 +17,9 @@ if COMPILED_WITH_CUDA: from .optim import adam - + from .backends import register_backend, backends + from .backends.cuda import CUDABackend + register_backend("cuda", CUDABackend()) __pdoc__ = { "libbitsandbytes": False, "optim.optimizer.Optimizer8bit": False, diff --git a/bitsandbytes/backends/__init__.py b/bitsandbytes/backends/__init__.py index 0ae01a3d3..015b719cc 100644 --- a/bitsandbytes/backends/__init__.py +++ b/bitsandbytes/backends/__init__.py @@ -1,14 +1,9 @@ from typing import Dict import torch -from bitsandbytes.cextension import COMPILED_WITH_CUDA from bitsandbytes.backends.base import Backend backends: Dict[str, Backend] = {} def register_backend(backend_name: str, backend_instance: Backend): backends[backend_name.lower()] = backend_instance - -if COMPILED_WITH_CUDA: - from .cuda import CUDABackend - register_backend("cuda", CUDABackend())