bmaltais / kohya_ss

Apache License 2.0
9.54k stars 1.23k forks source link

No module named 'bitsandbytes.cuda_setup.paths' #1798

Closed mertayd0 closed 8 months ago

mertayd0 commented 10 months ago

prepare optimizer, data loader etc. Traceback (most recent call last): File "D:\SD\kohya_ss\library\train_util.py", line 3444, in get_optimizer import bitsandbytes as bnb File "D:\SD\kohya_ss\venv\lib\site-packages\bitsandbytes__init.py", line 6, in from . import cuda_setup, utils, research File "D:\SD\kohya_ss\venv\lib\site-packages\bitsandbytes\research__init__.py", line 1, in from . import nn File "D:\SD\kohya_ss\venv\lib\site-packages\bitsandbytes\research\nn\init.py", line 1, in from .modules import LinearFP8Mixed, LinearFP8Global File "D:\SD\kohya_ss\venv\lib\site-packages\bitsandbytes\research\nn\modules.py", line 8, in from bitsandbytes.optim import GlobalOptimManager File "D:\SD\kohya_ss\venv\lib\site-packages\bitsandbytes\optim\init__.py", line 6, in from bitsandbytes.cextension import COMPILED_WITH_CUDA File "D:\SD\kohya_ss\venv\lib\site-packages\bitsandbytes\cextension.py", line 5, in from .cuda_setup.main import evaluate_cuda_setup File "D:\SD\kohya_ss\venv\lib\site-packages\bitsandbytes\cuda_setup\main.py", line 21, in from .paths import determine_cuda_runtime_lib_path ModuleNotFoundError: No module named 'bitsandbytes.cuda_setup.paths'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\SD\kohya_ss\train_network.py", line 1012, in trainer.train(args) File "D:\SD\kohya_ss\train_network.py", line 342, in train optimizer_name, optimizer_args, optimizer = train_util.get_optimizer(args, trainable_params) File "D:\SD\kohya_ss\library\train_util.py", line 3446, in get_optimizer raise ImportError("No bitsandbytes / bitsandbytesがインストールされていないようです") ImportError: No bitsandbytes / bitsandbytesがインストールされていないようです Traceback (most recent call last): File "C:\Users\mb\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\mb\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "D:\SD\kohya_ss\venv\Scripts\accelerate.exe__main__.py", line 7, in File "D:\SD\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py", line 47, in main args.func(args) File "D:\SD\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 986, in launch_command simple_launcher(args) File "D:\SD\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 628, in simple_launcher raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd) subprocess.CalledProcessError: Command '['D:\SD\kohya_ss\venv\Scripts\python.exe', './train_network.py', '--enable_bucket', '--min_bucket_reso=256', '--max_bucket_reso=2048', '--pretrained_model_name_or_path=D:/SD/stable-diffusion-webui/models/Stable-diffusion/realisticVisionV60B1_v60B1VAE.safetensors', '--train_data_dir=C:/Users/mb/OneDrive/Desktop/Lora1/img', '--reg_data_dir=C:/Users/mb/OneDrive/Desktop/Lora1/reg', '--resolution=512,512', '--output_dir=C:/Users/mb/OneDrive/Desktop/Lora1/model', '--logging_dir=C:/Users/mb/OneDrive/Desktop/Lora1/log', '--network_alpha=32', '--save_model_as=safetensors', '--network_module=networks.lora', '--text_encoder_lr=2e-05', '--unet_lr=0.0002', '--network_dim=64', '--output_name=Car-A', '--lr_scheduler_num_cycles=5', '--no_half_vae', '--learning_rate=0.0002', '--lr_scheduler=constant', '--train_batch_size=2', '--max_train_steps=3750', '--save_every_n_epochs=1', '--mixed_precision=bf16', '--save_precision=bf16', '--cache_latents', '--cache_latents_to_disk', '--optimizer_type=AdamW8bit', '--max_grad_norm=1', '--max_data_loader_n_workers=0', '--bucket_reso_steps=64', '--xformers', '--bucket_no_upscale', '--noise_offset=0.0']' returned non-zero exit status 1.

mertayd0 commented 10 months ago

I tried to install bitsandbytes.cuda_setup.paths but it doesn't change anything.

AtticusSims commented 9 months ago

Having the same issue here.

TeKett commented 9 months ago

There seems to be some issue for some people, for me pip just refuse to install it correctly, it kept getting the old main file. I fixed it by manually extracting the wheel to the lib folder.

dieter-knecht commented 9 months ago

Same problem at my side.

fatoldsun00 commented 9 months ago

sames here. Textual inversion works well, but Lora training has failed. I tried several thing such as installing an older version or installing the windows version bitSandBytes, cause it seems to me that error is related to bitSansBytes, but without success

My OS is win 10

--------------------------------------------Edit----------------------------------- AdamW8bit seems to be the source of the issue, if you change this by Adafactor for example it seems to work.

No really know what AdamW8bit is and its impact on training if you change that, so give it a try and go dive deep to doc

thekev commented 9 months ago

1704 solved this issue for me.

TheZaind commented 9 months ago

if youre on windows and want to use the adam8bit, change in the "requirements_windows_torch2.tx"t the "bitsandbytes==0.41.1 # no_verify" to "bitsandbytes-windows". Worked for me! it can be that you need to delete the bitsandbytes folder from the venv.

amarillosebas commented 7 months ago

if youre on windows and want to use the adam8bit, change in the "requirements_windows_torch2.tx"t the "bitsandbytes==0.41.1 # no_verify" to "bitsandbytes-windows". Worked for me! it can be that you need to delete the bitsandbytes folder from the venv.

This is the solution! Took me a while to find this. Thank you so much!! Could the dev update the repo with this change?