CMT(Cross Modal Transformer)实验环境搭建

本文详细指导如何在Ubuntu20.04系统上创建Python3.8虚拟环境,并通过conda和pip安装PyTorch、MMDet、MMSegmentation、MMDetection3D等关键库,包括离线安装、CUDA版本确认,以及推荐源码编译Flash-Attention库,以便进行数据集训练。
摘要由CSDN通过智能技术生成

项目地址:https://github.com/junjie18/CMT
论文地址:https://arxiv.org/pdf/2301.01283.pdf
环境:Ubuntu 20.04、cuda 11.1、python 3.8
1.创建虚拟环境CMT

conda create -n CMT python=3.8 -y
conda activate CMT

2.安装pytorch的GPU版本,在这里我选择了离线安装,直接下载whl文件,然后pip安装。whl官方的地址是whl传送门,或者另一个传送门

pip install torch-1.9.0+cu111-cp38-cp38-linux_x86_64.whl  torchvision-0.10.0+cu111-cp38-cp38-linux_x86_64.whl torchaudio-0.9.0-cp38-cp38-linux_x86_64.whl

也可以用官方命令安装(你连了外网的情况下)

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

3.安装mmcv-full 1.6.0

pip install mmcv-full==1.6.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html

4.安装mmdet mmsegmentation

pip install mmdet==2.24.0 mmsegmentation==0.29.1

5.安装mmdet3d,GitHub访问太慢可以手动去下载tags里面v1.0.0rc5 版本的代码,然后直接执行最后一步 pip install -v -e . 的命令就行。过程中如果看到关于CUDA的报错就检查cuda版本对没对。

git clone https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
git checkout v1.0.0rc5 
pip install -v -e . -i https://pypi.tuna.tsinghua.edu.cn/simple

8.安装spconv-cu111==2.1.21

pip install spconv-cu111==2.1.21

9.安装flash-attn == 0.2.2,(加速attention,具体还没读过论文),我这里源码编译也挺慢的(好像半小时,具体多久没太注意),用pip下载估计会更慢,所以还是推荐源码编译。

git clone -b 'v0.2.2' https://github.com/Dao-AILab/flash-attention.git --single-branch flash-attn
cd flash-attn
python setup.py install

到这里GitHub仓库给出的requirements就装完了,下一步是准备数据集进行训练。

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值