Open domochevisk opened 6 months ago
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/trainnetwork.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.
Me too.
Have you found a solution?
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/trainnetwork.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.