2021-01-29 16:01:03 +00:00
|
|
|
# Copyright The Lightning AI team.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2022-10-20 08:33:56 +00:00
|
|
|
ARG PYTORCH_VERSION=22.09
|
2021-08-02 16:05:36 +00:00
|
|
|
|
2021-05-07 11:13:54 +00:00
|
|
|
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
|
2021-08-02 16:05:36 +00:00
|
|
|
FROM nvcr.io/nvidia/pytorch:${PYTORCH_VERSION}-py3
|
2021-01-29 16:01:03 +00:00
|
|
|
|
2022-06-15 23:33:43 +00:00
|
|
|
LABEL maintainer="Lightning-AI <https://github.com/Lightning-AI>"
|
2021-01-29 16:01:03 +00:00
|
|
|
|
|
|
|
ARG LIGHTNING_VERSION=""
|
|
|
|
|
2021-04-27 19:29:49 +00:00
|
|
|
RUN python -c "import torch ; print(torch.__version__)" >> torch_version.info
|
|
|
|
|
2023-12-21 16:41:49 +00:00
|
|
|
COPY ./ /workspace/pytorch-lightning/
|
2021-01-29 16:01:03 +00:00
|
|
|
|
|
|
|
RUN \
|
2021-04-13 09:06:06 +00:00
|
|
|
cd /workspace && \
|
2021-03-29 08:39:06 +00:00
|
|
|
# replace by specific version if asked
|
2021-03-19 21:25:46 +00:00
|
|
|
if [ ! -z "$LIGHTNING_VERSION" ] ; then \
|
2023-12-21 16:41:49 +00:00
|
|
|
rm -rf pytorch-lightning ; \
|
|
|
|
git clone https://github.com/Lightning-AI/pytorch-lightning.git ; \
|
|
|
|
cd pytorch-lightning ; \
|
2021-11-29 14:14:37 +00:00
|
|
|
git checkout ${LIGHTNING_VERSION} ; \
|
|
|
|
git submodule update --init --recursive ; \
|
|
|
|
cd .. ; \
|
2021-03-19 21:25:46 +00:00
|
|
|
fi && \
|
2022-07-15 21:36:19 +00:00
|
|
|
# save the examples \
|
2023-12-21 16:41:49 +00:00
|
|
|
ls -lh pytorch-lightning/ && \
|
|
|
|
rm -rf pytorch-lightning/.git && \
|
|
|
|
rm -rf pytorch-lightning/_notebooks/.git && \
|
|
|
|
mv pytorch-lightning/_notebooks/.notebooks/ notebooks && \
|
|
|
|
cp -r pytorch-lightning/*examples . && \
|
2021-03-29 08:39:06 +00:00
|
|
|
|
2022-03-11 11:13:43 +00:00
|
|
|
# Installations \
|
2022-06-02 12:54:13 +00:00
|
|
|
pip install "Pillow>=8.2, !=8.3.0" "cryptography>=3.4" "py>=1.10" --no-cache-dir && \
|
2022-11-12 15:36:36 +00:00
|
|
|
PACKAGE_NAME=pytorch pip install './lightning[extra,loggers,strategies]' --no-cache-dir && \
|
2023-12-21 16:41:49 +00:00
|
|
|
rm -rf pytorch-lightning && \
|
2021-04-27 19:29:49 +00:00
|
|
|
pip list
|
|
|
|
|
2023-06-26 17:12:53 +00:00
|
|
|
RUN pip install jupyterlab[all] -U --no-cache-dir
|
2022-06-02 12:54:13 +00:00
|
|
|
|
2023-05-04 11:35:44 +00:00
|
|
|
# create jupyter_notebook_config.py
|
|
|
|
RUN mkdir -p /root/.jupyter && \
|
|
|
|
echo "c.NotebookApp.contents_manager_class = 'notebook.services.contents.largefilemanager.LargeFileManager'" > /root/.jupyter/jupyter_notebook_config.py
|
|
|
|
|
2021-04-27 19:29:49 +00:00
|
|
|
ENV PYTHONPATH="/workspace"
|
2021-01-29 16:01:03 +00:00
|
|
|
|
2021-04-27 19:29:49 +00:00
|
|
|
RUN \
|
|
|
|
TORCH_VERSION=$(cat torch_version.info) && \
|
|
|
|
rm torch_version.info && \
|
2022-07-15 21:36:19 +00:00
|
|
|
ls -lh . && \
|
2021-04-27 19:29:49 +00:00
|
|
|
python --version && \
|
2021-01-29 16:01:03 +00:00
|
|
|
pip --version && \
|
2021-04-27 19:29:49 +00:00
|
|
|
pip list | grep torch && \
|
2021-10-29 06:48:05 +00:00
|
|
|
python -c "import torch; assert torch.__version__.startswith('$TORCH_VERSION'), torch.__version__" && \
|
2022-11-12 15:36:36 +00:00
|
|
|
python -c "import pytorch_lightning as pl; print(pl.__version__)"
|
2021-01-29 16:01:03 +00:00
|
|
|
|
2021-04-27 19:29:49 +00:00
|
|
|
CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]
|