Skip to content

Commit

Permalink
Add jupyter/pytorch-notebook (#1936)
Browse files Browse the repository at this point in the history
* Add PyTorch image

* Fix linting errors

* Fix link to pytorch website

* Address review comments

* Fix PytorchVersionTagger

* Remove "+cpu" suffix from pytorch version tag

* Update selecting.md

* Rename pytorch-notebook/.dockerignore to images/pytorch-notebook/.dockerignore

* Rename pytorch-notebook/Dockerfile to images/pytorch-notebook/Dockerfile

* Rename pytorch-notebook/README.md to images/pytorch-notebook/README.md

* Add pytorch-notebook to registry-overviews

* Add registry to pytorch image

* Use Quay.io

* Remove incorrect link

* Update action.yml

* Update docker.yml

* Remove information about Docker Hub, because this image won't be uploaded to Docker Hub

* Update docker.yml

* Update action.yml

* Add pytorch-notebook to registry-move.yml

---------

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@gmail.com>
  • Loading branch information
3 people authored Nov 22, 2023
1 parent 0a75e3d commit 278dd76
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ body:
- julia-notebook
- minimal-notebook
- pyspark-notebook
- pytorch-notebook
- r-notebook
- scipy-notebook
- tensorflow-notebook
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ body:
- julia-notebook
- minimal-notebook
- pyspark-notebook
- pytorch-notebook
- r-notebook
- scipy-notebook
- tensorflow-notebook
Expand Down
24 changes: 24 additions & 0 deletions .github/actions/download-manifests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ runs:
with:
name: tensorflow-notebook-x86_64-history_line
path: ${{ inputs.hist-lines-dir }}
- name: Download artifact 📥
uses: actions/download-artifact@v3
if: inputs.fast-build == 'false'
with:
name: pytorch-notebook-aarch64-history_line
path: ${{ inputs.hist-lines-dir }}
- name: Download artifact 📥
uses: actions/download-artifact@v3
if: inputs.fast-build == 'false'
with:
name: pytorch-notebook-x86_64-history_line
path: ${{ inputs.hist-lines-dir }}
- name: Download artifact 📥
uses: actions/download-artifact@v3
if: inputs.fast-build == 'false'
Expand Down Expand Up @@ -216,6 +228,18 @@ runs:
with:
name: tensorflow-notebook-x86_64-manifest
path: ${{ inputs.manifests-dir }}
- name: Download artifact 📥
uses: actions/download-artifact@v3
if: inputs.fast-build == 'false'
with:
name: pytorch-notebook-aarch64-manifest
path: ${{ inputs.manifests-dir }}
- name: Download artifact 📥
uses: actions/download-artifact@v3
if: inputs.fast-build == 'false'
with:
name: pytorch-notebook-x86_64-manifest
path: ${{ inputs.manifests-dir }}
- name: Download artifact 📥
uses: actions/download-artifact@v3
if: inputs.fast-build == 'false'
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,26 @@ jobs:
needs: [x86_64-scipy]
if: ${{ !contains(github.event.pull_request.title, '[FAST_BUILD]') }}

aarch64-pytorch:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
parent-image: scipy-notebook
image: pytorch-notebook
platform: aarch64
runs-on: ARM64
needs: [aarch64-scipy]
if: github.repository_owner == 'jupyter' && !contains(github.event.pull_request.title, '[FAST_BUILD]')

x86_64-pytorch:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
parent-image: scipy-notebook
image: pytorch-notebook
platform: x86_64
runs-on: ubuntu-latest
needs: [x86_64-scipy]
if: ${{ !contains(github.event.pull_request.title, '[FAST_BUILD]') }}

aarch64-datascience:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
Expand Down Expand Up @@ -277,6 +297,7 @@ jobs:
r-notebook,
julia-notebook,
tensorflow-notebook,
pytorch-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
Expand All @@ -290,6 +311,7 @@ jobs:
aarch64-r,
aarch64-julia,
aarch64-tensorflow,
aarch64-pytorch,
aarch64-datascience,
aarch64-pyspark,
aarch64-all-spark,
Expand Down Expand Up @@ -329,6 +351,7 @@ jobs:
r-notebook,
julia-notebook,
tensorflow-notebook,
pytorch-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
Expand All @@ -342,6 +365,7 @@ jobs:
x86_64-r,
x86_64-julia,
x86_64-tensorflow,
x86_64-pytorch,
x86_64-datascience,
x86_64-pyspark,
x86_64-all-spark,
Expand Down Expand Up @@ -380,6 +404,7 @@ jobs:
r-notebook,
julia-notebook,
tensorflow-notebook,
pytorch-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/registry-move.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
r-notebook,
julia-notebook,
tensorflow-notebook,
pytorch-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/registry-overviews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
r-notebook,
julia-notebook,
tensorflow-notebook,
pytorch-notebook,
datascience-notebook,
pyspark-notebook,
all-spark-notebook,
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ALL_IMAGES:= \
julia-notebook \
scipy-notebook \
tensorflow-notebook \
pytorch-notebook \
datascience-notebook \
pyspark-notebook \
all-spark-notebook
Expand Down
31 changes: 19 additions & 12 deletions docs/images/inherit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion docs/using/selecting.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ It contains:
- Everything in `jupyter/scipy-notebook` and its ancestor images
- [tensorflow](https://www.tensorflow.org/) machine learning library

### jupyter/pytorch-notebook

[Source on GitHub](https://github.com/jupyter/docker-stacks/tree/main/images/pytorch-notebook) |
[Dockerfile commit history](https://github.com/jupyter/docker-stacks/commits/main/images/pytorch-notebook/Dockerfile) |
[Quay.io image tags](https://quay.io/repository/jupyter/pytorch-notebook?tab=tags)

`jupyter/pytorch-notebook` includes popular Python deep learning libraries.

- Everything in `jupyter/scipy-notebook` and its ancestor images
- [pytorch](https://pytorch.org/) machine learning library

### jupyter/datascience-notebook

[Source on GitHub](https://github.com/jupyter/docker-stacks/tree/main/images/datascience-notebook) |
Expand Down Expand Up @@ -234,7 +245,7 @@ The following diagram depicts the build dependency tree of the core images. (i.e
Any given image inherits the complete content of all ancestor images pointing to it.

[![Image inheritance
diagram](../images/inherit.svg)](http://interactive.blockdiag.com/?compression=deflate&src=eJyFjkFuwkAMRfecwsqKLuYACMEJuqPLSshJHDAZ7GjGIwSIuzPTRaWJWmX7_vP_br12Y894gucKoKcBk7fjoGKRHwQ72Gwz18AkhsYqGU0aLCDbdpWjJrVJLH3L-vPrADe2c85ZDAJ5wkgfDbg99HmFgouG3RjdoEn6n7ZS_l9W7trc4ESNWtWxyBUoxpWFr-grac6KFzue7pVVk-I0RhI1DF5vv7z5W80vYqYkHS1Oh0XjkjzjwnPTPU4Yxsqas-Kh925uvt4imKoO)
diagram](../images/inherit.svg)](http://interactive.blockdiag.com/?compression=deflate&src=eJyFz8FOwzAMgOH7nsLqCQ55ADTBE3CDIxJyU5eZZnaUOJoK2rsv4YCUSlOvv784yRjULxPjF_weACaasQT7nFUs8w_BMzwda9fEJIbGKjVFTZaQ7Xioo6GMRax8yMPr-xtc2E51zmKQKBBmehzAvcBUb6HksqFfspu1yPS3rS2_N2vnxrrBiRqNqkvDXWjizMJnDB3atuay57h2qi_NDEaSNc1BL_99uEPjapr8ac_Vr2CtJJ52n5h2xXcJjDufiGuOmJZObVtzGILbyusNkda3zw)

### Builds

Expand Down
2 changes: 2 additions & 0 deletions images/pytorch-notebook/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Documentation
README.md
21 changes: 21 additions & 0 deletions images/pytorch-notebook/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
ARG REGISTRY=quay.io
ARG OWNER=jupyter
ARG BASE_CONTAINER=$REGISTRY/$OWNER/scipy-notebook
FROM $BASE_CONTAINER

LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"

# Fix: https://github.com/hadolint/hadolint/wiki/DL4006
# Fix: https://github.com/koalaman/shellcheck/wiki/SC3014
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install PyTorch with pip
# hadolint ignore=DL3013
RUN pip install --no-cache-dir --index-url 'https://download.pytorch.org/whl/cpu' \
'torch' \
'torchvision' \
'torchaudio' && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
8 changes: 8 additions & 0 deletions images/pytorch-notebook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Jupyter Notebook Deep Learning Stack

GitHub Actions in the <https://github.com/jupyter/docker-stacks> project builds and pushes this image to the Registry.

Please visit the project documentation site for help to use and contribute to this image and others.

- [Jupyter Docker Stacks on ReadTheDocs](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html)
- [Selecting an Image :: Core Stacks :: jupyter/pytorch-notebook](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-pytorch-notebook)
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ ignore_missing_imports = True

[mypy-tensorflow.*]
ignore_missing_imports = True

[mypy-torch.*]
ignore_missing_imports = True
4 changes: 4 additions & 0 deletions tagging/images_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
JupyterNotebookVersionTagger,
PythonMajorMinorVersionTagger,
PythonVersionTagger,
PytorchVersionTagger,
RVersionTagger,
SHATagger,
SparkVersionTagger,
Expand Down Expand Up @@ -72,6 +73,9 @@ class ImageDescription:
"tensorflow-notebook": ImageDescription(
parent_image="scipy-notebook", taggers=[TensorflowVersionTagger()]
),
"pytorch-notebook": ImageDescription(
parent_image="scipy-notebook", taggers=[PytorchVersionTagger()]
),
"datascience-notebook": ImageDescription(
parent_image="scipy-notebook",
taggers=[RVersionTagger(), JuliaVersionTagger()],
Expand Down
6 changes: 6 additions & 0 deletions tagging/taggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ def tag_value(container: Container) -> str:
return "tensorflow-" + _get_pip_package_version(container, "tensorflow")


class PytorchVersionTagger(TaggerInterface):
@staticmethod
def tag_value(container: Container) -> str:
return "pytorch-" + _get_pip_package_version(container, "torch").split("+")[0]


class JuliaVersionTagger(TaggerInterface):
@staticmethod
def tag_value(container: Container) -> str:
Expand Down
1 change: 1 addition & 0 deletions tests/images_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"r-notebook": "minimal-notebook",
"julia-notebook": "minimal-notebook",
"tensorflow-notebook": "scipy-notebook",
"pytorch-notebook": "scipy-notebook",
"datascience-notebook": "scipy-notebook",
"pyspark-notebook": "scipy-notebook",
"all-spark-notebook": "pyspark-notebook",
Expand Down
5 changes: 5 additions & 0 deletions tests/pytorch-notebook/units/unit_pytorch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import torch

print(torch.tensor([[1.0, 4.0, 7.0], [4.0, 9.0, 11.0]]))

0 comments on commit 278dd76

Please sign in to comment.