Skip to content

Commit 7a3c9af

Browse files
committed
Sort imports
Via isort
1 parent 0b07840 commit 7a3c9af

File tree

11 files changed

+28
-21
lines changed

11 files changed

+28
-21
lines changed

bitsandbytes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6+
from . import cuda_setup, utils
67
from .autograd._functions import (
78
MatmulLtState,
89
bmm_cublas,
@@ -12,7 +13,6 @@
1213
)
1314
from .cextension import COMPILED_WITH_CUDA
1415
from .nn import modules
15-
from . import cuda_setup, utils
1616

1717
if COMPILED_WITH_CUDA:
1818
from .optim import adam

bitsandbytes/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def print_debug_info() -> None:
2828

2929

3030
from . import COMPILED_WITH_CUDA, PACKAGE_GITHUB_URL
31-
from .cuda_setup.main import get_compute_capabilities, get_cuda_lib_handle
3231
from .cuda_setup.env_vars import to_be_ignored
32+
from .cuda_setup.main import get_compute_capabilities, get_cuda_lib_handle
3333

3434
print_header("POTENTIALLY LIBRARY-PATH-LIKE ENV VARS")
3535
for k, v in os.environ.items():

bitsandbytes/autograd/_functions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import operator
22
import warnings
3+
from dataclasses import dataclass
4+
from functools import reduce # Required in Python 3
35

46
import torch
7+
58
import bitsandbytes.functional as F
69

7-
from dataclasses import dataclass
8-
from functools import reduce # Required in Python 3
910

1011
# math.prod not compatible with python < 3.8
1112
def prod(iterable):

bitsandbytes/cextension.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import ctypes as ct
2-
import torch
3-
42
from pathlib import Path
53
from warnings import warn
64

5+
import torch
6+
77

88
class CUDASetup:
99
_instance = None
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
from .paths import CUDA_RUNTIME_LIB, extract_candidate_paths, determine_cuda_runtime_lib_path
21
from .main import evaluate_cuda_setup
2+
from .paths import (
3+
CUDA_RUNTIME_LIB,
4+
determine_cuda_runtime_lib_path,
5+
extract_candidate_paths,
6+
)

bitsandbytes/cuda_setup/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
import ctypes
2020

21-
from .paths import determine_cuda_runtime_lib_path
2221
from bitsandbytes.cextension import CUDASetup
2322

23+
from .paths import determine_cuda_runtime_lib_path
24+
2425

2526
def check_cuda_result(cuda, result_val):
2627
# 3. Check for CUDA errors

bitsandbytes/cuda_setup/paths.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import errno
22
from pathlib import Path
33
from typing import Set, Union
4+
45
from bitsandbytes.cextension import CUDASetup
56

67
from .env_vars import get_potentially_lib_path_containing_env_vars

bitsandbytes/functional.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
import ctypes as ct
66
import operator
77
import random
8-
import torch
9-
8+
from functools import reduce # Required in Python 3
109
from typing import Tuple
10+
11+
import torch
1112
from torch import Tensor
1213

1314
from .cextension import COMPILED_WITH_CUDA, lib
14-
from functools import reduce # Required in Python 3
15+
1516

1617
# math.prod not compatible with python < 3.8
1718
def prod(iterable):

bitsandbytes/optim/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55

66
from bitsandbytes.cextension import COMPILED_WITH_CUDA
77

8+
from .adagrad import Adagrad, Adagrad8bit, Adagrad32bit
89
from .adam import Adam, Adam8bit, Adam32bit
910
from .adamw import AdamW, AdamW8bit, AdamW32bit
10-
from .sgd import SGD, SGD8bit, SGD32bit
11-
from .lars import LARS, LARS8bit, LARS32bit, PytorchLARS
1211
from .lamb import LAMB, LAMB8bit, LAMB32bit
13-
from .rmsprop import RMSprop, RMSprop8bit, RMSprop32bit
14-
from .adagrad import Adagrad, Adagrad8bit, Adagrad32bit
15-
12+
from .lars import LARS, LARS8bit, LARS32bit, PytorchLARS
1613
from .optimizer import GlobalOptimManager
14+
from .rmsprop import RMSprop, RMSprop8bit, RMSprop32bit
15+
from .sgd import SGD, SGD8bit, SGD32bit

tests/test_autograd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from itertools import product, permutations
1+
from itertools import permutations, product
22

33
import pytest
44
import torch

0 commit comments

Comments
 (0)