kohya-ss / kohya-ss/sd-scripts

When using sdxl_train_network.py to train Lora, an error occurs. AttributeError: 'list' object has no attribute 'named_modules'.

Open
#1,158 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

Traceback (most recent call last):
File "D:\PycharmProjects\sd-scripts-sdxl\sdxl_train_network.py", line 189, in
trainer.train(args)
File "D:\PycharmProjects\sd-scripts-sdxl\train_network.py", line 290, in train
network = network_module.create_network(
File "D:\PycharmProjects\sd-scripts-sdxl\networks\dylora.py", line 190, in create_network
network = DyLoRANetwork(
File "D:\PycharmProjects\sd-scripts-sdxl\networks\dylora.py", line 310, in __init__
self.text_encoder_loras = create_modules(False, text_encoder, DyLoRANetwork.TEXT_ENCODER_TARGET_REPLACE_MODULE)
File "D:\PycharmProjects\sd-scripts-sdxl\networks\dylora.py", line 280, in create_modules
for name, module in root_module.named_modules():
AttributeError: 'list' object has no attribute 'named_modules'

When I debugged, I found that the Text encoder was a list containing two elements in sdxl_train_network.py. I think this is the cause of the error in training. Can anyone tell me how to solve this problem?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the traceback with sdxl_train_network.py, then read the text-encoder setup around the reported entry point and networks/dylora.py:create_modules and DyLoRANetwork.__init__. Trace how the two text encoders are passed into create_modules and confirm the expected input shape. Done means SDXL LoRA training proceeds past this initialization without the named_modules error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.