Giter Club home page Giter Club logo

docker-jupyter-pytorch's Introduction

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

docker-jupyter-pytorch's People

Contributors

jxcodetw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.