Skip to content

Commit 5b76165

Browse files
committed
Use custom TFA wheels.
This allows support for Custom Op. See https://github.com/tensorflow/addons#987 BUG=145555176
1 parent 64e1f5d commit 5b76165

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG BASE_TAG=latest
22
ARG TENSORFLOW_VERSION=2.2.0
33

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

77
ADD clean-layer.sh /tmp/clean-layer.sh
@@ -66,8 +66,9 @@ RUN pip install /tmp/tensorflow_gcs_config/tensorflow*.whl && \
6666
/tmp/clean-layer.sh
6767

6868
# Install TensorFlow addons (TFA).
69-
# TFA functionnality relying on Custom Op won't work. See: https://github.com/tensorflow/addons/issues/987.
70-
RUN pip install tensorflow-addons==0.10.0 && \
69+
COPY --from=tensorflow_whl /tmp/tfa_cpu/*.whl /tmp/tfa_cpu/
70+
RUN pip install /tmp/tfa_cpu/tensorflow*.whl && \
71+
rm -rf /tmp/tfa_cpu/ && \
7172
/tmp/clean-layer.sh
7273

7374
RUN apt-get install -y libfreetype6-dev && \

gpu.Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG BASE_TAG=staging
22

33
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 AS nvidia
4-
FROM gcr.io/kaggle-images/python-tensorflow-whl:2.2.0-py37 as tensorflow_whl
4+
FROM gcr.io/kaggle-images/python-tensorflow-whl:2.2.0-py37-2 as tensorflow_whl
55
FROM gcr.io/kaggle-images/python:${BASE_TAG}
66

77
ADD clean-layer.sh /tmp/clean-layer.sh
@@ -102,6 +102,12 @@ RUN pip uninstall -y tensorflow && \
102102
pip install --no-deps mxnet-cu$CUDA_MAJOR_VERSION$CUDA_MINOR_VERSION && \
103103
/tmp/clean-layer.sh
104104

105+
# Reinstall TensorFlow addons (TFA) with GPU support.
106+
COPY --from=tensorflow_whl /tmp/tfa_gpu/*.whl /tmp/tfa_gpu/
107+
RUN pip install /tmp/tfa_gpu/tensorflow*.whl && \
108+
rm -rf /tmp/tfa_gpu/ && \
109+
/tmp/clean-layer.sh
110+
105111
# Install GPU-only packages
106112
RUN pip install pycuda && \
107113
pip install cupy-cuda$CUDA_MAJOR_VERSION$CUDA_MINOR_VERSION && \

0 commit comments

Comments
 (0)