解决ImportError: cannot import name ‘VectorQuantizer2‘ from ‘taming.modules.vqvae.quantize‘

运行中遇到一个错误:ImportError: cannot import name ‘VectorQuantizer2’ from ‘taming.modules.vqvae.quantize’ ,按 https://github.com/CompVis/stable-diffusion/issues/72 中的方法处理,即用 https://github.com/CompVis/taming-transformers/blob/master/taming/modules/vqvae/quantize.py 新文件,替换错误提示文件中的全部内容即可。