TimDettmers / bitsandbytes

Accessible large language models via k-bit quantization for PyTorch.

Home Page:https://huggingface.co/docs/bitsandbytes/main/en/index

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NameError: name 'str2optimizer32bit' is not defined

Sakurakdx opened this issue · comments

I encountered the following problems when running bitsandbytes

WARNING: BNB_CUDA_VERSION=118 environment variable detected; loading libbitsandbytes_cuda118_nocublaslt118.so.
This can be used to load a bitsandbytes version that is different from the PyTorch CUDA version.
If this was unintended set the BNB_CUDA_VERSION variable to an empty string: export BNB_CUDA_VERSION=
If you use the manual override make sure the right libcudart.so is in your LD_LIBRARY_PATH
For example by adding the following to your .bashrc: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path_to_cuda_dir/lib64

Could not find the bitsandbytes CUDA binary at PosixPath('/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/libbitsandbytes_cuda118_nocublaslt118.so')
Could not load bitsandbytes native library: /data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/libbitsandbytes_cpu.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/cextension.py", line 109, in <module>
    lib = get_native_library()
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/cextension.py", line 96, in get_native_library
    dll = ct.cdll.LoadLibrary(str(binary_path))
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/libbitsandbytes_cpu.so: cannot open shared object file: No such file or directory

CUDA Setup failed despite CUDA being available. Please run the following command to get more information:

python -m bitsandbytes

Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
and open an issue at: https://github.com/TimDettmers/bitsandbytes/issues

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++ BUG REPORT INFORMATION ++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++
CUDA specs: CUDASpecs(highest_compute_capability=(7, 0), cuda_version_string='118', cuda_version_tuple=(11, 8))
PyTorch settings found: CUDA_VERSION=118, Highest Compute Capability: (7, 0).
WARNING: BNB_CUDA_VERSION=118 environment variable detected; loading libbitsandbytes_cuda118_nocublaslt118.so.
This can be used to load a bitsandbytes version that is different from the PyTorch CUDA version.
If this was unintended set the BNB_CUDA_VERSION variable to an empty string: export BNB_CUDA_VERSION=
If you use the manual override make sure the right libcudart.so is in your LD_LIBRARY_PATH
For example by adding the following to your .bashrc: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path_to_cuda_dir/lib64

Library not found: /data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/libbitsandbytes_cuda118_nocublaslt118.so. Maybe you need to compile it from source?
If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION`,
for example, `make CUDA_VERSION=113`.

The CUDA version for the compile might depend on your conda install, if using conda.
Inspect CUDA version via `conda list | grep cuda`.
To manually override the PyTorch CUDA version please see: https://github.com/TimDettmers/bitsandbytes/blob/main/docs/source/nonpytorchcuda.mdx
WARNING: Compute capability < 7.5 detected! Only slow 8-bit matmul is supported for your GPU!
If you run into issues with 8-bit matmul, you can try 4-bit quantization:
https://huggingface.co/blog/4bit-transformers-bitsandbytes
The directory listed in your path is found to be non-existent: //10.10.80.229
The directory listed in your path is found to be non-existent: //10.10.80.229
Found duplicate CUDA runtime files (see below).

We select the PyTorch default CUDA runtime, which is 11.8,
but this might mismatch with the CUDA version that is needed for bitsandbytes.
To override this behavior set the `BNB_CUDA_VERSION=<version string, e.g. 122>` environmental variable.

For example, if you want to use the CUDA version 122,
    BNB_CUDA_VERSION=122 python ...

OR set the environmental variable in your .bashrc:
    export BNB_CUDA_VERSION=122

In the case of a manual override, make sure you set LD_LIBRARY_PATH, e.g.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.2,
* Found CUDA runtime at: /data/kdx/soft/cuda-11.8/lib64/libcudart.so
* Found CUDA runtime at: /data/kdx/soft/cuda-11.8/lib64/libcudart.so.11.8.89
* Found CUDA runtime at: /data/kdx/soft/cuda-11.8/lib64/libcudart.so.11.0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++ DEBUG INFO END ++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Checking that the library is importable and CUDA is callable...
Couldn't load the bitsandbytes library, likely due to missing binaries.
Please ensure bitsandbytes is properly installed.

For source installations, compile the binaries with `cmake -DCOMPUTE_BACKEND=cuda -S .`.
See the documentation for more details if needed.

Trying a simple check anyway, but this will likely fail...
Traceback (most recent call last):
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/diagnostics/main.py", line 66, in main
    sanity_check()
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/diagnostics/main.py", line 40, in sanity_check
    adam.step()
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/torch/optim/optimizer.py", line 373, in wrapper
    out = func(*args, **kwargs)
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/optim/optimizer.py", line 287, in step
    self.update_step(group, p, gindex, pindex)
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/optim/optimizer.py", line 496, in update_step
    F.optimizer_update_32bit(
  File "/data/kdx/soft/anaconda3/envs/kk1/lib/python3.10/site-packages/bitsandbytes-0.43.2.dev0-py3.10-linux-x86_64.egg/bitsandbytes/functional.py", line 1584, in optimizer_update_32bit
    optim_func = str2optimizer32bit[optimizer_name][0]
NameError: name 'str2optimizer32bit' is not defined
Above we output some debug information.
Please provide this info when creating an issue via https://github.com/TimDettmers/bitsandbytes/issues/new/choose
WARNING: Please be sure to sanitize sensitive info from the output before posting it.

Nvcc information

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

When installing from the source code repository as recommended and specifying CUDA_VERSION, this message was prompted

make: *** No rule to make target `cuda11x_nomatmul'.  Stop.