d8ahazard / sd_dreambooth_extension

Other
1.86k stars 282 forks source link

[Bug]: The latest master has a judgment incompatibility when training sd1.5, resulting in a variable of 'NoneType'. #1370

Closed ChengMacsaewe closed 11 months ago

ChengMacsaewe commented 12 months ago

Is there an existing issue for this?

What happened?

Train sd1.5 lora, error: File "~/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/ui_functions.py", line 730, in start_training result = main(class_gen_method=class_gen_method) File "~/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 1809, in main return inner_loop() File "~/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/memory.py", line 126, in decorator return function(batch_size, grad_size, prof, *args, **kwargs) File "~/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 420, in inner_loop and accelerator.unwrap_model(text_encoder_two).dtype != torch.float32 AttributeError: 'NoneType' object has no attribute 'dtype'

Steps to reproduce the problem

any more

Commit and libraries

any more

Command Line Arguments

any more

Console logs

any more

Additional information

You must check the train model type: Modify this file:dreambooth/train_dreambooth.py +420

The detailed code is as follows: if args.model_type == "SDXL" : ---- Add this line of compatibility model type check ¦ ¦ ¦ if ( ¦ ¦ ¦ ¦ ¦ args.stop_text_encoder != 0 ¦ ¦ ¦ ¦ ¦ and accelerator.unwrap_model(text_encoder_two).dtype != torch.float32 ¦ ¦ ¦ ): ¦ ¦ ¦ ¦ logger.warning( ¦ ¦ ¦ ¦ ¦ f"Text encoder loaded as datatype {accelerator.unwrap_model(text_encoder_two).dtype}." ¦ ¦ ¦ ¦ ¦ f" {low_precision_error_string}" ¦ ¦ ¦ ¦ )

github-actions[bot] commented 11 months ago

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

mmoench commented 11 months ago

I had the same issue, but the fix mentioned by the original poster fixed it for me as well. Thank you.