XavierXiao / Dreambooth-Stable-Diffusion

Implementation of Dreambooth (https://arxiv.org/abs/2208.12242) with Stable Diffusion
MIT License
7.6k stars 795 forks source link

Bug in a fork "Dreambooth-Stable-Diffusion-cpu" #83

Open NaughtDZ opened 1 year ago

NaughtDZ commented 1 year ago

PS J:\Dreambooth-Stable-Diffusion-cpu> python main.py --base configs/stable-diffusion/v1-finetune_unfrozen.yaml -t --actual_resume ./models/ldm/stable-diffusion-v1/model.ckpt -n brs --data_root ./photo --reg_data_root ./classes/brs --class_word character --logdir ./logs/ File "J:\Dreambooth-Stable-Diffusion-cpu\main.py", line 855 return False ^^^^^^^^^^^^ SyntaxError: 'return' outside function

andreae293 commented 1 year ago

looks like an indentation problem did you modify the script? you may have messed up the indentation or something

if i have to guess your code at line 855 looks like this:

        elif v.lower() in ("no", "false", "f", "n", "0"):
 return False
        else:

but it should be indented like this

        elif v.lower() in ("no", "false", "f", "n", "0"):
            return False
        else:

or just download the original main.py

NaughtDZ commented 1 year ago

looks like an indentation problem did you modify the script? you may have messed up the indentation or something

if i have to guess your code at line 855 looks like this:

        elif v.lower() in ("no", "false", "f", "n", "0"):
 return False
        else:

but it should be indented like this

        elif v.lower() in ("no", "false", "f", "n", "0"):
            return False
        else:

or just download the original main.py

Unfortunately, here is already just this,and keep report error image

I saw a similar problem on the website, but the solution seems to be ineffective? https://stackoverflow.com/questions/7842120/python-return-statement-error-return-outside-function

And even i download main.py file from your link,it still... image

andreae293 commented 1 year ago

my bad, the scripts should end at line 853 anything after is just copypasted garbage i did mistakenly please re-download again main.py

i checked this time and everything works correctly

NaughtDZ commented 1 year ago

my bad, the scripts should end at line 853 anything after is just copypasted garbage i did mistakenly please re-download again main.py

i checked this time and everything works correctly

Thx but it still not work. And I compared the original maiin file and your maiin.py files through the compare plug-in of notepad++, and the result is: identical. image

Could it be that I used Python 3.10.8 to cause this error?

andreae293 commented 1 year ago

im using python 3.8.5 but i had the same error using the original main.py now i deleted everything after line 853 and it works as it should, with no "return outside function" error

the new main.py should not match the old one since they have a different length (853 vs 1660 lines of code) i think you mistakenly used the same old main.py two times img

try again to download main.py or re-download the whole repo just to be sure

NaughtDZ commented 1 year ago

im using python 3.8.5 but i had the same error using the original main.py now i deleted everything after line 853 and it works as it should, with no "return outside function" error

the new main.py should not match the old one since they have a different length (853 vs 1660 lines of code) i think you mistakenly used the same old main.py two times img

try again to download main.py or re-download the whole repo just to be sure

I delete lines manually,and it's working!Thank you!

andreae293 commented 1 year ago

i'm glad it worked and sorry for the time wasting bug. out of curiosity, do you have a lot of RAM or are you using virtual RAM? how many seconds for an iteration? img

NaughtDZ commented 1 year ago

i'm glad it worked and sorry for the time wasting bug. out of curiosity, do you have a lot of RAM or are you using virtual RAM? how many seconds for an iteration? img

My computer has 32G RAM. However, I am still struggling with the subsequent environmental configuration and some minor problems 😂.

andreae293 commented 1 year ago

yeah i get it its always like that when working with ML..it takes a lot of time and effort to correctly setup the environment. let me know if you stumble upon another bug of the cpu repo