lavis多模态开源框架学习--安装

安装PyTorch

安装lavis

因为lavis已经发布在pypi中,所以可以直接利用pip安装

pip install salesforce-lavis

测试安装

from lavis.models import model_zoo
print(model_zoo)
# ==================================================
# Architectures                  Types
# ==================================================
# albef_classification           ve
# albef_feature_extractor        base
# albef_nlvr                     nlvr
# albef_pretrain                 base
# albef_retrieval                coco, flickr
# albef_vqa                      vqav2
# alpro_qa                       msrvtt, msvd
# alpro_retrieval                msrvtt, didemo
# blip_caption                   base_coco, large_coco
# blip_classification            base
# blip_feature_extractor         base
# blip_nlvr                      nlvr
# blip_pretrain                  base
# blip_retrieval                 coco, flickr
# blip_vqa                       vqav2, okvqa, aokvqa
# clip_feature_extractor         ViT-B-32, ViT-B-16, ViT-L-14, ViT-L-14-336, RN50
# clip                           ViT-B-32, ViT-B-16, ViT-L-14, ViT-L-14-336, RN50
# gpt_dialogue                   base

问题

1、我之前安装过mxnet,安装好salesforce-lavis后,运行后报出不能从mxnet中导入什么模块,然后我就把mxnet卸载掉, 准备安装mxnet-cu112(个人版本),安装好后还是不行。后来我把mxnet-cu112卸载了,直接安装cpu版本的(pip install mxnet)就没有爆出这个错误了。

2、Cannot import name ‘PROTOCOL_TLS’ from 'urllib3.util.ssl_
这个错误可真是让人有点头痛, 查了资料说是版本太高了,需要降低版本。
Github上说低版本的这个功能存在安全问题, 所以工作人员就把这个功能给干掉了。后来我直接安装了最低版本,哇塞, 真的解决了。但是,毕竟是低版本, 你懂的,又出现了该包缺少其他东西。所以就脑壳痛。(cannot import name DependencyWarning)

没办法, 我只能一个版本一个版本进行尝试。后来也没有成功。脑壳痛!!!!!!

最后,我破罐子破摔直接把urllib3给干掉(pip uninstall urllib3),然后再直接安装(pip install urllib3),哇塞, 可以了, 哈哈哈,奶奶的腿。

但是, 还是有个警告:

RequestsDependencyWarning: urllib3 (1.26.14) or chardet (3.0.4) doesn't match a supported version!  warnings.warn("urllib3 ({0}) or chardet ({1}) doesn't match a supported "

== 解决方法==
卸载requests ( 注意后面有个s)
然后重新安装( 没有指定版本, 应该是最新版本, 然后就解决了)

过程中的其他操作

为了安装mxnet-cu112,我又安装了cuda, 和cudnn,唉唉唉

按照安装PyTorch, lavis的步骤出现下面问题

Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pycocotools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-38
      creating build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\coco.py -> build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\cocoeval.py -> build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\mask.py -> build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\__init__.py -> build\lib.win-amd64-cpython-38\pycocotools
      running build_ext
      cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
      building 'pycocotools._mask' extension
      C:\Users\Administrator\AppData\Local\Temp\pip-build-env-z78h1xoo\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now 
(Py2). This will change in a later release! File: C:\Users\Administrator\AppData\Local\Temp\pip-install-gfblci3i\pycocotools_533149cdd77c40079bd8c05a01663472\pycocotools\_mask.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

解决方法

1、安装pycocotools

pip install pycocotools-windows

2、安装VS
安装方法如下:
https://zhuanlan.zhihu.com/p/165008313
安装完之后重启

3、安装lavis

pip install salesforce-lavis
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值