Skip to content

Reinstall onnx and tf deps when python version changes #1652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Note: it's ok if example training notebooks aren't upgraded, as long as the expo
## Python packages

1. Update versions in `images/python-predictor-*/Dockerfile`, `images/tensorflow-predictor/Dockerfile`, and `images/onnx-predictor-*/Dockerfile`
1. Update versions in `pkg/workloads/cortex/serve/requirements.txt` and `pkg/workloads/cortex/downloader/requirements.txt`
1. Update versions in `pkg/workloads/cortex/serve/*requirements.txt` and `pkg/workloads/cortex/downloader/requirements.txt`
1. Update the versions listed in "Pre-installed packages" in `realtime-api/predictors.md` and `batch-api/predictors.md`
* look at the diff carefully since some packages are not shown, and e.g. `tensorflow-cpu` -> `tensorflow`
* be careful not to update any of the versions for Inferentia that are not latest in `images/python-predictor-inf/Dockerfile`
Expand Down
4 changes: 3 additions & 1 deletion images/onnx-predictor-cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ ENV BASH_ENV=~/.env
SHELL ["/bin/bash", "-c"]

COPY pkg/workloads/cortex/serve/requirements.txt /src/cortex/serve/requirements.txt
COPY pkg/workloads/cortex/serve/onnx-cpu.requirements.txt /src/cortex/serve/image.requirements.txt

RUN pip install --no-cache-dir -r \
/src/cortex/serve/requirements.txt \
onnxruntime==1.4.0
-r /src/cortex/serve/image.requirements.txt

ARG SLIM="false"
RUN test "${SLIM}" = "true" || ( \
Expand Down
4 changes: 3 additions & 1 deletion images/onnx-predictor-gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ ENV BASH_ENV=~/.env
SHELL ["/bin/bash", "-c"]

COPY pkg/workloads/cortex/serve/requirements.txt /src/cortex/serve/requirements.txt
COPY pkg/workloads/cortex/serve/onnx-gpu.requirements.txt /src/cortex/serve/image.requirements.txt

RUN pip install --no-cache-dir -r \
/src/cortex/serve/requirements.txt \
onnxruntime-gpu==1.4.0
-r /src/cortex/serve/image.requirements.txt

ARG SLIM="false"
RUN test "${SLIM}" = "true" || ( \
Expand Down
5 changes: 3 additions & 2 deletions images/tensorflow-predictor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ ENV BASH_ENV=~/.env
SHELL ["/bin/bash", "-c"]

COPY pkg/workloads/cortex/serve/requirements.txt /src/cortex/serve/requirements.txt
COPY pkg/workloads/cortex/serve/tf.requirements.txt /src/cortex/serve/image.requirements.txt

RUN pip install --no-cache-dir -r \
/src/cortex/serve/requirements.txt \
tensorflow-cpu==2.3.0 \
tensorflow-serving-api==2.3.0
-r /src/cortex/serve/image.requirements.txt

ARG SLIM="false"
RUN test "${SLIM}" = "true" || ( \
Expand Down
4 changes: 4 additions & 0 deletions pkg/workloads/cortex/serve/init/bootloader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ if [ -f "/mnt/project/conda-packages.txt" ]; then
if [ $old_py_version != $new_py_version ]; then
echo "warning: you have changed the Python version from $old_py_version to $new_py_version; this may break Cortex's web server"
echo "reinstalling core packages ..."

pip --no-cache-dir install -r /src/cortex/serve/requirements.txt
if [ -f "/src/cortex/serve/image.requirements.txt" ]; then
pip --no-cache-dir install -r /src/cortex/serve/image.requirements.txt
fi

rm -rf $CONDA_PREFIX/lib/python${old_py_version} # previous python is no longer needed
fi
Expand Down
1 change: 1 addition & 0 deletions pkg/workloads/cortex/serve/onnx-cpu.requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
onnxruntime==1.4.0
1 change: 1 addition & 0 deletions pkg/workloads/cortex/serve/onnx-gpu.requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
onnxruntime-gpu==1.4.0
2 changes: 2 additions & 0 deletions pkg/workloads/cortex/serve/tf.requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tensorflow-cpu==2.3.0
tensorflow-serving-api==2.3.0