kohya-ss / sd-scripts

Apache License 2.0
5.33k stars 881 forks source link

AttributeError: 'bool' object has no attribute 'num_processes' #1696

Closed FurkanGozukara closed 1 month ago

FurkanGozukara commented 1 month ago

Urgent fix needed for SD3 branch @kohya-ss

this error is after latest @bmaltais update

this config worked yesterday

                    INFO     prepare accelerator                                                                                                                                                                                  flux_train.py:177
accelerator device: cuda
Saving training config to /home/Ubuntu/apps/StableSwarmUI/Models/diffusion_models/Quality_1_20241014-193901.json...                                                                                                       
19:39:01-749328 INFO     Executing command: /workspace/kohya_ss/venv/bin/accelerate launch --dynamo_backend no --dynamo_mode default --gpu_ids 0 --mixed_precision bf16 --num_processes 1 --num_machines 1 --num_cpu_threads_per_process 2         
                         /workspace/kohya_ss/sd-scripts/flux_train.py --config_file /home/Ubuntu/apps/StableSwarmUI/Models/diffusion_models/config_dreambooth-20241014-193901.toml                                                                 
/workspace/kohya_ss/venv/lib/python3.10/site-packages/diffusers/utils/outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
                    INFO     caching latents with caching strategy.                                                                                                                                                              train_util.py:1039
Traceback (most recent call last):
  File "/workspace/kohya_ss/sd-scripts/flux_train.py", line 998, in <module>
    train(args)
  File "/workspace/kohya_ss/sd-scripts/flux_train.py", line 193, in train
    train_dataset_group.new_cache_latents(ae, accelerator.is_main_process)
  File "/workspace/kohya_ss/sd-scripts/library/train_util.py", line 2467, in new_cache_latents
    dataset.new_cache_latents(model, accelerator)
  File "/workspace/kohya_ss/sd-scripts/library/train_util.py", line 1066, in new_cache_latents
    num_processes = accelerator.num_processes
AttributeError: 'bool' object has no attribute 'num_processes'
Traceback (most recent call last):
  File "/workspace/kohya_ss/venv/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/workspace/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main
    args.func(args)
  File "/workspace/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1106, in launch_command
    simple_launcher(args)
  File "/workspace/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 704, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/workspace/kohya_ss/venv/bin/python', '/workspace/kohya_ss/sd-scripts/flux_train.py', '--config_file', '/home/Ubuntu/apps/StableSwarmUI/Models/diffusion_models/config_dreambooth-20241014-193901.toml']' returned non-zero exit status 1.
19:39:35-563870 INFO     Training has ended.       
FurkanGozukara commented 1 month ago

you made some cache latents updates obviously they broken

kmacmcfarlane commented 1 month ago

Confirmed on Linux. I was able to start training by reverting to commit d005652d0361d410c01a9737ae703512db4be4be for now.

FurkanGozukara commented 1 month ago

Confirmed on Linux. I was able to start training by reverting to commit d005652 for now.

thanks for confirm. we really need urgent fixed :/ i also tested on linux / runpod

kohya-ss commented 1 month ago

There was a missing test. I fixed it.

zixuzhuang commented 1 month ago

sdxl_train_control_net_lllite also need to be fixed

kohya-ss commented 1 month ago

Thank you for reporting. I've fixed.