stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

FirstStage object has no attribute 'get_first_stage_encoding'

Open SceneryCoaster opened this issue 2 years ago • 5 comments

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<me>.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

SceneryCoaster avatar Aug 21 '22 18:08 SceneryCoaster

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

oxysoft avatar Aug 22 '22 18:08 oxysoft

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

IK3Holy avatar Aug 23 '22 23:08 IK3Holy

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

shade1er avatar Aug 25 '22 00:08 shade1er

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

oxysoft avatar Aug 27 '22 14:08 oxysoft

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

pandoras-rabbithole avatar Aug 31 '22 12:08 pandoras-rabbithole