• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jxcodetw/docker-jupyter-pytorch: pytorch with gpu support, jupyter notebook and ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

jxcodetw/docker-jupyter-pytorch

开源软件地址:

https://github.com/jxcodetw/docker-jupyter-pytorch

开源编程语言:

Dockerfile 87.5%

开源软件介绍:

Features

This image contains pytorch, jupyter notebook, tensorboardx, and other useful python packages (See Dockerfile).
Once instantiated, it'll run a jupyter notebook server for you (See start.sh).

Default workdir is /workspace which is the root folder for jupyter notebook.
You can mount the folder in your host os to /workspace.

You can run this image with your own user/group. So that the files created won't change the owner/group to root.

Requirements

You'll need nvidia-docker v2 to run with gpu support.
And for the driver issue please refer to FAQs.

Example Usage

$ NV_GPU=0,1 nvidia-docker run -it \
--name testorch \
-u $(id -u ${USER}):$(id -g ${USER}) \
-v $PWD:/workspace \
jxcodetw/jupyter-pytorch

# arguments
# NV_GPU controls gpu isolation
# --name [your custom name]
# -u save file with permission as current user
# $PWD mount current directory to jupyter's startup folder (/workspace)

FAQs

In this FAQ, there are the solutions I used but not necessarily the best approaches :p.

Which Nvidia driver version to use?

This image inherited from pytorch/pytorch:latest. You should check the cuda version they used. https://hub.docker.com/r/pytorch/pytorch
I guess they build the image from this file in their source code repository.
https://github.com/pytorch/pytorch/blob/master/docker/pytorch/Dockerfile

By the time this image is created they use nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 https://hub.docker.com/r/nvidia/cuda/

And some CUDA version might need specific version of driver to work.
For your information, the output from my nvidia-smi is:

NVIDIA-SMI 410.78       Driver Version: 410.78       CUDA Version: 10.0

How to get token for jupyter notebook?

you just run with -it flags and you will attach to the container and see the output from jupyter notebook.
After copying the token, press Ctrl+P, Ctrl+Q to detach from the container.

If you start the container with -dit flags then you should print the logs to get the token.

$ docker logs [container name or id]

How do I know the container's IP address?

To access the notebook you'll need to know the ip of the container and connect to the 8888 port.

$ docker inspect -f \
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \
[container name or id]

Then you can access the jupyter notebook via http://172.x.x.x/?token=asdfasdfasdf...asdf

If you run the container on your remote server and you want to access to it on your local machine.
You can use ssh tunnels:

ssh -L [local_port]:172.x.x.x:8888 [user]@[server-ip]
# if you want to learn more what it is. There's a tons of tutorial on the int.ernet

Then open your browser to http://localhost:[local_port]/?token=asdfadsfasdf...asdf

How do I set the visible GPUs in container?

Reference: https://github.com/NVIDIA/nvidia-docker/wiki/nvidia-docker#gpu-isolation

$ NV_GPU=0,1 nvidia-docker ...

# For example, if you have two gpus on your computer
$ NV_GPU=0 nvidia-docker ... # first container
$ NV_GPU=1 nvidia-docker ... # second container



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap