d8ahazard / sd_dreambooth_extension

Other
1.85k stars 283 forks source link

[Bug]: Exception training model: 'type object 'LoraLoaderMixin' has no attribute '_modify_text_encoder''. #1470

Closed kainatquaderee closed 3 months ago

kainatquaderee commented 3 months ago

Is there an existing issue for this?

What happened?

while training with lora i get this error os: ubuntu22.04

Steps to reproduce the problem

press train checking use lora.

Commit and libraries

Starting at Initializing Dreambooth and ending several lines below at [+] bitsandbytes version 0.35.4 installed..

Command Line Arguments

--listen --port 7861 --theme dark --xformers --enable-insecure-extension-access --medvram --opt-split-attention

Console logs

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on kainatq user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
glibc version is 2.35
Check TCMalloc: libtcmalloc_minimal.so.4
libtcmalloc_minimal.so.4 is linked with libc.so,execute LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
Installing requirements
CUDA 12.1
If submitting an issue on github, please provide the full startup log for debugging purposes.

Initializing Dreambooth
Dreambooth revision: 45a12fe5950bf93205b6ef2b7511eb94052a241f
Checking xformers...
Checking bitsandbytes...
Checking bitsandbytes (ALL!)
Checking Dreambooth requirements...
Installed version of bitsandbytes: 0.43.0
[Dreambooth] bitsandbytes v0.43.0 is already installed.
Installed version of accelerate: 0.21.0
[Dreambooth] accelerate v0.21.0 is already installed.
Installed version of dadaptation: 3.2
[Dreambooth] dadaptation v3.2 is already installed.
Installed version of diffusers: 0.27.2
[Dreambooth] diffusers v0.25.0 is already installed.
Installed version of discord-webhook: 1.3.0
[Dreambooth] discord-webhook v1.3.0 is already installed.
Installed version of fastapi: 0.94.0
[Dreambooth] fastapi is already installed.
Installed version of gitpython: 3.1.32
[Dreambooth] gitpython v3.1.40 is not installed.
Successfully installed gitpython-3.1.42
Installed version of pytorch_optimizer: 2.12.0
[Dreambooth] pytorch_optimizer v2.12.0 is already installed.
Installed version of Pillow: 9.5.0
[Dreambooth] Pillow is already installed.
Installed version of tqdm: 4.64.0
[Dreambooth] tqdm is already installed.
Installed version of tomesd: 0.1.3
[Dreambooth] tomesd v0.1.2 is already installed.
Installed version of tensorboard: 2.13.0
[Dreambooth] tensorboard v2.13.0 is already installed.
[+] torch version 2.1.2 installed.
[+] torchvision version 0.16.2 installed.
[+] accelerate version 0.21.0 installed.
[+] diffusers version 0.27.2 installed.
[+] bitsandbytes version 0.43.0 installed.
[+] xformers version 0.0.23.post1 installed.
Launching Web UI with arguments: --listen --port 7861 --theme dark --xformers --enable-insecure-extension-access --medvram --opt-split-attention
[-] ADetailer initialized. version: 24.3.3, num models: 10
CivitAI Browser+: Aria2 RPC started
[Better Styles] Version 1.4.2
ControlNet preprocessor location: /media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads
2024-03-28 14:41:31,853 - ControlNet - INFO - ControlNet v1.1.442
2024-03-28 14:41:31,921 - ControlNet - INFO - ControlNet v1.1.442
14:41:32 - ReActor - STATUS - Running v0.7.0-b7 on Device: CUDA
*** Error loading script: aesthetic.py
    Traceback (most recent call last):
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/modules/scripts.py", line 527, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/stable-diffusion-webui-cafe-aesthetic/scripts/aesthetic.py", line 11, in <module>
        from webui import wrap_gradio_gpu_call
    ImportError: cannot import name 'wrap_gradio_gpu_call' from 'webui' (/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/webui.py)

