windows11 wsl2 ubuntu20.04安装vision mamba并进行测试
windows11 wsl2 ubuntu20.04安装vision mamba
安装流程
- vision mamba安装了半天才跑通,记录一下流程
- 在wsl上安装cuda
wget https://developer.download.nvidia.cn/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sh cuda_11.8.0_520.61.05_linux.run
# 然后安装流程安装完成cuda 11.8
- 使用conda 创建虚拟环境,然后安装依赖库
conda create -n mb python=3.10.13
conda activate mb
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
conda install packaging
- 安装最麻烦的mamba和causal_conv1d
#首先设置cudahome ,不然我的wsl会报错,找不到路径
export CUDA_HOME=/usr/local/cuda
#然后使用pip安装
pip install causal_conv1d==1.1.0
# 安装mamba
git clone https://github.com/state-spaces/mamba.git
cd mamba/
pip install .
# 安装完成后使用vision mamba的mamba_ssm替换虚拟环境中的mamba_ssm
cd ..
git clone https://github.com/hustvl/Vim.git
cd Vim
cp -rf ./mamba-1p1p1/mamba_ssm /home/zc/anaconda3/envs/mb/lib/python3.10/site-packages/
- 安装还没有安装的包
pip install timm mlflow -i https://pypi.tuna.tsinghua.edu.cn/simple
使用cifar-100测试安装成功
- 将datasets.py中的CIFAR路径和download设置好
- 运行测试程序
CUDA_VISIBLE_DEVICES=0 torchrun --master_port=6666 --nproc_per_node=1 main.py --model vim_small_patch16_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --batch-size 20 --drop-path 0.05 --weight-decay 0.05 --lr 1e-3 --num_workers 1 --data-set CIFAR --data-path ./cifar-100-python --output_dir ./output/vim_small_patch16_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --no_amp
- 运行结果
原文地址:https://blog.csdn.net/weixin_46466484/article/details/137819049
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!