Skip to content

Commit 43f5320

Browse files
authored
Pre install python packages in predictor images (#550)
1 parent e48aaa3 commit 43f5320

File tree

11 files changed

+83
-27
lines changed

11 files changed

+83
-27
lines changed

docs/dependencies/python-packages.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
# Python packages
22

3-
## Pre-installed packages
4-
5-
The following packages have been pre-installed and can be used in your implementations:
6-
7-
```text
8-
boto3==1.9.228
9-
msgpack==0.6.1
10-
numpy==1.17.2
11-
requests==2.22.0
12-
tensorflow==1.14.0 # For TensorFlow models only
13-
onnxruntime==0.5.0 # For ONNX models only
14-
```
15-
163
## PyPI packages
174

18-
You can install additional PyPI packages and import them in your Python files. Cortex looks for a `requirements.txt` file in the top level Cortex project directory (i.e. the directory which contains `cortex.yaml`):
5+
You can install your required PyPI packages and import them in your Python files. Cortex looks for a `requirements.txt` file in the top level Cortex project directory (i.e. the directory which contains `cortex.yaml`):
196

207
```text
218
./iris-classifier/

docs/deployments/predictor.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,36 @@ def predict(sample, metadata):
7171
# Translate the model output to the corresponding label string
7272
return labels[torch.argmax(output[0])]
7373
```
74+
75+
## Pre-installed packages
76+
77+
The following packages have been pre-installed and can be used in your implementations:
78+
79+
```
80+
Keras==2.3.1
81+
Pillow==6.2.1
82+
cloudpickle==1.2.2
83+
dill==0.3.1.1
84+
flask-api==1.1
85+
flask==1.1.1
86+
joblib==0.14.0
87+
nltk==3.4.5
88+
np-utils==0.5.11.1
89+
numpy==1.17.3
90+
pandas==0.25.3
91+
torch==1.3.0
92+
scikit-image==0.16.2
93+
scikit-learn==0.21.3
94+
scipy==1.3.1
95+
six==1.12.0
96+
statsmodels==0.10.1
97+
sympy==1.4
98+
tensor2tensor==1.14.1
99+
tensorflow-hub==0.7.0
100+
tensorflow==2.0.0
101+
torchvision==0.4.1
102+
waitress==1.3.1
103+
xgboost==0.90
104+
```
105+
106+
Learn how to install additional packages [here](../dependencies/python-packages.md).

docs/deployments/request-handlers.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,19 @@ def post_inference(prediction, signature, metadata):
6767
predicted_class_id = prediction[0][0]
6868
return labels[predicted_class_id]
6969
```
70+
71+
## Pre-installed packages
72+
73+
The following packages have been pre-installed and can be used in your implementations:
74+
75+
```text
76+
boto3==1.9.228
77+
msgpack==0.6.1
78+
numpy==1.17.3
79+
requests==2.22.0
80+
dill==0.3.1.1
81+
tensorflow==1.14.0 # For TensorFlow models only
82+
onnxruntime==0.5.0 # For ONNX models only
83+
```
84+
85+
Learn how to install additional packages [here](../dependencies/python-packages.md).
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
torch==1.3.0
2-
torchvision==0.4.0
1+
torch==1.3.*
2+
torchvision==0.4.*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
torch==1.2.*
1+
torch==1.3.*
22
scikit-learn==0.21.*
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
torch==1.3.0
2-
transformers==2.1.1
1+
torch==1.3.*
2+
transformers==2.1.*
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
pillow
2-
torchvision
1+
Pillow

images/predictor-serve-gpu/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ ENV PYTHONPATH "${PYTHONPATH}:/src:/mnt/project"
2222

2323
COPY pkg/workloads/cortex/lib/requirements.txt /src/cortex/lib/requirements.txt
2424
COPY pkg/workloads/cortex/predictor_serve/requirements.txt /src/cortex/predictor_serve/requirements.txt
25-
RUN pip install -r /src/cortex/lib/requirements.txt && \
26-
pip install -r /src/cortex/predictor_serve/requirements.txt && \
25+
RUN pip install --no-cache-dir -r /src/cortex/lib/requirements.txt && \
26+
pip install --no-cache-dir -r /src/cortex/predictor_serve/requirements.txt && \
2727
rm -rf /root/.cache/pip*
2828

2929
COPY pkg/workloads/cortex/consts.py /src/cortex

images/predictor-serve/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ ENV PYTHONPATH "${PYTHONPATH}:/src:/mnt/project"
2222

2323
COPY pkg/workloads/cortex/lib/requirements.txt /src/cortex/lib/requirements.txt
2424
COPY pkg/workloads/cortex/predictor_serve/requirements.txt /src/cortex/predictor_serve/requirements.txt
25-
RUN pip install -r /src/cortex/lib/requirements.txt && \
26-
pip install -r /src/cortex/predictor_serve/requirements.txt && \
25+
RUN pip install --no-cache-dir -r /src/cortex/lib/requirements.txt && \
26+
pip install --no-cache-dir -r /src/cortex/predictor_serve/requirements.txt && \
2727
rm -rf /root/.cache/pip*
2828

2929
COPY pkg/workloads/cortex/consts.py /src/cortex

pkg/workloads/cortex/lib/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
boto3==1.9.228
22
msgpack==0.6.1
3-
numpy==1.17.2
3+
numpy==1.17.3
44
json_tricks==3.13.2
55
requests==2.22.0
66
datadog==0.30.0

0 commit comments

Comments
 (0)