facechain icon indicating copy to clipboard operation
facechain copied to clipboard

ValueError: The deprecation tuple ('LoRAAttnProcessor' ...

Open Cohvir opened this issue 1 year ago • 3 comments

After all the errors of missing imports, I am near the goal of running a training, but this error stopped me. I don't really get what's the problem.

I tried removing the deprecation function the logs mentioned, but nothing changed. What's the deal here?

Console Error

Generating train split: 3 examples [00:00, 600.10 examples/s]
02/08/2024 20:08:15 - INFO - __main__ - ***** Running training *****
02/08/2024 20:08:15 - INFO - __main__ -   Num examples = 3
02/08/2024 20:08:15 - INFO - __main__ -   Num Epochs = 200
02/08/2024 20:08:15 - INFO - __main__ -   Instantaneous batch size per device = 1
02/08/2024 20:08:15 - INFO - __main__ -   Total train batch size (w. parallel, distributed & accumulation) = 1
02/08/2024 20:08:15 - INFO - __main__ -   Gradient Accumulation steps = 1
02/08/2024 20:08:15 - INFO - __main__ -   Total optimization steps = 600
Steps:   0%|                                                                                   | 0/600 [00:00<?, ?it/s]Traceback (most recent call last):
  File "D:\dev\A1111\stable-diffusion-webui\extensions\facechain\facechain\train_text_to_image_lora_sdxl.py", line 1352, in <module>
    main()
  File "D:\dev\A1111\stable-diffusion-webui\extensions\facechain\facechain\train_text_to_image_lora_sdxl.py", line 1142, in main
    model_pred = unet(
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\unets\unet_2d_condition.py", line 1121, in forward
    sample, res_samples = downsample_block(
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\unets\unet_2d_blocks.py", line 1199, in forward
    hidden_states = attn(
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\transformers\transformer_2d.py", line 391, in forward
    hidden_states = block(
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\attention.py", line 335, in forward
    attn_output = self.attn1(
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\attention_processor.py", line 512, in forward
    return self.processor(
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\attention_processor.py", line 1856, in __call__
    deprecate(
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\utils\deprecation_utils.py", line 18, in deprecate
    raise ValueError(
ValueError: The deprecation tuple ('LoRAAttnProcessor', '0.26.0', 'Make sure use AttnProcessor instead by settingLoRA layers to `self.{to_q,to_k,to_v,to_out[0]}.lora_layer` respectively. This will be done automatically when using `LoraLoaderMixin.load_lora_weights`') should be removed since diffusers' version 0.26.2 is >= 0.26.0
Steps:   0%|                                                                                   | 0/600 [00:04<?, ?it/s]
Error executing the command: Command '['python', 'D:\\dev\\A1111\\stable-diffusion-webui\\extensions\\facechain/facechain/train_text_to_image_lora_sdxl.py', '--pretrained_model_name_or_path=AI-ModelScope/stable-diffusion-xl-base-1.0', '--revision=v1.0.9', '--sub_path=', '--output_dataset_name=D:\\dev\\A1111\\stable-diffusion-webui\\extensions\\facechain\\worker_data\\qw\\training_data\\AI-ModelScope/stable-diffusion-xl-base-1.0\\alissa-test3', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=D:\\dev\\A1111\\stable-diffusion-webui\\extensions\\facechain\\worker_data\\qw\\AI-ModelScope/stable-diffusion-xl-base-1.0\\alissa-test3', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "D:\dev\A1111\stable-diffusion-webui\extensions\facechain\app.py", line 147, in train_lora_fn
    subprocess.run(command, check=True)
  File "C:\Users\fract\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['python', 'D:\\dev\\A1111\\stable-diffusion-webui\\extensions\\facechain/facechain/train_text_to_image_lora_sdxl.py', '--pretrained_model_name_or_path=AI-ModelScope/stable-diffusion-xl-base-1.0', '--revision=v1.0.9', '--sub_path=', '--output_dataset_name=D:\\dev\\A1111\\stable-diffusion-webui\\extensions\\facechain\\worker_data\\qw\\training_data\\AI-ModelScope/stable-diffusion-xl-base-1.0\\alissa-test3', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=D:\\dev\\A1111\\stable-diffusion-webui\\extensions\\facechain\\worker_data\\qw\\AI-ModelScope/stable-diffusion-xl-base-1.0\\alissa-test3', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\dev\A1111\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "D:\dev\A1111\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "D:\dev\A1111\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "D:\dev\A1111\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "D:\dev\A1111\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "D:\dev\A1111\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "D:\dev\A1111\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "D:\dev\A1111\stable-diffusion-webui\extensions\facechain\app.py", line 804, in run
    train_lora_fn(base_model_path=base_model_path,
  File "D:\dev\A1111\stable-diffusion-webui\extensions\facechain\app.py", line 150, in train_lora_fn
    raise gr.Error("训练失败 (Training failed)")
gradio.exceptions.Error: '训练失败 (Training failed)'

Cohvir avatar Feb 08 '24 19:02 Cohvir

hello, any progess here? Have tried to downgrade the diffusers version to 0.25.1 and modify the LoRAAttnProcessor, but still not working

coodoing avatar Feb 21 '24 07:02 coodoing

hello, any progess here? Have tried to downgrade the diffusers version to 0.25.1 and modify the LoRAAttnProcessor, but still not working

https://github.com/d8ahazard/sd_dreambooth_extension/issues/1456#issuecomment-1932484747

lizzielss avatar Feb 22 '24 03:02 lizzielss

hello, any progess here? Have tried to downgrade the diffusers version to 0.25.1 and modify the LoRAAttnProcessor, but still not working

d8ahazard/sd_dreambooth_extension#1456 (comment)

Thks , this works for me. By the way, I had made some other changes to make the model work. Hope it helps:

1, comment out line 17-21 of {xx}/derecation_utils.py 2, update transformers lib to the main branch 3, comment out the unet/vae.requires_grad_() of facechain/train_text_to_image_lora.py, load the pretrained adapter to have them in the trainable model

coodoing avatar Feb 22 '24 08:02 coodoing

please try out the newest train-free, 10s inference version facechain-fact.

sunbaigui avatar Jun 04 '24 09:06 sunbaigui