Sort imports

Via isort
This commit is contained in:
Tom Aarsen 2022-10-27 13:15:21 +02:00
parent 0b078403ee
commit 7a3c9af05d
11 changed files with 30 additions and 23 deletions

View File

@ -3,6 +3,7 @@
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
from . import cuda_setup, utils
from .autograd._functions import ( from .autograd._functions import (
MatmulLtState, MatmulLtState,
bmm_cublas, bmm_cublas,
@ -12,7 +13,6 @@ from .autograd._functions import (
) )
from .cextension import COMPILED_WITH_CUDA from .cextension import COMPILED_WITH_CUDA
from .nn import modules from .nn import modules
from . import cuda_setup, utils
if COMPILED_WITH_CUDA: if COMPILED_WITH_CUDA:
from .optim import adam from .optim import adam

View File

@ -28,8 +28,8 @@ print()
from . import COMPILED_WITH_CUDA, PACKAGE_GITHUB_URL from . import COMPILED_WITH_CUDA, PACKAGE_GITHUB_URL
from .cuda_setup.main import get_compute_capabilities, get_cuda_lib_handle
from .cuda_setup.env_vars import to_be_ignored from .cuda_setup.env_vars import to_be_ignored
from .cuda_setup.main import get_compute_capabilities, get_cuda_lib_handle
print_header("POTENTIALLY LIBRARY-PATH-LIKE ENV VARS") print_header("POTENTIALLY LIBRARY-PATH-LIKE ENV VARS")
for k, v in os.environ.items(): for k, v in os.environ.items():

View File

@ -1,12 +1,13 @@
import operator import operator
import warnings import warnings
import torch
import bitsandbytes.functional as F
from dataclasses import dataclass from dataclasses import dataclass
from functools import reduce # Required in Python 3 from functools import reduce # Required in Python 3
import torch
import bitsandbytes.functional as F
# math.prod not compatible with python < 3.8 # math.prod not compatible with python < 3.8
def prod(iterable): def prod(iterable):
return reduce(operator.mul, iterable, 1) return reduce(operator.mul, iterable, 1)

View File

@ -1,9 +1,9 @@
import ctypes as ct import ctypes as ct
import torch
from pathlib import Path from pathlib import Path
from warnings import warn from warnings import warn
import torch
class CUDASetup: class CUDASetup:
_instance = None _instance = None

View File

@ -1,2 +1,6 @@
from .paths import CUDA_RUNTIME_LIB, extract_candidate_paths, determine_cuda_runtime_lib_path
from .main import evaluate_cuda_setup from .main import evaluate_cuda_setup
from .paths import (
CUDA_RUNTIME_LIB,
determine_cuda_runtime_lib_path,
extract_candidate_paths,
)

View File

@ -18,9 +18,10 @@ evaluation:
import ctypes import ctypes
from .paths import determine_cuda_runtime_lib_path
from bitsandbytes.cextension import CUDASetup from bitsandbytes.cextension import CUDASetup
from .paths import determine_cuda_runtime_lib_path
def check_cuda_result(cuda, result_val): def check_cuda_result(cuda, result_val):
# 3. Check for CUDA errors # 3. Check for CUDA errors

View File

@ -1,6 +1,7 @@
import errno import errno
from pathlib import Path from pathlib import Path
from typing import Set, Union from typing import Set, Union
from bitsandbytes.cextension import CUDASetup from bitsandbytes.cextension import CUDASetup
from .env_vars import get_potentially_lib_path_containing_env_vars from .env_vars import get_potentially_lib_path_containing_env_vars

View File

@ -5,13 +5,14 @@
import ctypes as ct import ctypes as ct
import operator import operator
import random import random
import torch from functools import reduce # Required in Python 3
from typing import Tuple from typing import Tuple
import torch
from torch import Tensor from torch import Tensor
from .cextension import COMPILED_WITH_CUDA, lib from .cextension import COMPILED_WITH_CUDA, lib
from functools import reduce # Required in Python 3
# math.prod not compatible with python < 3.8 # math.prod not compatible with python < 3.8
def prod(iterable): def prod(iterable):

View File

@ -5,12 +5,11 @@
from bitsandbytes.cextension import COMPILED_WITH_CUDA from bitsandbytes.cextension import COMPILED_WITH_CUDA
from .adagrad import Adagrad, Adagrad8bit, Adagrad32bit
from .adam import Adam, Adam8bit, Adam32bit from .adam import Adam, Adam8bit, Adam32bit
from .adamw import AdamW, AdamW8bit, AdamW32bit from .adamw import AdamW, AdamW8bit, AdamW32bit
from .sgd import SGD, SGD8bit, SGD32bit
from .lars import LARS, LARS8bit, LARS32bit, PytorchLARS
from .lamb import LAMB, LAMB8bit, LAMB32bit from .lamb import LAMB, LAMB8bit, LAMB32bit
from .rmsprop import RMSprop, RMSprop8bit, RMSprop32bit from .lars import LARS, LARS8bit, LARS32bit, PytorchLARS
from .adagrad import Adagrad, Adagrad8bit, Adagrad32bit
from .optimizer import GlobalOptimManager from .optimizer import GlobalOptimManager
from .rmsprop import RMSprop, RMSprop8bit, RMSprop32bit
from .sgd import SGD, SGD8bit, SGD32bit

View File

@ -1,4 +1,4 @@
from itertools import product, permutations from itertools import permutations, product
import pytest import pytest
import torch import torch

View File

@ -1,13 +1,13 @@
import os import os
import pytest
import bitsandbytes as bnb
from typing import List, NamedTuple from typing import List, NamedTuple
import pytest
import bitsandbytes as bnb
from bitsandbytes.cuda_setup import ( from bitsandbytes.cuda_setup import (
CUDA_RUNTIME_LIB, CUDA_RUNTIME_LIB,
evaluate_cuda_setup,
determine_cuda_runtime_lib_path, determine_cuda_runtime_lib_path,
evaluate_cuda_setup,
extract_candidate_paths, extract_candidate_paths,
) )