CompVis / stable-diffusion

A latent text-to-image diffusion model
https://ommer-lab.com/research/latent-diffusion-models/
Other
66.61k stars 9.97k forks source link

This Error with AutoEncoder started happening just hours ago #234

Open newsbubbles opened 1 year ago

newsbubbles commented 1 year ago
     56 
     57         # encode the init image into latents and scale the latents
---> 58         init_latents = self.vae.encode(init_image.to(self.device)).sample()
     59         init_latents = 0.18215 * init_latents
     60 

AttributeError: 'AutoencoderKLOutput' object has no attribute 'sample'

I've tried to control the version of diffusers I am using with the Colab... but what gives? Why did it all of the sudden stop working on all of my colabs?

Seqaeon commented 1 year ago

Just Encountered this error as well

gakada commented 1 year ago

That is a change in https://github.com/huggingface/diffusers/releases/tag/v0.3.0, should be used like so now

https://github.com/huggingface/diffusers/blob/83a7bb2aba2d897ab95d96fb03eda10a624080e7/examples/textual_inversion/textual_inversion.py#L499-L501

Lifedecoder commented 3 months ago

use vae.encode(x).latent_dist.sample() might just work