From d270832cb16c8d83d4a312bc569f8ae03b6cb2b3 Mon Sep 17 00:00:00 2001 From: jianan-gu Date: Mon, 12 Feb 2024 19:33:30 -0800 Subject: [PATCH] fix CI python format --- bitsandbytes/__init__.py | 2 +- bitsandbytes/backends/__init__.py | 1 + bitsandbytes/backends/cuda.py | 1 - bitsandbytes/functional.py | 10 ++++------ bitsandbytes/utils.py | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bitsandbytes/__init__.py b/bitsandbytes/__init__.py index 3f0db3536..c42b4a274 100644 --- a/bitsandbytes/__init__.py +++ b/bitsandbytes/__init__.py @@ -16,9 +16,9 @@ from .nn import modules if COMPILED_WITH_CUDA: - from .optim import adam from .backends import register_backend from .backends.cuda import CUDABackend + from .optim import adam register_backend("cuda", CUDABackend()) __pdoc__ = { "libbitsandbytes": False, diff --git a/bitsandbytes/backends/__init__.py b/bitsandbytes/backends/__init__.py index 015b719cc..3a33d24ca 100644 --- a/bitsandbytes/backends/__init__.py +++ b/bitsandbytes/backends/__init__.py @@ -1,4 +1,5 @@ from typing import Dict + import torch from bitsandbytes.backends.base import Backend diff --git a/bitsandbytes/backends/cuda.py b/bitsandbytes/backends/cuda.py index 248d1e4c1..6ba02d009 100644 --- a/bitsandbytes/backends/cuda.py +++ b/bitsandbytes/backends/cuda.py @@ -19,7 +19,6 @@ prod, quantize_blockwise, ) - from bitsandbytes.utils import QuantState from .base import Backend diff --git a/bitsandbytes/functional.py b/bitsandbytes/functional.py index b75eac67e..9dbd5c1f0 100644 --- a/bitsandbytes/functional.py +++ b/bitsandbytes/functional.py @@ -6,19 +6,17 @@ from functools import reduce # Required in Python 3 import itertools import operator -from typing import Any, Dict, Optional, Tuple +from typing import Optional, Tuple import numpy as np import torch from torch import Tensor -from bitsandbytes.utils import pack_dict_to_tensor, unpack_tensor_to_dict +from bitsandbytes.backends import backends +from bitsandbytes.utils import QuantState from .cextension import COMPILED_WITH_CUDA, lib -from bitsandbytes.utils import QuantState - -from bitsandbytes.backends import backends # math.prod not compatible with python < 3.8 def prod(iterable): @@ -2064,4 +2062,4 @@ def extract_outliers(A, SA, idx): def pipeline_test(A, batch_size): out = torch.zeros_like(A) lib.cpipeline_test(get_ptr(A), get_ptr(out), ct.c_size_t(A.numel()), ct.c_size_t(batch_size)) - return out \ No newline at end of file + return out diff --git a/bitsandbytes/utils.py b/bitsandbytes/utils.py index 8c42ddfed..032bb31e5 100644 --- a/bitsandbytes/utils.py +++ b/bitsandbytes/utils.py @@ -1,7 +1,7 @@ import json import shlex import subprocess -from typing import Tuple, Dict, Any +from typing import Any, Dict, Tuple import torch