bitsandbytes-foundation / bitsandbytes

Accessible large language models via k-bit quantization for PyTorch.
https://huggingface.co/docs/bitsandbytes/main/en/index
MIT License
6.04k stars 607 forks source link

bitsandbytes cannot find CUDA and GPU #533

Closed 2catycm closed 8 months ago

2catycm commented 1 year ago

Steps to Reproduce

> # use apt to install the following
> # cuda/unknown,now 12.1.0-1 amd64
> # libcudnn8-dev/unknown,now 8.9.0.131-1+cuda12.1 amd64 
> # tensorrt-dev/unknown 8.6.0.12-1+cuda12.0 amd64

> conda create -n my_env python=3.10
> conda activate my_env
> conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

> git clone https://github.com/timdettmers/bitsandbytes.git
> cd bitsandbytes
> CUDA_VERSION=120 make cuda12x
> CUDA_VERSION=120 python setup.py install
> python -m bitsandbytes                                                                                                                                   

===================================BUG REPORT===================================                                                                           
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues                            
================================================================================                                                                           
/data/users/yecanming/download/bitsandbytes/bitsandbytes/cuda_setup/main.py:136: UserWarning: /data/users/yecanming/P_MedicalScreening/Huatuo-Llama-Med-Chi
nese/.conda did not contain libcudart.so as expected! Searching further paths...                                                                           
  warn(msg)                                                                                                                                                
CUDA SETUP: WARNING! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!
CUDA SETUP: CUDA runtime path found: /usr/local/cuda-12.1/lib64/libcudart.so
/data/users/yecanming/download/bitsandbytes/bitsandbytes/cuda_setup/main.py:136: UserWarning: WARNING: No GPU detected! Check your CUDA paths. Proceeding t
o load CPU-only library...
  warn(msg)
CUDA SETUP: Required library version not found: libbitsandbytes_cpu.so. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes_cpu.so...

My Env

Hardware: 4x NVIDIA 2080Ti GPU

Software Environment:

  1. Pytorch
    
    > python -m torch.utils.collect_env                                                                                                                        
    Collecting environment information...                                                                                                                      
    PyTorch version: 2.0.1                                                                                                                                     
    Is debug build: False                                                                                                                                      
    CUDA used to build PyTorch: 11.8                                                                                                                           
    ROCM used to build PyTorch: N/A                                                                                                                            

OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
Clang version: Could not collect
CMake version: version 3.25.0
Libc version: glibc-2.35

Python version: 3.10.11 (main, May 16 2023, 00:28:57) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.15.0-73-generic-x86_64-with-glibc2.35 Is CUDA available: True CUDA runtime version: 12.1.66 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2080 GPU 1: NVIDIA GeForce RTX 2080 GPU 2: NVIDIA GeForce RTX 2080 GPU 3: NVIDIA GeForce RTX 2080

Nvidia driver version: 530.30.02
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.0
HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz CPU family: 6 Model: 85 Thread(s) per core: 2 Core(s) per socket: 8 Socket(s): 2 Stepping: 4 CPU(s) scaling MHz: 29% CPU max MHz: 3000.0000 CPU min MHz: 800.0000 BogoMIPS: 4200.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe sy scall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowpref etch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d arch_capabilities Virtualization: VT-x L1d cache: 512 KiB (16 instances) L1i cache: 512 KiB (16 instances) L2 cache: 16 MiB (16 instances) L3 cache: 22 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-7,16-23 NUMA node1 CPU(s): 8-15,24-31 Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Meltdown: Mitigation; PTI Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Retbleed: Mitigation; IBRS Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable Versions of relevant libraries: [pip3] mypy-extensions==1.0.0 [pip3] numpy==1.24.3 [pip3] torch==2.0.1 [pip3] torchaudio==2.0.2 [pip3] torchvision==0.15.2 [conda] blas 1.0 mkl defaults [conda] ffmpeg 4.3 hf484d3e_0 pytorch [conda] mkl 2023.1.0 h6d00ec8_46342 defaults [conda] mkl-service 2.4.0 py310h5eee18b_1 defaults [conda] mkl_fft 1.3.6 py310h1128e8f_1 defaults [conda] mkl_random 1.2.2 py310h1128e8f_1 defaults [conda] numpy 1.24.3 py310h5f9d8c6_1 defaults [conda] numpy-base 1.24.3 py310hb5e798b_1 defaults [conda] pytorch 2.0.1 py3.10_cuda11.8_cudnn8.7.0_0 pytorch [conda] pytorch-cuda 11.8 h7e8668a_5 pytorch [conda] pytorch-mutex 1.0 cuda pytorch [conda] torchaudio 2.0.2 py310_cu118 pytorch [conda] torchtriton 2.0.0 py310 pytorch [conda] torchvision 0.15.2 py310_cu118 pytorch