---
Loading weights [e1441589a6] from /media/kainatq/Games_And_Others/stable/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned.ckpt
Creating model from config: /media/kainatq/Games_And_Others/stable/stable-diffusion-webui/configs/v1-inference.yaml
Applying attention optimization: xformers... done.
Model loaded in 8.4s (load weights from disk: 4.7s, create model: 0.6s, apply weights to model: 1.0s, apply half(): 0.3s, calculate empty prompt: 1.5s).
Character Path: 
Embedding Model value: None
LORA Model value: None
2024-03-28 14:41:41,233 - ControlNet - INFO - ControlNet UI callback registered.
Character Path: 
Embedding Model value: None
LORA Model value: None
*** Error executing callback ui_tabs_callback for /media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/SadTalker/scripts/extension.py
    Traceback (most recent call last):
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/modules/script_callbacks.py", line 180, in ui_tabs_callback
        res += c.callback() or []
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/SadTalker/scripts/extension.py", line 172, in on_ui_tabs
        from app_sadtalker import sadtalker_demo
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/SadTalker/app_sadtalker.py", line 3, in <module>
        from src.gradio_demo import SadTalker
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/SadTalker/src/gradio_demo.py", line 6, in <module>
        from src.generate_batch import get_data
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/SadTalker/src/generate_batch.py", line 8, in <module>
        import src.utils.audio as audio
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/SadTalker/src/utils/audio.py", line 1, in <module>
        import librosa
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/venv/lib/python3.10/site-packages/librosa/__init__.py", line 211, in <module>
        from . import core
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/venv/lib/python3.10/site-packages/librosa/core/__init__.py", line 9, in <module>
        from .constantq import *  # pylint: disable=wildcard-import
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/venv/lib/python3.10/site-packages/librosa/core/constantq.py", line 1058, in <module>
        dtype=np.complex,
      File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/venv/lib/python3.10/site-packages/numpy/__init__.py", line 324, in __getattr__
        raise AttributeError(__former_attrs__[attr])
    AttributeError: module 'numpy' has no attribute 'complex'.
    `np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
    The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
        https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

---
Running on local URL:  http://0.0.0.0:7861

To create a public link, set `share=True` in `launch()`.
IIB Database file has been successfully backed up to the backup folder.
Startup time: 39.8s (prepare environment: 14.8s, import torch: 2.3s, import gradio: 0.5s, setup paths: 1.1s, other imports: 0.2s, load scripts: 6.2s, initialize extra networks: 0.2s, create ui: 13.7s, gradio launch: 0.5s).
Advanced elements visible: False
Initializing dreambooth training...
WARNING:dreambooth.train_dreambooth:Wandb API key not set. Please set WANDB_API_KEY environment variable to use wandb.
                  0 cached latents
0it [00:00, ?it/s]                                                                                                                                                                                                                         Traceback (most recent call last):                                                                                                                                                                                     | 0/1 [00:00<?, ?it/s]
  File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/ui_functions.py", line 735, in start_training
    result = main(class_gen_method=class_gen_method)
  File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 2003, in main
    return inner_loop()
  File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/memory.py", line 126, in decorator
    return function(batch_size, grad_size, prof, *args, **kwargs)
  File "/media/kainatq/Games_And_Others/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 639, in inner_loop
    text_encoder_lora_params = LoraLoaderMixin._modify_text_encoder(
AttributeError: type object 'LoraLoaderMixin' has no attribute '_modify_text_encoder'
Loading LoRA...:   0%|                                                                                                                                                                                                | 0/1 [00:00<?, ?it/s]
Duration: 00:00:36
Duration: 00:00:37

Additional information

source model: sd1.5.ckpt No response

GrahamTheCoder commented 3 months ago

You can apply the workaround from #1469 locally pretty easily even while the PR is awaiting review Just change the requirements file then do pip install -r requirements.txt from that directory (may even happen automatically on startup)

kainatquaderee commented 3 months ago

You can apply the workaround from #1469 locally pretty easily even while the PR is awaiting review Just change the requirements file then do pip install -r requirements.txt from that directory (may even happen automatically on startup)

thanks it worked. 🤗

kainatquaderee commented 3 months ago

You can apply the workaround from #1469 locally pretty easily even while the PR is awaiting review Just change the requirements file then do pip install -r requirements.txt from that directory (may even happen automatically on startup)

solved

GrahamTheCoder commented 1 month ago

The issue was somewhat prematurely closed - the PR isn't merged and got closed due to inactivity