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

#127
by cjohndesign - opened

https://colab.research.google.com/drive/1d-ib6cpmBzM1SIBEnImDA5GZAoeLOkFx?usp=sharing

On Scheduling and Visualisation

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-46-5c3f5641a280> in <module>
      1 im = Image.open('/content/drive/MyDrive/stablediff/lp/moth1.png').convert('RGB')
      2 im = im.resize((512,512))
----> 3 encoded = pil_to_latent(im)
      4 im

<ipython-input-45-e9e14c141363> in pil_to_latent(input_im)
      6   with torch.no_grad():
      7     latent = vae.encode(to_tensor_tfm(input_im).unsqueeze(0).to(torch_device)*2-1) # Note scaling
----> 8   return 0.18215 * latent.mode() # or .mean or .sample
      9 
     10 def latents_to_pil(latents):

AttributeError: 'AutoencoderKLOutput' object has no attribute 'mode'```

Try

return 0.18215 * latent.latent_dist.mode()

Sign up or log in to comment