1.pytorch 安装网址
https://pytorch.org/get-started/previous-versions/
2.清华源
在国内用 conda 清华源安装 PyTorch 时,无法匹配到 CUDA 版本的问题。
环境准备
OS: Ubuntu 20.04 LTS 如果你用 conda 的话,下面的内容应该同样适用。
为了在国内能够快速安装 PyTorch, 在 ~/.condarc 的设置清华源:
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
auto_activate_base: false
show_channel_urls: true
补充:其中,.yaml文件主要分为name/channels/dependencies三大部分,name即为环境名,对应着执行“部署环境”命令后创建的新环境的名字,channels对应安装依赖项的方式。
3. cuda 网站+cudnn
cuda: https://developer.nvidia.com/cuda-toolkit-archive link
cudnn : https://developer.nvidia.com/rdp/cudnn-archive link
4.主要是mmcv版本不匹配
查看cuda版本号:nvcc -V(V要大写)(踩坑:刚开始使用nvidia -smi查看的,结果显示cuda12.4,但是mmcv官网并没有cuda12.4的匹配版本,于是开始了install 和 uninstall的循环...)
torch版本在requirements.txt文件中查看,我的是torch2.1.2
mmcv官网的匹配文件:https://mmcv.readthedocs.io/en/latest/get_started/installation.html
复制下面的pip 指令,我的是
pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html
2024.12.16更
后来在复现其他代码时又重新下载了mmcv 和mmsegmentation,但是使用上面的方法不奏效
改进:
- 根据torch的版本修改了torchvision的版本,但是仍然不奏效
2.修改python3.10/site-packages/mmseg/_ init _.py文件
MMCV _ MIN == '2.0.0'
MMCV _ MAX == '2.2.1'
原文链接:https://blog.csdn.net/m0_49201875/article/details/143558679