Skip to content

fisharp/jupytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

JuPyTorch 🔥

JupyterLab based data science workspace using PyTorch with NVIDIA® CUDA® GPU support

This repository contains the Dockerfile and files required for building a Docker image of JupyterLab with "batteries included" for Deep Learning with packages and complements related to PyTorch with NVIDIA® CUDA® support, allowing use of the host's GPU(s) inside the containerized JupyterLab instance

:fire:

Introduction

The purpose of this project is to provide an "instant live" out-of-the-box-ready JupyterLab instance for deep learning development (and training) with PyTorch, CUDA and related packages. By simply browsing to localhost at a given port (which defaults to 8888), users can access a pre-configured JupyterLab environment with all the necessary tools and packages installed.

Development Status

⚠️ Note: This project is still in early development and is not yet ready for production use.

We are actively working on this project and welcome any feedback or contributions. Please feel free to open an issue or pull request if you encounter any problems or have suggestions for improvement.

QuickStart

The easiest way to try this docker image is just by directly pulling and running it from its dockerhub registry in "detached mode" with:

docker run -d --rm -p 8888:8888 \
    -e JUPYTER_PASSWORD=anyPassphrase \
    fisharp/jupytorch

and open your preferred web browser to visit your localhost at the specified port 8888

Building the Image

To build the Docker image (after cloning this repository) simply run the following command while inside the docker directory:

docker build -t your-registry/jupytorch .

Replace your-registry with the name of your Docker registry, if applicable.

Running the Container

To run the Docker container, use the following command:

docker run -it --rm -p 8888:8888 -v $(pwd)/subdir/to/your/files:/var/data -e JUPYTER_PASSWORD='YourFailsafePassphrase' -h container_host_name --name custom_container_name your-registry/jupytorch

or spread it out in a multi-line command:

docker run -it --rm \
    -p 8888:8888 \
    -v $(pwd)/subdir/to/your/files:/var/data \
    -e JUPYTER_PASSWORD='YourFailsafePassphrase' \
    -h container_host_name \
    --name custom_container_name \
    your-registry/jupytorch

Replacing again your-registry with the name of your own Docker registry, if applicable.

  • The -it pair starts the container in interactive mode (-i) and attaches a pseudo-TTY (-t).
  • The --rm option instruct docker to completely remove the container as soon as the Jupyter server is shutdown due to user action or in the event of a critical error.
  • --name specifies a custom name for the container
  • -p maps the container port (default 8888) to the host port (also 8888 in this case)
  • The JUPYTER_PASSWORD environment variable added with that -e parameter, sets the JupyterLab login password to YourFailsafePassphrase, which should be replaced with your own password.
  • -v mounts the local directory subdir/to/your/files as a volume inside the container at /var/data.
  • -h sets a custom hostname of the container (internally).

Once the container is up and running, you can access the JupyterLab instance by browsing to http://localhost:8888 in your preferred web browser. You will be prompted for the password you set earlier.

CUDA with NVIDIA® GPUs

If you have installed the proper drivers for your GPUs and the NVIDIA container toolkit (detailed installation instructions here), you can also make use of (all of) the power of your GPUs in any Jupyter Notebook or Python file in your containerized Jupyter Lab, just by including the --gpus all option (as described here) to enable the use of all GPUs in the JupyterLab environment:

docker run -it --rm \
    -p 8888:8888 \
    #...
    --gpus all
    your-registry/jupytorch

Included Packages

This Docker image includes the following packages, among others, the following:

Component Package Repository Documentation
PyTorch torch pytorch/pytorch pytorch.org
Torchvision torchvision pytorch/vision pytorch.org/docs/stable/torchvision/
Torchaudio torchaudio pytorch/audio pytorch.org/audio/stable/index.html
CUDA torch.cuda (installed with torch==2.0.0+cu117) nvidia/nvidia-docker docs.nvidia.com/cuda/
scikit-learn scikit-learn scikit-learn/scikit-learn scikit-learn.org
Pandas pandas pandas-dev/pandas pandas.pydata.org
Matplotlib matplotlib matplotlib/matplotlib matplotlib.org
NumPy numpy numpy/numpy numpy.org
SymPy sympy sympy/sympy docs.sympy.org

Also a few JupyterLab extensions (including code linters, formatters and themes)

References

Similar Projects

There are some other interesting projects, similar to this one (and for sure in a more mature state) that you may find compelling to browse and try. For instance (just to mention a few that are all worth exploring):

License

This project is licensed under the MIT license.

About

JupyterLab based data science workspace using PyTorch with NVIDIA® CUDA® GPU support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published