diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2efad71bf8..064028d4ca 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -26,6 +26,7 @@ body: - julia-notebook - minimal-notebook - pyspark-notebook + - pytorch-notebook - r-notebook - scipy-notebook - tensorflow-notebook diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 0fd90c0425..f0da40624e 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -24,6 +24,7 @@ body: - julia-notebook - minimal-notebook - pyspark-notebook + - pytorch-notebook - r-notebook - scipy-notebook - tensorflow-notebook diff --git a/.github/actions/download-manifests/action.yml b/.github/actions/download-manifests/action.yml index 350510cf8e..ddc26a826e 100644 --- a/.github/actions/download-manifests/action.yml +++ b/.github/actions/download-manifests/action.yml @@ -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' @@ -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' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4046c19b25..9ab196599a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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: @@ -277,6 +297,7 @@ jobs: r-notebook, julia-notebook, tensorflow-notebook, + pytorch-notebook, datascience-notebook, pyspark-notebook, all-spark-notebook, @@ -290,6 +311,7 @@ jobs: aarch64-r, aarch64-julia, aarch64-tensorflow, + aarch64-pytorch, aarch64-datascience, aarch64-pyspark, aarch64-all-spark, @@ -329,6 +351,7 @@ jobs: r-notebook, julia-notebook, tensorflow-notebook, + pytorch-notebook, datascience-notebook, pyspark-notebook, all-spark-notebook, @@ -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, @@ -380,6 +404,7 @@ jobs: r-notebook, julia-notebook, tensorflow-notebook, + pytorch-notebook, datascience-notebook, pyspark-notebook, all-spark-notebook, diff --git a/.github/workflows/registry-move.yml b/.github/workflows/registry-move.yml index e5c37c91bb..09ef3d28a2 100644 --- a/.github/workflows/registry-move.yml +++ b/.github/workflows/registry-move.yml @@ -51,6 +51,7 @@ jobs: r-notebook, julia-notebook, tensorflow-notebook, + pytorch-notebook, datascience-notebook, pyspark-notebook, all-spark-notebook, diff --git a/.github/workflows/registry-overviews.yml b/.github/workflows/registry-overviews.yml index f4914300e0..91a6b1f4bc 100644 --- a/.github/workflows/registry-overviews.yml +++ b/.github/workflows/registry-overviews.yml @@ -42,6 +42,7 @@ jobs: r-notebook, julia-notebook, tensorflow-notebook, + pytorch-notebook, datascience-notebook, pyspark-notebook, all-spark-notebook, diff --git a/Makefile b/Makefile index e79f133f88..6e28f76229 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ ALL_IMAGES:= \ julia-notebook \ scipy-notebook \ tensorflow-notebook \ + pytorch-notebook \ datascience-notebook \ pyspark-notebook \ all-spark-notebook diff --git a/docs/images/inherit.svg b/docs/images/inherit.svg index 0f5467a403..5324df8948 100644 --- a/docs/images/inherit.svg +++ b/docs/images/inherit.svg @@ -1,6 +1,6 @@ - + @@ -18,7 +18,8 @@ - + + ubuntu (LTS with point release) @@ -37,37 +38,43 @@ tensorflow-notebook - datascience-notebook + pytorch-notebook - pyspark-notebook - - all-spark-notebook + datascience-notebook + + pyspark-notebook + + all-spark-notebook - - + + + + + + + + - - - - + + diff --git a/docs/using/selecting.md b/docs/using/selecting.md index 08f84f8cec..2739930374 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -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) | @@ -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 diff --git a/images/pytorch-notebook/.dockerignore b/images/pytorch-notebook/.dockerignore new file mode 100644 index 0000000000..9dea340f35 --- /dev/null +++ b/images/pytorch-notebook/.dockerignore @@ -0,0 +1,2 @@ +# Documentation +README.md diff --git a/images/pytorch-notebook/Dockerfile b/images/pytorch-notebook/Dockerfile new file mode 100644 index 0000000000..f1a5c5400e --- /dev/null +++ b/images/pytorch-notebook/Dockerfile @@ -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 " + +# 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}" diff --git a/images/pytorch-notebook/README.md b/images/pytorch-notebook/README.md new file mode 100644 index 0000000000..72cc65c194 --- /dev/null +++ b/images/pytorch-notebook/README.md @@ -0,0 +1,8 @@ +# Jupyter Notebook Deep Learning Stack + +GitHub Actions in the 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) diff --git a/mypy.ini b/mypy.ini index decc686c29..3e20bf5bd9 100644 --- a/mypy.ini +++ b/mypy.ini @@ -41,3 +41,6 @@ ignore_missing_imports = True [mypy-tensorflow.*] ignore_missing_imports = True + +[mypy-torch.*] +ignore_missing_imports = True diff --git a/tagging/images_hierarchy.py b/tagging/images_hierarchy.py index 7a0831987f..f4145876c7 100644 --- a/tagging/images_hierarchy.py +++ b/tagging/images_hierarchy.py @@ -21,6 +21,7 @@ JupyterNotebookVersionTagger, PythonMajorMinorVersionTagger, PythonVersionTagger, + PytorchVersionTagger, RVersionTagger, SHATagger, SparkVersionTagger, @@ -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()], diff --git a/tagging/taggers.py b/tagging/taggers.py index 8553711718..0aee5188e3 100644 --- a/tagging/taggers.py +++ b/tagging/taggers.py @@ -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: diff --git a/tests/images_hierarchy.py b/tests/images_hierarchy.py index fc0240cd94..193ec2708a 100644 --- a/tests/images_hierarchy.py +++ b/tests/images_hierarchy.py @@ -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", diff --git a/tests/pytorch-notebook/units/unit_pytorch.py b/tests/pytorch-notebook/units/unit_pytorch.py new file mode 100644 index 0000000000..1b739a5924 --- /dev/null +++ b/tests/pytorch-notebook/units/unit_pytorch.py @@ -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]]))