Skip to content

Commit b57b7e8

Browse files
authored
Upgrade to Tensorflow 2.0 (#124)
b/159364787
1 parent 899af1d commit b57b7e8

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ RUN apt-get install -y libzmq3-dev python-pip default-jdk && \
5858
# Keras sets up a virtualenv and installs tensorflow
5959
# in the WORKON_HOME directory, so choose an explicit location for it.
6060
ENV WORKON_HOME=/usr/local/share/.virtualenvs
61-
RUN pip install --user virtualenv && R -e 'keras::install_keras(tensorflow = "1.15", extra_packages = c("pandas", "numpy", "pycryptodome"))'
61+
RUN pip install --user virtualenv && R -e 'keras::install_keras(tensorflow = "2.0", extra_packages = c("pandas", "numpy", "pycryptodome"))'
6262

6363
# Install kaggle libraries.
6464
# Do this at the end to avoid rebuilding everything when any change is made.

gpu.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG BASE_TAG=staging
2-
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 AS nvidia
2+
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 AS nvidia
33
FROM gcr.io/kaggle-images/rstats:${BASE_TAG}
44
ARG ncpus=1
55

@@ -38,7 +38,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3838
cuda-minimal-build-$CUDA_PKG_VERSION \
3939
cuda-command-line-tools-$CUDA_PKG_VERSION \
4040
libcudnn7=$CUDNN_VERSION-1+cuda$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION \
41-
libcudnn7-dev=$CUDNN_VERSION-1+cuda$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION && \
41+
libcudnn7-dev=$CUDNN_VERSION-1+cuda$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION \
42+
libnccl2=2.5.6-1+cuda$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION \
43+
libnccl-dev=2.5.6-1+cuda$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION && \
4244
ln -s /usr/local/cuda-$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION /usr/local/cuda && \
4345
ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
4446
/tmp/clean-layer.sh
@@ -53,7 +55,7 @@ ENV CUDA_HOME=/usr/local/cuda
5355
ADD ldpaths $R_HOME/etc/ldpaths
5456

5557
# Install tensorflow with GPU support
56-
RUN R -e 'keras::install_keras(tensorflow = "1.15-gpu")' && \
58+
RUN R -e 'keras::install_keras(tensorflow = "2.0-gpu")' && \
5759
rm -rf /tmp/tensorflow_gpu && \
5860
/tmp/clean-layer.sh
5961

tests/test_tensorflow.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ context("tensorflow")
22

33
test_that("gpu imports", {
44
check_gpu()
5-
6-
#TODO(b/143642025): update to TF2.0 compatible and fix potential CUDA issues.
75

86
library(tensorflow)
9-
sess <- tf$Session()
107
with(tf$device("/gpu:0"), {
118
const <- tf$constant(42)
12-
expect_equal(42, sess$run(const))
9+
expect_equal(42, as.integer(const))
1310
})
1411

1512
expect_true(TRUE)

0 commit comments

Comments
 (0)