ModuleNotFoundError: no module named ‘transformers’ | 少将全栈
  • 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

ModuleNotFoundError: no module named ‘transformers’

AI绘画 admin 2年前 (2023-02-02) 3181次浏览 已收录 扫描二维码

使用colab的时候报错:

Disco Diffusion v5.61 [Now with portrait_generator_v001]

地址:https://colab.research.google.com/github/alembics/disco-diffusion/blob/main/Disco_Diffusion.ipynb#scrollTo=InstallDeps&uniqifier=1

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-3c8357fba9cb> in <module>
     46 try:
---> 47     import open_clip
     48 except:

6 frames
ModuleNotFoundError: No module named 'transformers'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
/content/open_clip/src/open_clip/coca_model.py in <module>
     15 from .model import CLIPTextCfg, CLIPVisionCfg, _build_vision_tower, _build_text_tower
     16 from .generation_utils import top_a, top_k, top_p, prepare_inputs_for_generation
---> 17 from transformers import BeamSearchScorer, LogitsProcessorList, MinLengthLogitsProcessor, StoppingCriteriaList, MaxLengthCriteria
     18 
     19 GENERATION_TYPES = {

ModuleNotFoundError: No module named 'transformers'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

如图:

ModuleNotFoundError: no module named 'transformers'

其实很简单就是依赖问题,在报错的代码前加上

!pip install transformers

加上后如下图:

ModuleNotFoundError: no module named 'transformers'

再重新跑一下就正常了哈

ModuleNotFoundError: no module named 'transformers'

喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。