Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Kohya LoRA Trainer XL ERROR #330

Open
domochevisk opened this issue Jan 13, 2024 · 2 comments
Open

Kohya LoRA Trainer XL ERROR #330

domochevisk opened this issue Jan 13, 2024 · 2 comments

Comments

@domochevisk
Copy link

When I try to run the training process following error occurs: AttributeError: 'list' object has no attribute 'named_modules'.

How to fix?

apply LoRA to Conv2d with kernel size (3,3).
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /content/kohya-trainer/sdxl_train_network.py:174 in │
│ │
│ 171 │ args = train_util.read_config_from_file(args, parser) │
│ 172 │ │
│ 173 │ trainer = SdxlNetworkTrainer() │
│ ❱ 174 │ trainer.train(args) │
│ 175 │
│ │
│ /content/kohya-trainer/train_network.py:276 in train │
│ │
│ 273 │ │ │ network, _ = network_module.create_network_from_weights(1, args.network_weig │
│ 274 │ │ else: │
│ 275 │ │ │ # LyCORIS will work with this... │
│ ❱ 276 │ │ │ network = network_module.create_network( │
│ 277 │ │ │ │ 1.0, │
│ 278 │ │ │ │ args.network_dim, │
│ 279 │ │ │ │ args.network_alpha, │
│ │
│ /content/kohya-trainer/networks/dylora.py:190 in create_network │
│ │
│ 187 │ else: │
│ 188 │ │ unit = 1 │
│ 189 │ │
│ ❱ 190 │ network = DyLoRANetwork( │
│ 191 │ │ text_encoder, │
│ 192 │ │ unet, │
│ 193 │ │ multiplier=multiplier, │
│ │
│ /content/kohya-trainer/networks/dylora.py:310 in init
│ │
│ 307 │ │ │ │ │ │ │ loras.append(lora) │
│ 308 │ │ │ return loras │
│ 309 │ │ │
│ ❱ 310 │ │ self.text_encoder_loras = create_modules(False, text_encoder, DyLoRANetwork.TEXT │
│ 311 │ │ print(f"create LoRA for Text Encoder: {len(self.text_encoder_loras)} modules.") │
│ 312 │ │ │
│ 313 │ │ # extend U-Net target modules if conv2d 3x3 is enabled, or load from weights │
│ │
│ /content/kohya-trainer/networks/dylora.py:280 in create_modules │
│ │
│ 277 │ │ def create_modules(is_unet, root_module: torch.nn.Module, target_replace_modules │
│ 278 │ │ │ prefix = DyLoRANetwork.LORA_PREFIX_UNET if is_unet else DyLoRANetwork.LORA_P │
│ 279 │ │ │ loras = [] │
│ ❱ 280 │ │ │ for name, module in root_module.named_modules(): │
│ 281 │ │ │ │ if module.class.name in target_replace_modules: │
│ 282 │ │ │ │ │ for child_name, child_module in module.named_modules(): │
│ 283 │ │ │ │ │ │ is_linear = child_module.class.name == "Linear" │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'list' object has no attribute 'named_modules'
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/local/bin/accelerate:8 in │
│ │
│ 5 from accelerate.commands.accelerate_cli import main │
│ 6 if name == 'main': │
│ 7 │ sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) │
│ ❱ 8 │ sys.exit(main()) │
│ 9 │
│ │
│ /usr/local/lib/python3.10/dist-packages/accelerate/commands/accelerate_cli.py:45 in main │
│ │
│ 42 │ │ exit(1) │
│ 43 │ │
│ 44 │ # Run │
│ ❱ 45 │ args.func(args) │
│ 46 │
│ 47 │
│ 48 if name == "main": │
│ │
│ /usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py:918 in launch_command │
│ │
│ 915 │ elif defaults is not None and defaults.compute_environment == ComputeEnvironment.AMA │
│ 916 │ │ sagemaker_launcher(defaults, args) │
│ 917 │ else: │
│ ❱ 918 │ │ simple_launcher(args) │
│ 919 │
│ 920 │
│ 921 def main(): │
│ │
│ /usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py:580 in simple_launcher │
│ │
│ 577 │ process.wait() │
│ 578 │ if process.returncode != 0: │
│ 579 │ │ if not args.quiet: │
│ ❱ 580 │ │ │ raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd) │
│ 581 │ │ else: │
│ 582 │ │ │ sys.exit(1) │
│ 583 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
CalledProcessError: Command '['/usr/bin/python3', 'sdxl_train_network.py',
'--sample_prompts=/content/LoRA/config/sample_prompt.toml',
'--config_file=/content/LoRA/config/config_file.toml']' returned non-zero exit status 1.

@pendave
Copy link

pendave commented Jan 30, 2024

Me too.

@1DKroY1
Copy link

1DKroY1 commented Mar 22, 2024

Have you found a solution?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants