Skip to content

Commit fe19887

Browse files
authored
Reinstall onnx and tf deps when python version changes (#1652)
1 parent cf2a978 commit fe19887

File tree

8 files changed

+18
-5
lines changed

8 files changed

+18
-5
lines changed

dev/versions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Note: it's ok if example training notebooks aren't upgraded, as long as the expo
179179
## Python packages
180180

181181
1. Update versions in `images/python-predictor-*/Dockerfile`, `images/tensorflow-predictor/Dockerfile`, and `images/onnx-predictor-*/Dockerfile`
182-
1. Update versions in `pkg/workloads/cortex/serve/requirements.txt` and `pkg/workloads/cortex/downloader/requirements.txt`
182+
1. Update versions in `pkg/workloads/cortex/serve/*requirements.txt` and `pkg/workloads/cortex/downloader/requirements.txt`
183183
1. Update the versions listed in "Pre-installed packages" in `realtime-api/predictors.md` and `batch-api/predictors.md`
184184
* look at the diff carefully since some packages are not shown, and e.g. `tensorflow-cpu` -> `tensorflow`
185185
* be careful not to update any of the versions for Inferentia that are not latest in `images/python-predictor-inf/Dockerfile`

images/onnx-predictor-cpu/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ ENV BASH_ENV=~/.env
4444
SHELL ["/bin/bash", "-c"]
4545

4646
COPY pkg/workloads/cortex/serve/requirements.txt /src/cortex/serve/requirements.txt
47+
COPY pkg/workloads/cortex/serve/onnx-cpu.requirements.txt /src/cortex/serve/image.requirements.txt
48+
4749
RUN pip install --no-cache-dir -r \
4850
/src/cortex/serve/requirements.txt \
49-
onnxruntime==1.4.0
51+
-r /src/cortex/serve/image.requirements.txt
5052

5153
ARG SLIM="false"
5254
RUN test "${SLIM}" = "true" || ( \

images/onnx-predictor-gpu/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ ENV BASH_ENV=~/.env
4444
SHELL ["/bin/bash", "-c"]
4545

4646
COPY pkg/workloads/cortex/serve/requirements.txt /src/cortex/serve/requirements.txt
47+
COPY pkg/workloads/cortex/serve/onnx-gpu.requirements.txt /src/cortex/serve/image.requirements.txt
48+
4749
RUN pip install --no-cache-dir -r \
4850
/src/cortex/serve/requirements.txt \
49-
onnxruntime-gpu==1.4.0
51+
-r /src/cortex/serve/image.requirements.txt
5052

5153
ARG SLIM="false"
5254
RUN test "${SLIM}" = "true" || ( \

images/tensorflow-predictor/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ ENV BASH_ENV=~/.env
4444
SHELL ["/bin/bash", "-c"]
4545

4646
COPY pkg/workloads/cortex/serve/requirements.txt /src/cortex/serve/requirements.txt
47+
COPY pkg/workloads/cortex/serve/tf.requirements.txt /src/cortex/serve/image.requirements.txt
48+
4749
RUN pip install --no-cache-dir -r \
4850
/src/cortex/serve/requirements.txt \
49-
tensorflow-cpu==2.3.0 \
50-
tensorflow-serving-api==2.3.0
51+
-r /src/cortex/serve/image.requirements.txt
5152

5253
ARG SLIM="false"
5354
RUN test "${SLIM}" = "true" || ( \

pkg/workloads/cortex/serve/init/bootloader.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ if [ -f "/mnt/project/conda-packages.txt" ]; then
7474
if [ $old_py_version != $new_py_version ]; then
7575
echo "warning: you have changed the Python version from $old_py_version to $new_py_version; this may break Cortex's web server"
7676
echo "reinstalling core packages ..."
77+
7778
pip --no-cache-dir install -r /src/cortex/serve/requirements.txt
79+
if [ -f "/src/cortex/serve/image.requirements.txt" ]; then
80+
pip --no-cache-dir install -r /src/cortex/serve/image.requirements.txt
81+
fi
7882

7983
rm -rf $CONDA_PREFIX/lib/python${old_py_version} # previous python is no longer needed
8084
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
onnxruntime==1.4.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
onnxruntime-gpu==1.4.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tensorflow-cpu==2.3.0
2+
tensorflow-serving-api==2.3.0

0 commit comments

Comments
 (0)