Closed flysaurus closed 8 months ago
Hey @flysaurus Thanks for raising this.
Unfortunately, we don't provide official Windows support yet. Though there is an unofficial Windows fork and we're working to integrate it in our current cross-platform effort. The official support might still take a while though.
We need to add to the documentation a disclaimer that Windows or Mac is not supported.
Where would you think that would be best placed other than our own docs? Probably in the HF docs and when a mention in the issue template would be good.
@wkpark Do you think there is an easy way to add an descriptive error in setup.py when detecting Windows?
@wkpark Do you think there is an easy way to add an descriptive error in setup.py when detecting Windows?
the current wheel file is "bitsandbytes-0.42.0-py3-none-any.whl"
so any platform can install it, (in cmake PR, add ext_modules=[Extension("bitsandbytes", sources=[], language="c")],
option to setup()
call will make platform dependent wheel. https://github.com/TimDettmers/bitsandbytes/pull/908/commits/9d653518fc616e215433d30015011f5c3432ccf0#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7R39 as bitsandbytes-0.42.0-cp310-cp310-win_amd64.whl
(Please see also https://github.com/TimDettmers/bitsandbytes/pull/876 (this is a minimal windows fix))
and, current main branch has dll lib detection for windows, the following warning message will be printed
>python -m bitsandbytes
False
===================================BUG REPORT===================================
F:\webui\webui\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cuda_setup\main.py:177: UserWarning: Welcome to bitsandbytes. For bug reports, please run
python -m bitsandbytes
warn(msg)
================================================================================
The following directories listed in your path were found to be non-existent: {WindowsPath('F:/CUDA/v10.0')}
The following directories listed in your path were found to be non-existent: {WindowsPath('F:/CUDA/v8.0')}
The following directories listed in your path were found to be non-existent: {WindowsPath('F:/CUDA/v9.0')}
The following directories listed in your path were found to be non-existent: {WindowsPath('F:/CUDA/v9.2')}
The following directories listed in your path were found to be non-existent: {WindowsPath('/Users/WK')}
The following directories listed in your path were found to be non-existent: {WindowsPath('/DESKTOP-HEAVEN')}
The following directories listed in your path were found to be non-existent: {WindowsPath('F:/CUDA/v8.0')}
The following directories listed in your path were found to be non-existent: {WindowsPath('F:/CUDA/v9.0')}
The following directories listed in your path were found to be non-existent: {WindowsPath('F:/OpenSSL-Win64/bin/openssl.cfg')}
The following directories listed in your path were found to be non-existent: {WindowsPath('10.0.20348.0')}
The following directories listed in your path were found to be non-existent: {WindowsPath('10.0.20348.0')}
The following directories listed in your path were found to be non-existent: {WindowsPath('C:/Users/WK/go/bin'), WindowsPath('C:/Users/WK/mambaforge/Library/usr/bin'), WindowsPath('F:/CUDA/v9.0/libnvvp'), WindowsPath('C:/Program Files (x86)/Microsoft SDKs/TypeScript/1.0'), WindowsPath('C:/Program Files (x86)/ePapyrus/Papyrus-PlugIn-web'), WindowsPath('F:/CUDA/v10.0/bin'), WindowsPath('F:/CUDA/nasm-2.13.01'), WindowsPath('C:/Users/WK/AppData/Roaming/npm'), WindowsPath('C:/Program Files (x86)/ePapyrus/Papyrus-PlugIn-web/Addins'), WindowsPath('C:/Program Files (x86)/AMD/ATI.ACE/Core-Static'), WindowsPath('F:/CUDA/v9.0/bin'), WindowsPath('C:/Users/WK/mambaforge/Library/mingw-w64/bin'), WindowsPath('F:/CUDA/v10.0/libnvvp')}
The following directories listed in your path were found to be non-existent: {WindowsPath('C:/Users/WK/go/bin'), WindowsPath('C:/Users/WK/mambaforge/Library/usr/bin'), WindowsPath('F:/CUDA/v9.0/libnvvp'), WindowsPath('C:/Program Files (x86)/Microsoft SDKs/TypeScript/1.0'), WindowsPath('C:/Program Files (x86)/ePapyrus/Papyrus-PlugIn-web'), WindowsPath('F:/CUDA/v10.0/bin'), WindowsPath('F:/CUDA/nasm-2.13.01'), WindowsPath('C:/Users/WK/AppData/Roaming/npm'), WindowsPath('C:/Program Files (x86)/ePapyrus/Papyrus-PlugIn-web/Addins'), WindowsPath('C:/Program Files (x86)/AMD/ATI.ACE/Core-Static'), WindowsPath('F:/CUDA/v9.0/bin'), WindowsPath('C:/Users/WK/mambaforge/Library/mingw-w64/bin'), WindowsPath('F:/CUDA/v10.0/libnvvp')}
The following directories listed in your path were found to be non-existent: {WindowsPath('C:/Users/WK/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0/LocalCache/local-packages')}
DEBUG: Possible options found for libcudart.so: {WindowsPath('C:/WINDOWS/system32/nvcuda.dll')}
CUDA SETUP: PyTorch settings found: CUDA_VERSION=118, Highest Compute Capability: 8.9.
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: Required library version not found: libbitsandbytes_cuda118.dll. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes_cpu.dll...
================================================ERROR=====================================
CUDA SETUP: CUDA detection failed! Possible reasons:
1. You need to manually override the PyTorch CUDA version. Please see: "https://github.com/TimDettmers/bitsandbytes/blob/main/how_to_use_nonpytorch_cuda.md
2. CUDA driver not installed
3. CUDA not installed
4. You have multiple conflicting CUDA libraries
5. Required library not pre-compiled for this bitsandbytes release!
CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.
CUDA SETUP: The CUDA version for the compile might depend on your conda install. Inspect CUDA version via `conda list | grep cuda`.
================================================================================
CUDA SETUP: Something unexpected happened. Please compile from source:
git clone https://github.com/TimDettmers/bitsandbytes.git
cd bitsandbytes
CUDA_VERSION=118 make cuda11x
python setup.py install
CUDA SETUP: Setup Failed!
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 146, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 110, in _get_module_details
__import__(pkg_name)
File "F:\webui\webui\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\__init__.py", line 6, in <module>
from . import cuda_setup, utils, research
File "F:\webui\webui\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\research\__init__.py", line 1, in <module>
from . import nn
File "F:\webui\webui\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\research\nn\__init__.py", line 1, in <module>
from .modules import LinearFP8Mixed, LinearFP8Global
File "F:\webui\webui\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\research\nn\modules.py", line 8, in <module>
from bitsandbytes.optim import GlobalOptimManager
File "F:\webui\webui\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\optim\__init__.py", line 6, in <module>
from bitsandbytes.cextension import COMPILED_WITH_CUDA
File "F:\webui\webui\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\cextension.py", line 20, in <module>
raise RuntimeError('''
RuntimeError:
CUDA Setup failed despite GPU 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
System Info
Windows 10, Python 3.9.4, GPU Geforce RTX 2060
Reproduction
import os import torch
General packages
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from textwrap import fill from IPython.display import Markdown, display # for formating Python display folowing markdown language import warnings warnings.filterwarnings('ignore') # avoid warning messages importing packages
Mistral and LangChain packages (prompt engineering)
import torch from langchain import PromptTemplate, HuggingFacePipeline from langchain.output_parsers import ResponseSchema, StructuredOutputParser from transformers import BitsAndBytesConfig, AutoModelForCausalLM, AutoTokenizer, GenerationConfig, pipeline
Model version of Mistral
MODEL_NAME = "mistralai/Mistral-7B-Instruct-v0.1"
quantization_config = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_compute_dtype=torch.float16, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True, )
################### BELOW CELL ERRORS OUT #######################
Initialization of a tokenizer for the Mistral-7b model,
necessary to preprocess text data for input
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, use_fast=True) tokenizer.pad_token = tokenizer.eos_token
Initialization of the pre-trained language Mistral-7b
model = AutoModelForCausalLM.from_pretrained( MODEL_NAME, torch_dtype=torch.float16, trust_remote_code=True, device_map="auto", quantization_config=quantization_config )
################### ERROR OUTPUT ############################# False
===================================BUG REPORT===================================
The following directories listed in your path were found to be non-existent: {WindowsPath('/matplotlib_inline.backend_inline'), WindowsPath('module')} The following directories listed in your path were found to be non-existent: {WindowsPath('vs/workbench/api/node/extensionHostProcess')} 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=121, Highest Compute Capability: 7.5. 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 f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda121.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://raw.githubusercontent.com/TimDettmers/bitsandbytes/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 f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes\cuda_setup\main.py:167: UserWarning: Welcome to bitsandbytes. For bug reports, please run
python -m bitsandbytes
warn(msg) Traceback (most recent call last): File "C:\Python39\lib\runpy.py", line 188, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "C:\Python39\lib\runpy.py", line 147, in _get_module_details return _get_module_details(pkg_main_name, error) File "C:\Python39\lib\runpy.py", line 111, in _get_module_details import(pkg_name) File "f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes__init__.py", line 6, in
from . import cuda_setup, utils, research
File "f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes\research__init.py", line 1, in
from . import nn
File "f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes\research\nn\ init.py", line 1, in
from .modules import LinearFP8Mixed, LinearFP8Global
File "f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes\research\nn\modules.py", line 8, in
from bitsandbytes.optim import GlobalOptimManager
File "f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes\optim\ init__.py", line 6, in
from bitsandbytes.cextension import COMPILED_WITH_CUDA
File "f:\0.MilindPython\Mistral.venv\lib\site-packages\bitsandbytes\cextension.py", line 20, in
raise RuntimeError('''
RuntimeError:
CUDA Setup failed despite GPU being available. Please run the following command to get more information:
python -m bitsandbytes RETURNS THE SAME ABOVE OUTPUT
Expected behavior
Tokenizer initialized