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

ImportError: cannot import name 'VectorQuantizer2'

Open navalguijo opened this issue 3 years ago • 10 comments
trafficstars

I am getting this error ImportError: cannot import name 'VectorQuantizer2' from 'taming.modules.vqvae.quantize'

Any ideas on how to solve it?

navalguijo avatar Aug 23 '22 19:08 navalguijo

Replace quantize.py on your machine with this file

https://github.com/CompVis/taming-transformers/blob/master/taming/modules/vqvae/quantize.py

phudtran avatar Aug 23 '22 19:08 phudtran

Replace quantize.py on your machine with this file

https://github.com/CompVis/taming-transformers/blob/master/taming/modules/vqvae/quantize.py

Thanx! @phudtran that helped!

navalguijo avatar Aug 24 '22 12:08 navalguijo

https://github.com/CompVis/stable-diffusion/issues/84#issuecomment-1227388976

fullkawa avatar Aug 25 '22 15:08 fullkawa

Replace quantize.py on your machine with this file

https://github.com/CompVis/taming-transformers/blob/master/taming/modules/vqvae/quantize.py

Thanks, I don't know why but this fixed my https://github.com/carson-katri/dream-textures

ManuLinares avatar Oct 09 '22 18:10 ManuLinares

Have you tried to do pip install taming-transformers-rom1504

https://github.com/CompVis/stable-diffusion/issues/84

SilviaTormo avatar Oct 13 '22 13:10 SilviaTormo

@navalguijo I think this issue can be closed

phudtran avatar Oct 13 '22 17:10 phudtran

Have you tried to do pip install taming-transformers-rom1504

#84

Worked for me :)

andrealesani avatar Oct 14 '22 23:10 andrealesani

ok so replacing the file works, is the issue due to SD using a deprecated Quantizer? wouldnt it be easier just to update the SD code?

manugarri avatar Oct 15 '22 18:10 manugarri

Replace quantize.py on your machine with this file

https://github.com/CompVis/taming-transformers/blob/master/taming/modules/vqvae/quantize.py

win11 Home,3050laptop,done with this.

ZhianLin avatar Dec 31 '22 10:12 ZhianLin

Does anyone have a fork of this repo with all these fixes?

geocine avatar Jan 13 '23 14:01 geocine

Replace quantize.py on your machine with this file

https://github.com/CompVis/taming-transformers/blob/master/taming/modules/vqvae/quantize.py

I'm wondering where this file located

Victor-Cooper avatar Jun 10 '23 11:06 Victor-Cooper

Replace quantize.py on your machine with this file https://github.com/CompVis/taming-transformers/blob/master/taming/modules/vqvae/quantize.py

I'm wondering where this file located

In my pc,file is located in stable-diffusion-webui\python\Lib\site-packages\taming\modules\vqvae\

ZhianLin avatar Jun 11 '23 08:06 ZhianLin

on\Lib\site-pack

Thanks! However I don't have python folder in my case

Victor-Cooper avatar Jun 11 '23 08:06 Victor-Cooper