Skip to content

Commit 3d698a6

Browse files
authored
Use official TensorFlow wheel (#1036)
We are moving towards the base DLVM TF image. http://b/186646069
1 parent 0b2dcfa commit 3d698a6

File tree

2 files changed

+8
-30
lines changed

2 files changed

+8
-30
lines changed

Dockerfile

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
ARG BASE_TAG=m73
22
ARG TENSORFLOW_VERSION=2.4.1
33

4-
FROM gcr.io/kaggle-images/python-tensorflow-whl:${TENSORFLOW_VERSION}-py37-2 as tensorflow_whl
54
FROM gcr.io/deeplearning-platform-release/base-cpu:${BASE_TAG}
65

6+
# We need to redefine TENSORFLOW_VERSION here to get the default ARG value defined above the FROM instruction.
7+
# See: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
8+
ARG TENSORFLOW_VERSION
9+
710
ADD clean-layer.sh /tmp/clean-layer.sh
811
ADD patches/nbconvert-extensions.tpl /opt/kaggle/nbconvert-extensions.tpl
912
ADD patches/template_conf.json /opt/kaggle/conf.json
@@ -56,22 +59,9 @@ RUN pip install seaborn python-dateutil dask && \
5659
pip install -f https://h2o-release.s3.amazonaws.com/h2o/latest_stable_Py.html h2o && \
5760
/tmp/clean-layer.sh
5861

59-
# Install tensorflow from a pre-built wheel
60-
COPY --from=tensorflow_whl /tmp/tensorflow_cpu/*.whl /tmp/tensorflow_cpu/
61-
RUN pip install /tmp/tensorflow_cpu/tensorflow*.whl && \
62-
rm -rf /tmp/tensorflow_cpu && \
63-
/tmp/clean-layer.sh
64-
65-
# Install tensorflow-gcs-config from a pre-built wheel
66-
COPY --from=tensorflow_whl /tmp/tensorflow_gcs_config/*.whl /tmp/tensorflow_gcs_config/
67-
RUN pip install /tmp/tensorflow_gcs_config/tensorflow*.whl && \
68-
rm -rf /tmp/tensorflow_gcs_config && \
69-
/tmp/clean-layer.sh
70-
71-
# Install TensorFlow addons (TFA).
72-
COPY --from=tensorflow_whl /tmp/tfa_cpu/*.whl /tmp/tfa_cpu/
73-
RUN pip install /tmp/tfa_cpu/tensorflow*.whl && \
74-
rm -rf /tmp/tfa_cpu/ && \
62+
RUN pip install tensorflow==${TENSORFLOW_VERSION} && \
63+
pip install tensorflow-gcs-config==2.4.0 && \
64+
pip install tensorflow-addons==0.12.1 && \
7565
/tmp/clean-layer.sh
7666

7767
RUN apt-get install -y libfreetype6-dev && \
@@ -513,9 +503,6 @@ RUN jupyter-nbextension disable nb_conda --py --sys-prefix && \
513503
# Set backend for matplotlib
514504
ENV MPLBACKEND "agg"
515505

516-
# We need to redefine TENSORFLOW_VERSION here to get the default ARG value defined above the FROM instruction.
517-
# See: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
518-
ARG TENSORFLOW_VERSION
519506
ARG GIT_COMMIT=unknown
520507
ARG BUILD_DATE=unknown
521508

gpu.Dockerfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ARG BASE_TAG=staging
22

33
FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 AS nvidia
4-
FROM gcr.io/kaggle-images/python-tensorflow-whl:2.4.1-py37-2 as tensorflow_whl
54
FROM gcr.io/kaggle-images/python:${BASE_TAG}
65

76
ADD clean-layer.sh /tmp/clean-layer.sh
@@ -82,20 +81,12 @@ RUN pip install jax==0.2.12 jaxlib==0.1.64+cuda$CUDA_MAJOR_VERSION$CUDA_MINOR_V
8281
/tmp/clean-layer.sh
8382

8483
# Reinstall packages with a separate version for GPU support.
85-
COPY --from=tensorflow_whl /tmp/tensorflow_gpu/*.whl /tmp/tensorflow_gpu/
8684
RUN pip uninstall -y tensorflow && \
87-
pip install /tmp/tensorflow_gpu/tensorflow*.whl && \
88-
rm -rf /tmp/tensorflow_gpu && \
85+
pip install tensorflow-gpu==2.4.1 && \
8986
pip uninstall -y mxnet && \
9087
pip install mxnet-cu$CUDA_MAJOR_VERSION$CUDA_MINOR_VERSION && \
9188
/tmp/clean-layer.sh
9289

93-
# Reinstall TensorFlow addons (TFA) with GPU support.
94-
COPY --from=tensorflow_whl /tmp/tfa_gpu/*.whl /tmp/tfa_gpu/
95-
RUN pip install /tmp/tfa_gpu/tensorflow*.whl && \
96-
rm -rf /tmp/tfa_gpu/ && \
97-
/tmp/clean-layer.sh
98-
9990
# Install GPU-only packages
10091
RUN pip install pycuda && \
10192
pip install cupy-cuda$CUDA_MAJOR_VERSION$CUDA_MINOR_VERSION && \

0 commit comments

Comments
 (0)