bitsandbytes icon indicating copy to clipboard operation
bitsandbytes copied to clipboard

You might need to add them to your LD_LIBRARY_PATH

Open AlexAuthor7 opened this issue 3 years ago • 7 comments

windows system

===================================BUG REPORT===================================

The following directories listed in your path were found to be non-existent: {WindowsPath('H')} The following directories listed in your path were found to be non-existent: {WindowsPath('vs/workbench/api/node/extensionHostProcess')} The following directories listed in your path were found to be non-existent: {WindowsPath('/matplotlib_inline.backend_inline'), WindowsPath('module')} CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching in backup paths... The following directories listed in your path were found to be non-existent: {WindowsPath('/usr/local/cuda/lib64')} DEBUG: Possible options found for libcudart.so: set() CUDA SETUP: PyTorch settings found: CUDA_VERSION=118, Highest Compute Capability: 8.6. CUDA SETUP: To manually override the PyTorch CUDA version please see:https://github.com/TimDettmers/bitsandbytes/blob/main/how_to_use_nonpytorch_cuda.md CUDA SETUP: Loading binary h:\Miniconda3\envs\chatGLM\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118.so... argument of type 'WindowsPath' is not iterable CUDA SETUP: Problem: The main issue seems to be that the main CUDA runtime library was not detected. CUDA SETUP: Solution 1: To solve the issue the libcudart.so location needs to be added to the LD_LIBRARY_PATH variable CUDA SETUP: Solution 1a): Find the cuda runtime library via: find / -name libcudart.so 2>/dev/null CUDA SETUP: Solution 1b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_1a CUDA SETUP: Solution 1c): For a permanent solution add the export from 1b into your .bashrc file, located at ~/.bashrc CUDA SETUP: Solution 2: If no library was found in step 1a) you need to install CUDA. CUDA SETUP: Solution 2a): Download CUDA install script: wget https://github.com/TimDettmers/bitsandbytes/blob/main/cuda_install.sh CUDA SETUP: Solution 2b): Install desired CUDA version to desired location. The syntax is bash cuda_install.sh CUDA_VERSION PATH_TO_INSTALL_INTO. CUDA SETUP: Solution 2b): For example, "bash cuda_install.sh 113 ~/local/" will download CUDA 11.3 and install into the folder ~/local Output exceeds the size limit. Open the full output data in a text editor

RuntimeError Traceback (most recent call last) Cell In[12], line 2 1 tokenizer = AutoTokenizer.from_pretrained("Baichuan2-7B-Chat-4bits", use_fast=False, trust_remote_code=True) ----> 2 model = AutoModelForCausalLM.from_pretrained("Baichuan2-7B-Chat-4bits", torch_dtype=torch.bfloat16, trust_remote_code=True) 3 model.generation_config = GenerationConfig.from_pretrained("Baichuan2-7B-Chat-4bits")

File h:\Miniconda3\envs\chatGLM\lib\site-packages\transformers\models\auto\auto_factory.py:479, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs) 475 model_class = get_class_from_dynamic_module( 476 class_ref, pretrained_model_name_or_path, **hub_kwargs, **kwargs 477 ) 478 _ = hub_kwargs.pop("code_revision", None) --> 479 return model_class.from_pretrained( 480 pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs 481 ) 482 elif type(config) in cls._model_mapping.keys(): 483 model_class = _get_model_class(config, cls._model_mapping)

File ~/.cache\huggingface\modules\transformers_modules\Baichuan2-7B-Chat-4bits\modeling_baichuan.py:596, in BaichuanForCausalLM.from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, *model_args, **kwargs) 594 if hasattr(config, "quantization_config") and config.quantization_config['load_in_4bit']: 595 try: --> 596 from .quantizer import init_model_weight_int4 597 from accelerate import init_empty_weights, dispatch_model, infer_auto_device_map 598 from accelerate.utils import CustomDtype ... 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

AlexAuthor7 avatar Sep 17 '23 07:09 AlexAuthor7

+1

YZBPXX avatar Sep 20 '23 10:09 YZBPXX

I had the same error in a jupyter notebook on a cloud provider and in the end the problem was a pre-installed but outdated torch version. Updating to the latest versions solved the issue for me:

%pip install torch==2.0.1
%pip install accelerate==0.23.0
%pip install transformers==4.33.2
%pip install bitsandbytes==0.41.1

sigma-andex avatar Sep 23 '23 06:09 sigma-andex

+1

zihaohe123 avatar Sep 28 '23 23:09 zihaohe123

@sigma-andex your solution also worked for me ! thanks!

boscoj2008 avatar Oct 05 '23 08:10 boscoj2008

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 avatar Nov 10 '23 06:11 swumagic

@sigma-andex your solution also worked for me ! thanks!

alterego238 avatar Nov 30 '23 13:11 alterego238

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.

github-actions[bot] avatar Dec 24 '23 15:12 github-actions[bot]