【Docker】记录帖,拉取docker镜像torch1.8.1创建mmfewshot环境

24 篇文章 0 订阅
16 篇文章 0 订阅

问题描述

模型移植平台展示需要使用torch1.8.1,需要使用cuda10.2及以上,而实验室安装cuda版本为10.1,不方便升级,故使用镜像创建

一般而言,镜像的显卡驱动与主机共享,但是cuda是独立的

docker pull pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
docker run --gpus all --shm-size=16g -it --name torch181  pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel

nvcc -V
which python
which conda

容器内
python

import torch
torch.__version__
torch.version.cuda
torch.cuda.device_count()
torch.cuda.is_available()
torch.cuda.get_device_properties(0)	显示0卡属性
torch.zeros(1).cuda() 这一行不报错才可以,因为可能显卡不匹配,例如rtx3080下,使用cuda10.1的镜像,torch将无法正常调用cuda

容器内

可能需要先改镜像源
apt install vim
vim /etc/apt/sources.list
添加镜像源后附

apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

pip install mmcv-full==1.4.2 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html
pip install mmcls==0.21.0 mmdet==2.21.0

conda clean --all
git clone https://github.com/open-mmlab/mmfewshot.git /mmfewshot
pip install -r requirements/build.txt
pip install --no-cache-dir -e .
pip install imgaug

宿主机

docker commit torch181 torch181/mmfewshot/xyb:0.1

ubuntu18镜像源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse    

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值