derrian-distro / LoRA_Easy_Training_Scripts

A UI made in Pyside6 to make training LoRA/LoCon and other LoRA type models in sd-scripts easy
GNU General Public License v3.0
998 stars 101 forks source link

Training DyLora failed - AttributeError: 'list' object has no attribute 'named_modules' #201

Closed ItsAuver closed 3 weeks ago

ItsAuver commented 3 months ago

Training a DyLora always fails. Console output:

validated, starting training...
A matching Triton is not available, some optimizations will not be enabled
Traceback (most recent call last):
  File "C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\xformers\__init__.py", line 55, in _is_triton_available
    from xformers.triton.softmax import softmax as triton_softmax  # noqa
  File "C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\xformers\triton\softmax.py", line 11, in <module>
    import triton
ModuleNotFoundError: No module named 'triton'
C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\venv\lib\site-packages\torchvision\io\image.py:13: UserWarning: Failed to load image Python extension: '[WinError 127] The specified procedure could not be found'If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?
  warn(
Loading settings from runtime_store\config.toml...
runtime_store\config
prepare tokenizers
update token length: 225
Loading dataset config from runtime_store\dataset.toml
prepare images.
found directory C:/Users/engie/Documents/LoRA_Easy_Training_Scripts/Datasets/SDXL/Foreshortening/dataset contains 898 image files
1796 train images with repeating.
0 reg images.
no regularization images / 正則化画像が見つかりませんでした
[Dataset 0]
  batch_size: 1
  resolution: (1024, 1024)
  enable_bucket: True
  min_bucket_reso: 512
  max_bucket_reso: 2048
  bucket_reso_steps: 128
  bucket_no_upscale: False

  [Subset 0 of Dataset 0]
    image_dir: "C:/Users/engie/Documents/LoRA_Easy_Training_Scripts/Datasets/SDXL/Foreshortening/dataset"
    image_count: 898
    num_repeats: 2
    shuffle_caption: False
    keep_tokens: 0
    keep_tokens_separator:
    caption_dropout_rate: 0.0
    caption_dropout_every_n_epoches: 0
    caption_tag_dropout_rate: 0.0
    caption_prefix: None
    caption_suffix: None
    color_aug: False
    flip_aug: True
    face_crop_aug_range: None
    random_crop: False
    token_warmup_min: 1,
    token_warmup_step: 0,
    is_reg: False
    class_tokens: None
    caption_extension: .txt

[Dataset 0]
loading image sizes.
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 898/898 [00:00<00:00, 7164.68it/s]
make buckets
number of images (including repeats) / 各bucketの画像枚数(繰り返し回数を含む)
bucket 0: resolution (640, 1408), count: 20
bucket 1: resolution (640, 1536), count: 6
bucket 2: resolution (768, 1280), count: 358
bucket 3: resolution (896, 1152), count: 908
bucket 4: resolution (1024, 1024), count: 146
bucket 5: resolution (1152, 896), count: 266
bucket 6: resolution (1280, 768), count: 88
bucket 7: resolution (1408, 640), count: 4
mean ar error (without repeats): 0.06012884159498674
preparing accelerator
loading model for process 0/1
load StableDiffusion checkpoint: F:/Downloads/autismmixSDXL_autismmixConfetti(1).safetensors
building U-Net
loading U-Net from checkpoint
U-Net:  <All keys matched successfully>
building text encoders
loading text encoders from checkpoint
text encoder 1: <All keys matched successfully>
text encoder 2: <All keys matched successfully>
building VAE
loading VAE from checkpoint
VAE: <All keys matched successfully>
load VAE: F:/Downloads/sdxl_vae.safetensors
additional VAE loaded
Enable xformers for U-Net
import network module: networks.dylora
[Dataset 0]
caching latents.
checking cache validity...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 898/898 [00:00<00:00, 893590.75it/s]
caching latents...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 898/898 [03:06<00:00,  4.81it/s]
create LoRA network. base dim (rank): 16, alpha: 8.0, unit: 4
apply LoRA to Conv2d with kernel size (3,3).
Traceback (most recent call last):
  File "C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\sdxl_train_network.py", line 189, in <module>
    trainer.train(args)
  File "C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\train_network.py", line 300, in train
    network = network_module.create_network(
  File "C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\networks\dylora.py", line 190, in create_network
    network = DyLoRANetwork(
  File "C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\networks\dylora.py", line 310, in __init__
    self.text_encoder_loras = create_modules(False, text_encoder, DyLoRANetwork.TEXT_ENCODER_TARGET_REPLACE_MODULE)
  File "C:\Users\engie\Documents\LoRA_Easy_Training_Scripts\sd_scripts\networks\dylora.py", line 280, in create_modules
    for name, module in root_module.named_modules():
AttributeError: 'list' object has no attribute 'named_modules'
Press any key to continue . . .

Relevant Toml file is here: https://pixeldrain.com/u/gjDhtF8k

Windows 11. Here is my pip freeze: https://pastebin.com/EeTGxbH2

derrian-distro commented 3 months ago

dylora might be broken in that version of sd_scripts, it looks like you are on main, if so, there isn't much I can do other then suggest to try it on dev, as I have already updated sd_scripts to the newest version on dev.

Jelosus2 commented 4 weeks ago

Any update on this or can I close it?

Jelosus2 commented 3 weeks ago

I'll be closing the issue since it appears to be inactive, feel free to reopen it if you ever need to