basujindal / stable-diffusion

Optimized Stable Diffusion modified to run on lower GPU VRAM
Other
3.14k stars 470 forks source link

FirstStage object has no attribute 'get_first_stage_encoding' #16

Open SceneryCoaster opened 2 years ago

SceneryCoaster commented 2 years ago

Traceback (most recent call last): File "optimizedSD/optimized_img2img.py", line 259, in init_latent = modelFS.get_first_stage_encoding(modelFS.encode_first_stage(init_image)) # move to latent space File "C:\Users\.conda\envs\ldm\lib\site-packages\torch\nn\modules\module.py", line 1185, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'FirstStage' object has no attribute 'get_first_stage_encoding'

passed both a jpg and png image to see if it had anything to do with filetype and it does not work for either

oxysoft commented 2 years ago

The optimizedSD scripts don't instantiate the root model which is a ldm.models.diffusion.ddpm.LatentDiffusion object, which has get_first_stage_encoding.

IK3Holy commented 2 years ago

I am also getting this error, there any way to fix it?

shade1er commented 2 years ago

same here. did not find how to fix it atm Oh! and by the way, the regular img2img produce the same error.

oxysoft commented 2 years ago

I found it, in optimizedSD/ there is a ddpm.py file, you must replace the one in stable diffusion with this one.

pandoras-rabbithole commented 2 years ago

thanks. weird, it worked once, and the next time i started it up it won't work anymore. same error. double-checked the file to make sure it didn't magically revert. no idea why this is happening