当前位置:   article > 正文

Bug解决:ModuleNotFoundError: No module named ‘taming‘_modulenotfounderror: no module named 'taming

modulenotfounderror: no module named 'taming

from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer ModuleNotFoundError: No module named 'taming'

安装 taming-transformers时,出现了以下两个报错:


报错一:

from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
ModuleNotFoundError: No module named 'taming'

报错二:

from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
ImportError: cannot import name 'VectorQuantizer2' from 'taming.modules.vqvae.quantize' (/home/usr/anaconda3/envs/xxx/lib/python3.8/site-packages/taming_transformers-0.0.1-py3.8.egg/taming/modules/vqvae/quantize.py)


首先来看第一个报错:
个人尝试了以下前三种方案均无法解决,第四种方案会出现第二个错误:
(1)pip install taming-transformers 安装 不报错但是运行提示包不存在
(2)git clone https://github.com/CompVis/taming-transformers.git
         pip install -e /path/to/taming-transformers
 (3) 从pypi页taming-transformers · PyPI下载whl文件

pip install path/to/taming_transformers-0.0.1-py3-none-any.whl

image.png



(4)下载pypi页的压缩文件解压后安装

  1. wget https://files.pythonhosted.org/packages/03/ba/b22d13b38dee3805982a3ee2ef03234f11b6f26aa6220c92b23a0fc760a3/taming-transformers-0.0.1.tar.gz
  2. tar -zxvf taming-transformers-0.0.1.tar.gz
  3. cd taming-transformers-0.0.1
  4. python setup.py install

安装完成后变为了报错二:

ImportError: cannot import name 'VectorQuantizer2' from 'taming.modules.vqvae.quantize'

查看 quantize.py 里边值确实没有实现 VectorQuantizer2, 于是将 autoencoder.py中

# from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer


改为:

from taming.modules.vqvae.quantize import VectorQuantizer as VectorQuantizer

报错成功解决。

image.png

image.png

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/524354
推荐阅读
相关标签
  

闽ICP备14008679号