bitsandbytes-foundation / bitsandbytes

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

[BUG REPORT]CalledProcessError #555

Closed venshine closed 1 year ago

venshine commented 1 year ago
/home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:93: UserWarning: /home/venshine/miniconda3/envs/diffusion did not contain libcudart.so as expected! Searching further paths...
  warn(
/home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/mnt/disk-1/venshine/kohya_ss/venv/lib/python3.10/site-packages/cv2/../../lib64')}
  warn(
/home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:105: UserWarning: /mnt/disk-1/venshine/kohya_ss/venv/lib/python3.10/site-packages/cv2/../../lib64: did not contain libcudart.so as expected! Searching further paths...
  warn(
/home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('-L/home/venshine/speechsdk/lib/x64 -lMicrosoft.CognitiveServices.Speech.core')}
  warn(
/home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('-I/home/venshine/speechsdk/include/c_api')}
  warn(
/home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/usr/bin/su venshine')}
  warn(
/home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/home/venshine/miniconda3/envs/diffusion/etc/xml/catalog file'), PosixPath('file'), PosixPath('/etc/xml/catalog')}
  warn(
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
CUDA SETUP: CUDA runtime path found: /usr/local/cuda/lib64/libcudart.so
CUDA SETUP: Highest compute capability among GPUs detected: 8.0
CUDA SETUP: Detected CUDA version 122
CUDA SETUP: TODO: compile library for specific version: libbitsandbytes_cuda122.so
CUDA SETUP: Defaulting to libbitsandbytes.so...
CUDA SETUP: CUDA detection failed. Either CUDA driver not installed, CUDA not installed, or you have multiple conflicting CUDA libraries!
CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.
╭──────────────────────────── Traceback (most recent call last) ────────────────────────────╮
│ /mnt/disk-1/venshine/kohya_ss/train_network.py:873 in <module>                             │
│                                                                                           │
│   870 │   args = parser.parse_args()                                                      │
│   871 │   args = train_util.read_config_from_file(args, parser)                           │
│   872 │                                                                                   │
│ ❱ 873 │   train(args)                                                                     │
│   874                                                                                     │
│                                                                                           │
│ /mnt/disk-1/venshine/kohya_ss/train_network.py:262 in train                                │
│                                                                                           │
│   259 │   │   )                                                                           │
│   260 │   │   trainable_params = network.prepare_optimizer_params(args.text_encoder_lr, a │
│   261 │                                                                                   │
│ ❱ 262 │   optimizer_name, optimizer_args, optimizer = train_util.get_optimizer(args, trai │
│   263 │                                                                                   │
│   264 │   # dataloaderを準備する                                                          │
│   265 │   # DataLoaderのプロセス数:0はメインプロセスになる                               │
│                                                                                           │
│ /mnt/disk-1/venshine/kohya_ss/library/train_util.py:2699 in get_optimizer                  │
│                                                                                           │
│   2696 │                                                                                  │
│   2697 │   if optimizer_type == "AdamW8bit".lower():                                      │
│   2698 │   │   try:                                                                       │
│ ❱ 2699 │   │   │   import bitsandbytes as bnb                                             │
│   2700 │   │   except ImportError:                                                        │
│   2701 │   │   │   raise ImportError("No bitsand bytes / bitsandbytesがインストールされて │
│   2702 │   │   print(f"use 8-bit AdamW optimizer | {optimizer_kwargs}")                   │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/__ │
│ init__.py:6 in <module>                                                                   │
│                                                                                           │
│    3 # This source code is licensed under the MIT license found in the                    │
│    4 # LICENSE file in the root directory of this source tree.                            │
│    5                                                                                      │
│ ❱  6 from .autograd._functions import (                                                   │
│    7 │   MatmulLtState,                                                                   │
│    8 │   bmm_cublas,                                                                      │
│    9 │   matmul,                                                                          │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/au │
│ tograd/_functions.py:5 in <module>                                                        │
│                                                                                           │
│     2 import warnings                                                                     │
│     3                                                                                     │
│     4 import torch                                                                        │
│ ❱   5 import bitsandbytes.functional as F                                                 │
│     6                                                                                     │
│     7 from dataclasses import dataclass                                                   │
│     8 from functools import reduce  # Required in Python 3                                │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/fu │
│ nctional.py:13 in <module>                                                                │
│                                                                                           │
│     10 from typing import Tuple                                                           │
│     11 from torch import Tensor                                                           │
│     12                                                                                    │
│ ❱   13 from .cextension import COMPILED_WITH_CUDA, lib                                    │
│     14 from functools import reduce  # Required in Python 3                               │
│     15                                                                                    │
│     16 # math.prod not compatible with python < 3.8                                       │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/ce │
│ xtension.py:41 in <module>                                                                │
│                                                                                           │
│   38 │   │   return cls._instance                                                         │
│   39                                                                                      │
│   40                                                                                      │
│ ❱ 41 lib = CUDALibrary_Singleton.get_instance().lib                                       │
│   42 try:                                                                                 │
│   43 │   lib.cadam32bit_g32                                                               │
│   44 │   lib.get_context.restype = ct.c_void_p                                            │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/ce │
│ xtension.py:37 in get_instance                                                            │
│                                                                                           │
│   34 │   def get_instance(cls):                                                           │
│   35 │   │   if cls._instance is None:                                                    │
│   36 │   │   │   cls._instance = cls.__new__(cls)                                         │
│ ❱ 37 │   │   │   cls._instance.initialize()                                               │
│   38 │   │   return cls._instance                                                         │
│   39                                                                                      │
│   40                                                                                      │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/bitsandbytes/ce │
│ xtension.py:27 in initialize                                                              │
│                                                                                           │
│   24 │   │   │   if not binary_path.exists():                                             │
│   25 │   │   │   │   print('CUDA SETUP: CUDA detection failed. Either CUDA driver not ins │
│   26 │   │   │   │   print('CUDA SETUP: If you compiled from source, try again with `make │
│ ❱ 27 │   │   │   │   raise Exception('CUDA SETUP: Setup Failed!')                         │
│   28 │   │   │   self.lib = ct.cdll.LoadLibrary(binary_path)                              │
│   29 │   │   else:                                                                        │
│   30 │   │   │   print(f"CUDA SETUP: Loading binary {binary_path}...")                    │
╰───────────────────────────────────────────────────────────────────────────────────────────╯
Exception: CUDA SETUP: Setup Failed!
╭──────────────────────────── Traceback (most recent call last) ────────────────────────────╮
│ /home/venshine/workspace/venshine/kohya_ss/venv/bin/accelerate:8 in <module>                 │
│                                                                                           │
│   5 from accelerate.commands.accelerate_cli import main                                   │
│   6 if __name__ == '__main__':                                                            │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                  │
│ ❱ 8 │   sys.exit(main())                                                                  │
│   9                                                                                       │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/accelerate/comm │
│ ands/accelerate_cli.py:45 in main                                                         │
│                                                                                           │
│   42 │   │   exit(1)                                                                      │
│   43 │                                                                                    │
│   44 │   # Run                                                                            │
│ ❱ 45 │   args.func(args)                                                                  │
│   46                                                                                      │
│   47                                                                                      │
│   48 if __name__ == "__main__":                                                           │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/accelerate/comm │
│ ands/launch.py:1104 in launch_command                                                     │
│                                                                                           │
│   1101 │   elif defaults is not None and defaults.compute_environment == ComputeEnvironme │
│   1102 │   │   sagemaker_launcher(defaults, args)                                         │
│   1103 │   else:                                                                          │
│ ❱ 1104 │   │   simple_launcher(args)                                                      │
│   1105                                                                                    │
│   1106                                                                                    │
│   1107 def main():                                                                        │
│                                                                                           │
│ /home/venshine/workspace/venshine/kohya_ss/venv/lib/python3.10/site-packages/accelerate/comm │
│ ands/launch.py:567 in simple_launcher                                                     │
│                                                                                           │
│    564 │   process = subprocess.Popen(cmd, env=current_env)                               │
│    565 │   process.wait()                                                                 │
│    566 │   if process.returncode != 0:                                                    │
│ ❱  567 │   │   raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd │
│    568                                                                                    │
│    569                                                                                    │
│    570 def multi_gpu_launcher(args):                                                      │
╰───────────────────────────────────────────────────────────────────────────────────────────╯
CalledProcessError: Command '['/home/venshine/workspace/venshine/kohya_ss/venv/bin/python',
'train_network.py', '--enable_bucket',
'--pretrained_model_name_or_path=/home/venshine/workspace/venshine/stable-diffusion-webui/models
/Stable-diffusion/chilloutmix_NiPrunedFp32Fix.safetensors',
'--train_data_dir=/home/venshine/workspace/venshine/kohya_ss/train/yz/image',
'--resolution=512,512',
'--output_dir=/home/venshine/workspace/venshine/kohya_ss/train/yz/model',
'--logging_dir=/home/venshine/workspace/venshine/kohya_ss/train/yz/log', '--network_alpha=128',
'--save_model_as=safetensors', '--network_module=networks.lora', '--text_encoder_lr=5e-05',
'--unet_lr=0.0001', '--network_dim=128', '--output_name=yangzi_v3_100',
'--lr_scheduler_num_cycles=1', '--learning_rate=0.0001', '--lr_scheduler=constant',
'--train_batch_size=2', '--max_train_steps=1200', '--save_every_n_epochs=1',
'--mixed_precision=fp16', '--save_precision=fp16', '--seed=1234', '--caption_extension=.txt',
'--cache_latents', '--optimizer_type=AdamW8bit', '--max_data_loader_n_workers=0',
'--bucket_reso_steps=64', '--xformers', '--bucket_no_upscale']' returned non-zero exit status
1.
TimDettmers commented 1 year ago

CUDA was not supported in older bitsandbytes version. This should be fixed in the newest version.

Upgrading via pip install -U bitsandbytes should resolve this issue. I will close this issue. Please reopen if upgrading does not resolve the error.

swumagic commented 11 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)