Error when training LoRa Model Using kohya_ss

3.1k Views Asked by At

I get the following output, when I try to train a LoRa Modell using kohya_ss:

Traceback (most recent call last):
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\library\train_util.py", line 3433, in get_optimizer
    import bitsandbytes as bnb
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\bitsandbytes\__init__.py", line 6, in <module>
    from . import cuda_setup, utils, research
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\bitsandbytes\research\__init__.py", line 1, in <module>
    from . import nn
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\bitsandbytes\research\nn\__init__.py", line 1, in <module>
    from .modules import LinearFP8Mixed, LinearFP8Global
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\bitsandbytes\research\nn\modules.py", line 8, in <module>
    from bitsandbytes.optim import GlobalOptimManager
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\bitsandbytes\optim\__init__.py", line 6, in <module>
    from bitsandbytes.cextension import COMPILED_WITH_CUDA
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\bitsandbytes\cextension.py", line 5, in <module>
    from .cuda_setup.main import evaluate_cuda_setup
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\bitsandbytes\cuda_setup\main.py", line 21, in <module>
    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 "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\train_db.py", line 495, in <module>
    train(args)
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\train_db.py", line 181, in train
    _, _, optimizer = train_util.get_optimizer(args, trainable_params)
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\library\train_util.py", line 3435, in get_optimizer
    raise ImportError("No bitsandbytes / bitsandbytesがインストールされていないようです")
ImportError: No bitsandbytes / bitsandbytesがインストールされていないようです
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\Scripts\accelerate.exe\__main__.py", line 7, in <module>
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py", line 47, in main
    args.func(args)
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 986, in launch_command
    simple_launcher(args)
  File "E:\Homeworklol\Deepfakes\LoRa Modell kram\LoRa Trainer\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 '['E:\\Homeworklol\\Deepfakes\\LoRa Modell kram\\LoRa Trainer\\kohya_ss\\venv\\Scripts\\python.exe', './train_db.py', '--pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5', '--train_data_dir=E:/Homeworklol/Deepfakes/LoRa Modell kram/Nele/image', '--resolution=512,512', '--output_dir=E:/Homeworklol/Deepfakes/LoRa Modell kram/Nele/model', '--logging_dir=E:/Homeworklol/Deepfakes/LoRa Modell kram/Nele/log', '--save_model_as=safetensors', '--output_name=Nele_LoRa_1', '--lr_scheduler_num_cycles=1', '--max_data_loader_n_workers=1', '--learning_rate_te=1e-05', '--learning_rate=0.0001', '--lr_scheduler=constant', '--train_batch_size=2', '--max_train_steps=9950', '--save_every_n_epochs=1', '--mixed_precision=bf16', '--save_precision=bf16', '--seed=1234', '--caption_extension=.txt', '--cache_latents', '--optimizer_type=AdamW8bit', '--max_data_loader_n_workers=1', '--clip_skip=2', '--bucket_reso_steps=64', '--xformers', '--bucket_no_upscale', '--noise_offset=0.0']' returned non-zero exit status 1.

I tried reinstalling cuda, I have added it to PATH, I have reinstalled the package bitsandbytes.

1

There are 1 best solutions below

1
On

I've also met the same problem. the way i solve it is by changing the optimizer to the non-8bit version. like if you have selected AdamW8bit, you change it to AdamW this time, then the training will work with no problem.