栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

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

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

问题描述

模型移植平台展示需要使用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    

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/926345.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号