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
### 配置Git以解决`git不是内部或外部命令` #### 下载并安装Git 当遇到`'git' 不是内部或外部命令,也不是可运行的程序 或批处理文件`这一错误时,意味着当前系统未能找到Git命令的位置[^1]。为了使Windows能够识别`git`命令,在本地计算机上需下载并安装适用于Windows平台的Git软件。 访问官方网站[https://git-scm.com/download/win](https://git-scm.com/download/win),选择适合操作系统的64位版本进行下载。完成下载后启动安装向导,遵循默认选项逐步完成整个过程即可[^2]。 #### 设置环境变量 即使已经完成了Git的安装工作,如果系统依旧报告找不到该命令,则可能是由于环境变量未被正确更新所致。此时应该手动将Git所在的路径加入到全局PATH环境中去: - 查找Git的具体安装位置,默认情况下位于`C:\Program Files\Git\bin`; - 右键单击“此电脑”,选取“属性”-> “高级系统设置” -> "环境变量..."按钮进入编辑界面; - 在“系统变量”列表里定位名为`Path`的一项,并点击下方的“编辑...” - 添加新条目指向上述提到的Git bin目录地址;注意多个路径间应保持分号(`;`)分割形式; - 应用更改关闭对话框后再新开一个CMD窗口测试是否能正常调用`git --version`获取版本信息作为验证手段[^4]。 #### 使用Anaconda Prompt的情况 对于那些习惯于利用Anaconda管理Python开发环境的朋友来说,可能会发现即便是在常规CMD中可以正常使用Git的情况下,Anaconda Prompt却依然无法解析`git`指令。针对这种情况建议直接通过Conda包管理系统来安装Git组件,即执行如下命令: ```shell conda install git ``` 这一步骤完成后应当能够在任何基于Miniconda/Anaconda构建出来的终端内无障碍地运用Git工具集了[^3]。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值