d8ahazard / sd_dreambooth_extension

Other
1.85k stars 283 forks source link

[Bug]: AttributeError: 'NoneType' object has no attribute 'unscale_grads' #1471

Closed RealMimikyu closed 1 month ago

RealMimikyu commented 3 months ago

Is there an existing issue for this?

What happened?

Traceback (most recent call last):██████████████████████████████████████████▌ | 4/5 [00:18<00:04, 4.56s/it] File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\ui_functions.py", line 735, in start_training result = main(class_gen_method=class_gen_method) File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 2003, in main return inner_loop() File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 126, in decorator return function(batch_size, grad_size, prof, *args, **kwargs) File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 496, in inner_loop patch_accelerator_for_fp16_training(accelerator) File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\utils\utils.py", line 342, in patch_accelerator_for_fp16_training org_unscale_grads = accelerator.scaler.unscale_grads AttributeError: 'NoneType' object has no attribute 'unscale_grads'

This popped up when i tried training a lora

Steps to reproduce the problem

  1. Go to Dreambooth tab
  2. Press Enable LORA on parameters tab
  3. see what happens.

Commit and libraries

Traceback (most recent call last):██████████████████████████████████████████▌ | 4/5 [00:18<00:04, 4.56s/it] File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\ui_functions.py", line 735, in start_training result = main(class_gen_method=class_gen_method) File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 2003, in main return inner_loop() File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 126, in decorator return function(batch_size, grad_size, prof, *args, **kwargs) File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 496, in inner_loop patch_accelerator_for_fp16_training(accelerator) File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\utils\utils.py", line 342, in patch_accelerator_for_fp16_training org_unscale_grads = accelerator.scaler.unscale_grads AttributeError: 'NoneType' object has no attribute 'unscale_grads'

Command Line Arguments

No

Console logs

Traceback (most recent call last):██████████████████████████████████████████▌             | 4/5 [00:18<00:04,  4.56s/it]
  File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\ui_functions.py", line 735, in start_training
    result = main(class_gen_method=class_gen_method)
  File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 2003, in main
    return inner_loop()
  File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 126, in decorator
    return function(batch_size, grad_size, prof, *args, **kwargs)
  File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 496, in inner_loop
    patch_accelerator_for_fp16_training(accelerator)
  File "F:\AiReps\Stable Diffusion\extensions\sd_dreambooth_extension\dreambooth\utils\utils.py", line 342, in patch_accelerator_for_fp16_training
    org_unscale_grads = accelerator.scaler.unscale_grads
AttributeError: 'NoneType' object has no attribute 'unscale_grads'

Additional information

No response

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 14 days with no activity. Remove stale label or comment or this will be closed in 30 days