2. Bash enviroment:
bashrc:
```bash
export CUDA_HOME=/usr/local/cuda-12.1/
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64
> ll $CUDA_HOME
total 92K
drwxr-xr-x 3 root root 4.0K Apr 16 11:28 bin
drwxr-xr-x 5 root root 4.0K Apr 16 11:27 compute-sanitizer
drwxr-xr-x 3 root root   17 Apr 16 11:27 doc
-rw-r--r-- 1 root root  160 Jan 25 11:36 DOCS
-rw-r--r-- 1 root root  61K Jan 25 11:36 EULA.txt
drwxr-xr-x 5 root root   53 Apr 16 11:28 extras
drwxr-xr-x 4 root root   83 Apr 16 11:28 gds
lrwxrwxrwx 1 root root   28 Jan 25 12:01 include -> targets/x86_64-linux/include
lrwxrwxrwx 1 root root   24 Jan 25 12:08 lib64 -> targets/x86_64-linux/lib
drwxr-xr-x 7 root root 4.0K Apr 16 11:28 libnvvp
drwxr-xr-x 2 root root   53 Apr 16 11:28 nsightee_plugins
drwxr-xr-x 3 root root   21 Apr 16 11:28 nvml
drwxr-xr-x 7 root root   85 Apr 16 11:28 nvvm
-rw-r--r-- 1 root root  524 Jan 25 11:36 README
lrwxrwxrwx 1 root root   24 Jan 25 12:16 res -> targets/x86_64-linux/res
drwxr-xr-x 3 root root   17 Apr 16 11:27 share
drwxr-xr-x 2 root root 4.0K Apr 16 11:27 src
drwxr-xr-x 3 root root   26 Apr 16 11:24 targets
drwxr-xr-x 2 root root   43 Apr 16 11:28 tools
-rw-r--r-- 1 root root 3.1K Feb 24 01:28 version.json
Quan-w commented 1 year ago

同样的问题我的是2.00+cuda11.8

TimDettmers commented 1 year ago

Can you run nvidia-smi and python -m bitsandbytes and report it here. This will help to debug this.

2catycm commented 1 year ago

Can you run nvidia-smi and python -m bitsandbytes and report it here. This will help to debug this.

> nvidia-smi
Sun Jul 16 18:49:35 2023       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 2080         On | 00000000:18:00.0 Off |                  N/A |
| 38%   36C    P8               19W / 215W|      1MiB /  8192MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   1  NVIDIA GeForce RTX 2080         On | 00000000:3B:00.0 Off |                  N/A |
| 36%   29C    P8               21W / 215W|      1MiB /  8192MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   2  NVIDIA GeForce RTX 2080         On | 00000000:86:00.0 Off |                  N/A |
| 36%   27C    P8               11W / 215W|      1MiB /  8192MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
|   3  NVIDIA GeForce RTX 2080         On | 00000000:AF:00.0 Off |                  N/A |
| 37%   27C    P8                1W / 215W|      1MiB /  8192MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+
> python -m bitsandbytes                                                                                                                                   

===================================BUG REPORT===================================                                                                           
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues                            
================================================================================                                                                           
/data/users/yecanming/download/bitsandbytes/bitsandbytes/cuda_setup/main.py:136: UserWarning: /data/users/yecanming/P_MedicalScreening/Huatuo-Llama-Med-Chi
nese/.conda did not contain libcudart.so as expected! Searching further paths...                                                                           
  warn(msg)                                                                                                                                                
CUDA SETUP: WARNING! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!
CUDA SETUP: CUDA runtime path found: /usr/local/cuda-12.1/lib64/libcudart.so
/data/users/yecanming/download/bitsandbytes/bitsandbytes/cuda_setup/main.py:136: UserWarning: WARNING: No GPU detected! Check your CUDA paths. Proceeding t
o load CPU-only library...
  warn(msg)
CUDA SETUP: Required library version not found: libbitsandbytes_cpu.so. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes_cpu.so...
Ar770 commented 1 year ago

@TimDettmers Please see here: #538

swumagic commented 10 months ago

Bitsandbytes was not supported windows before, but my method can support windows.(yuhuang) 1 open folder J:\StableDiffusion\sdwebui,Click the address bar of the folder and enter CMD or WIN+R, CMD 。enter,cd /d J:\StableDiffusion\sdwebui 2 J:\StableDiffusion\sdwebui\py310\python.exe -m pip uninstall bitsandbytes

3 J:\StableDiffusion\sdwebui\py310\python.exe -m pip uninstall bitsandbytes-windows

4 J:\StableDiffusion\sdwebui\py310\python.exe -m pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.1-py3-none-win_amd64.whl

Replace your SD venv directory file(python.exe Folder) here(J:\StableDiffusion\sdwebui\py310)

swumagic commented 10 months ago

OR you are Linux distribution (Ubuntu, MacOS, etc.)system ,AND CUDA Version: 11.X.

Bitsandbytes can support ubuntu.(yuhuang) 1 open folder J:\StableDiffusion\sdwebui,Click the address bar of the folder and enter CMD or WIN+R, CMD 。enter,cd /d J:\StableDiffusion\sdwebui 2 J:\StableDiffusion\sdwebui\py310\python.exe -m pip uninstall bitsandbytes

3 J:\StableDiffusion\sdwebui\py310\python.exe -m pip uninstall bitsandbytes-windows

4 J:\StableDiffusion\sdwebui\py310\python.exe -m pip install https://github.com/TimDettmers/bitsandbytes/releases/download/0.41.0/bitsandbytes-0.41.0-py3-none-any.whl

Replace your SD venv directory file(python.exe Folder) here(J:\StableDiffusion\sdwebui\py310)

github-actions[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.