PyTorch 的 Docker 镜像

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37674858/article/details/89572030

Docker Hub 地址

已经编译好的 Docker Image 在 Docker Hub 上,地址是 https://hub.docker.com/r/anibali/pytorch/。例如,你想使用 CUDA 9.2 版本,则使用下列命令:

1

$ docker pull anibali/pytorch:cuda-9.2

现在支持的版本有:

Image tag CUDA PyTorch
no-cuda None 0.4.1
cuda-9.2 9.2 0.4.1
cuda-9.0 9.0 0.4.1
cuda-8.0 8.0 0.4.1

下面的版本也有,但不再提供支持:

Image tag CUDA PyTorch
cuda-9.1 9.1 0.4.0
cuda-7.5 7.5 0.3.0

如何运行 PyTorch?

具体运行方法请查看 DockerHub 上的详细说明。

命令行示例:

1

2

3

4

5

6

7

docker run --rm -it --init \

  --runtime=nvidia \

  --ipc=host \

  --user="$(id -u):$(id -g)" \

  --volume=$PWD:/app \

  -e NVIDIA_VISIBLE_DEVICES=0 \

  anibali/pytorch python3 main.py

猜你喜欢

转载自blog.csdn.net/qq_37674858/article/details/89572030
今日推荐