Skip to content

Commit ece1bfb

Browse files
authored
Use tensorflow-cpu in images (#846)
1 parent 5b02492 commit ece1bfb

File tree

7 files changed

+37
-17
lines changed

7 files changed

+37
-17
lines changed

dev/versions.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,23 @@ Note: check their [install.md](https://github.com/kubernetes/client-go/blob/mast
8686
1. `go mod tidy`
8787
1. Check that the diff in `go.mod` is reasonable
8888

89-
## TensorFlow / TensorFlow Serving / Python / Python base operating system
89+
## Python
9090

91-
The Python version in the base images for `tf-api` and `onnx-serve-gpu`/`python-serve-gpu` determines the Python version used throughout Cortex.
91+
The same Python version should be used throughout Cortex (e.g. search for `3.6` and update all accordingly).
9292

93-
1. Update the `tensorflow/tensorflow` base image in `images/tf-api/Dockerfile` to the desired version ([Dockerhub](https://hub.docker.com/r/tensorflow/tensorflow))
94-
1. Update the `nvidia/cuda` base image in `images/python-serve-gpu/Dockerfile` and `images/onnx-serve-gpu/Dockerfile` (as well as `libnvinfer` in `images/python-serve-gpu/Dockerfile` and `images/tf-serve-gpu/Dockerfile`) to the desired version based on [TensorFlow's documentation](https://www.tensorflow.org/install/gpu#ubuntu_1804_cuda_101) ([Dockerhub](https://hub.docker.com/r/nvidia/cuda)) (it's possible these versions will diverge depending on ONNX runtime support)
95-
1. Run `docker run --rm -it tensorflow/tensorflow:***`, and in the container run `python3 --version` and `cat /etc/lsb-release`
96-
1. Run `docker run --rm -it nvidia/cuda:***`, and in the container run `cat /etc/lsb-release`
97-
1. The Ubuntu versions should match; if they do not, downgrade whichever one is too advanced
98-
1. The minor Python version in `tensorflow/tensorflow` must be used in all dockerfiles; search for e.g. `python3.6-dev` and update accordingly
99-
1. Update TensorFlow version listed in `tensorflow.md` and `python.md`
93+
It's probably safest to use the minor version of Python that you get when you run `apt-get install python3` ([currently that's what TensorFlow's Docker image does](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/cpu.Dockerfile))
94+
95+
## TensorFlow / TensorFlow Serving
96+
97+
1. Find the latest release on [GitHub](https://github.com/tensorflow/tensorflow/releases)
10098
1. Search the codebase for the current minor TensorFlow version (e.g. `2.1`) and update versions as appropriate
101-
1. Search the codebase for the minor Python version (e.g. `3.6`) and update versions as appropriate
102-
1. Search the codebase for `ubuntu` and update versions as appropriate
10399

104100
Note: it's ok if example training notebooks aren't upgraded, as long as the exported model still works
105101

102+
## CUDA
103+
104+
1. Update the `nvidia/cuda` base image in `images/python-serve-gpu/Dockerfile` and `images/onnx-serve-gpu/Dockerfile` (as well as `libnvinfer` in `images/python-serve-gpu/Dockerfile` and `images/tf-serve-gpu/Dockerfile`) to the desired version based on [TensorFlow's documentation](https://www.tensorflow.org/install/gpu#ubuntu_1804_cuda_101) ([Dockerhub](https://hub.docker.com/r/nvidia/cuda)) (it's possible these versions will diverge depending on ONNX runtime support)
105+
106106
## ONNX runtime
107107

108108
1. Update the version in `onnx-cpu.requirements.txt` and `onnx-gpu.requirements.txt` ([releases](https://github.com/microsoft/onnxruntime/releases))
@@ -204,6 +204,10 @@ Note: overriding horizontal-pod-autoscaler-sync-period on EKS is currently not s
204204
1. Find the latest 2.X release on [GitHub](https://github.com/helm/helm/releases) (Istio does not work with helm 3)
205205
1. Update the version in `images/manager/Dockerfile`
206206

207+
## Ubuntu base images
208+
209+
1. Search the codebase for `ubuntu` and update versions as appropriate
210+
207211
## Alpine base images
208212

209213
1. Find the latest release on [Dockerhub](https://hub.docker.com/_/alpine)

images/onnx-serve-gpu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ RUN apt-get update -qq && apt-get install -y -q \
2323
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
2424
python3.6 get-pip.py && \
2525
pip install --upgrade pip && \
26-
rm -rf /root/.cache/pip*
26+
rm -rf /root/.cache/pip* && \
27+
ln -s /usr/bin/python3.6 /usr/local/bin/python
2728

2829
RUN locale-gen en_US.UTF-8
2930
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8

images/onnx-serve/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ RUN apt-get update -qq && apt-get install -y -q \
2323
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
2424
python3.6 get-pip.py && \
2525
pip install --upgrade pip && \
26-
rm -rf /root/.cache/pip*
26+
rm -rf /root/.cache/pip* && \
27+
ln -s /usr/bin/python3.6 /usr/local/bin/python
2728

2829
RUN locale-gen en_US.UTF-8
2930
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8

images/python-serve-gpu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ RUN apt-get update -qq && apt-get install -y -q \
2525
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
2626
python3.6 get-pip.py && \
2727
pip install --upgrade pip && \
28-
rm -rf /root/.cache/pip*
28+
rm -rf /root/.cache/pip* && \
29+
ln -s /usr/bin/python3.6 /usr/local/bin/python
2930

3031
RUN locale-gen en_US.UTF-8
3132
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8

images/python-serve/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ RUN apt-get update -qq && apt-get install -y -q \
2323
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
2424
python3.6 get-pip.py && \
2525
pip install --upgrade pip && \
26-
rm -rf /root/.cache/pip*
26+
rm -rf /root/.cache/pip* && \
27+
ln -s /usr/bin/python3.6 /usr/local/bin/python
2728

2829
RUN locale-gen en_US.UTF-8
2930
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8

images/tf-api/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
FROM tensorflow/tensorflow:2.1.0-py3
1+
FROM ubuntu:18.04
22

33
RUN apt-get update -qq && apt-get install -y -q \
44
build-essential \
5+
curl \
56
libfreetype6-dev \
67
libpng-dev \
78
libzmq3-dev \
89
pkg-config \
10+
rsync \
911
software-properties-common \
12+
unzip \
1013
zlib1g-dev \
14+
python3.6-dev \
15+
python3.6-distutils \
1116
git \
1217
libsm6 \
1318
libxext6 \
1419
libxrender-dev \
1520
libsndfile1 \
1621
locales \
17-
&& apt-get clean -qq && rm -rf /var/lib/apt/lists/*
22+
&& apt-get clean -qq && rm -rf /var/lib/apt/lists/* && \
23+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
24+
python3.6 get-pip.py && \
25+
pip install --upgrade pip && \
26+
rm -rf /root/.cache/pip* && \
27+
ln -s /usr/bin/python3.6 /usr/local/bin/python
1828

1929
RUN locale-gen en_US.UTF-8
2030
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8

pkg/workloads/cortex/serve/tf.requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
tensorflow-cpu==2.1.0
2+
13
opencv-python==4.1.2.30
24
tensor2tensor==1.15.4
35
tensorflow-hub==0.7.0

0 commit comments

Comments
 (0)