Skip to content

Commit cd86eb2

Browse files
malav-shastriMalav Shastri
and
Malav Shastri
authored
Upgrade SKLearn to 1.2.1 (#163)
* Upgrade SKLearn to 1.2.1 * Delete buildspecs and refresh pickled models * Correct local integration tests --------- Co-authored-by: Malav Shastri <malavhs@amazon.com>
1 parent 838ffd2 commit cd86eb2

17 files changed

+23
-23
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ If you want to run local integration tests, then use:
184184
185185
# Example
186186
pytest test/integration --docker-base-name preprod-sklearn ``\``
187-
--tag 1.0-1 ``\``
187+
--tag 1.2-1 ``\``
188188
--py-version 3 ``\``
189189
--framework-version |FRAMEWORK_VERSION|
190190
@@ -242,4 +242,4 @@ SageMaker Scikit-learn Container is licensed under the Apache 2.0 License. It is
242242
.com, Inc. or its affiliates. All Rights Reserved. The license is available at:
243243
http://aws.amazon.com/apache2.0/
244244

245-
.. |FRAMEWORK_VERSION| replace:: 1.0-1
245+
.. |FRAMEWORK_VERSION| replace:: 1.2-1

docker/1.0-1/base/Dockerfile.cpu renamed to docker/1.2-1/base/Dockerfile.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PYTHONIOENCODING=UTF-8 LANG=C.U
116116
# Install Scikit-Learn
117117
# Scikit-learn 0.20 was the last version to support Python 2.7 and Python 3.4.
118118
# Scikit-learn now requires Python 3.6 or newer.
119-
RUN python -m pip install --no-cache -I scikit-learn==1.0.2
119+
RUN python -m pip install --no-cache -I scikit-learn==1.2.1

docker/1.0-1/extension/Dockerfile.cpu renamed to docker/1.2-1/extension/Dockerfile.cpu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM preprod-sklearn:1.0-1
1+
FROM preprod-sklearn:1.2-1
22

3-
RUN pip freeze | grep -q 'scikit-learn==1.0.2'; \
3+
RUN pip freeze | grep -q 'scikit-learn==1.2.1'; \
44
if [ $? -eq 0 ]; \
5-
then echo 'scikit-learn version 1.0.2 requirement met'; \
6-
else echo 'ERROR: Expected scikit-learn version is 1.0.2, check base images for scikit-learn version' && \
5+
then echo 'scikit-learn version 1.2.1 requirement met'; \
6+
else echo 'ERROR: Expected scikit-learn version is 1.2.1, check base images for scikit-learn version' && \
77
exit 1; fi
88

99
RUN pip install --upgrade --no-cache --no-deps sagemaker-scikit-learn-extension==2.5.0

docker/1.0-1/extension/README.md renamed to docker/1.2-1/extension/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ The SageMaker Scikit-learn Extension Container is built in 3 steps. The first 2
88

99
The "base" Dockerfile encompass the installation of the framework and all of the dependencies needed.
1010

11-
Tagging scheme is based on <Scikit-learn_version>-<SageMaker_version>-cpu-py<python_version>. (e.g. 1.0-1-cpu-py3)
11+
Tagging scheme is based on <Scikit-learn_version>-<SageMaker_version>-cpu-py<python_version>. (e.g. 1.2-1-cpu-py3)
1212

1313
All "final" Dockerfiles build images using base images that use the tagging scheme above.
1414

1515
```
16-
docker build -t sklearn-base:1.0-1-cpu-py3 -f docker/1.0-1/base/Dockerfile.cpu .
16+
docker build -t sklearn-base:1.2-1-cpu-py3 -f docker/1.2-1/base/Dockerfile.cpu .
1717
```
1818

19-
Notice that this Dockerfile has the updated version of sklearn (1.0.2) installed.
19+
Notice that this Dockerfile has the updated version of sklearn (1.2.1) installed.
2020

2121
### Step 2: Final Image
2222

@@ -38,7 +38,7 @@ python setup.py bdist_wheel
3838
Then build the final image, like in the sagemaker-sklearn-container
3939

4040
```
41-
docker build -t preprod-sklearn:1.0-1-cpu-py3 -f docker/1.0-1/final/Dockerfile.cpu .
41+
docker build -t preprod-sklearn:1.2-1-cpu-py3 -f docker/1.2-1/final/Dockerfile.cpu .
4242
```
4343

4444
### Step 3: Build the extension image for SageMaker Scikit-learn Extension Container
@@ -47,10 +47,10 @@ The "extension" Dockerfiles encompass the installation of the SageMaker Autopilo
4747

4848
The "extension" Dockerfiles use final images for building.
4949

50-
Build the third additional Dockerfile needed for SageMaker Scikit-learn Extension Container. This Dockerfile specifies a hard dependency on a certain version of scikit-learn (i.e. v1.0.2).
50+
Build the third additional Dockerfile needed for SageMaker Scikit-learn Extension Container. This Dockerfile specifies a hard dependency on a certain version of scikit-learn (i.e. v1.2.1).
5151

5252
Tagging scheme is based on extension-<Scikit-learn-Extension_version>-<SageMaker_version>-cpu-py<python_version>. (e.g. extension-2.5-1-cpu-py3). Make sure the "extension" image is tagged in accordance with the `extension` (i.e. `extension-2.5-1-cpu-py3`).
5353

5454
```
55-
docker build -t preprod-sklearn-extension:2.5-1-cpu-py3 -f docker/1.0-1/extension/Dockerfile.cpu .
55+
docker build -t preprod-sklearn-extension:2.5-1-cpu-py3 -f docker/1.2-1/extension/Dockerfile.cpu .
5656
```

docker/1.0-1/final/Dockerfile.cpu renamed to docker/1.2-1/final/Dockerfile.cpu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM sklearn-base:1.0-1
2-
ENV SAGEMAKER_SKLEARN_VERSION 1.0-1
1+
FROM sklearn-base:1.2-1
2+
ENV SAGEMAKER_SKLEARN_VERSION 1.2-1
33

44
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
55

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ retrying==1.3.3
1414
sagemaker-containers==2.8.6.post2
1515
sagemaker-inference==1.2.0
1616
sagemaker-training==4.0.1
17-
scikit-learn==1.0.2
17+
scikit-learn==1.2.1
1818
scipy==1.5.3
1919
six==1.15.0
2020
jinja2==3.0.3

test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def pytest_addoption(parser):
4343
parser.addoption('--install-container-support', '-C', action='store_true')
4444
parser.addoption('--docker-base-name', default='sk-learn')
4545
parser.addoption('--region', default='us-west-2')
46-
parser.addoption('--framework-version', default='1.0.2')
46+
parser.addoption('--framework-version', default='1.2.1')
4747
parser.addoption('--py-version', choices=['2', '3'], default=str(sys.version_info.major))
4848
parser.addoption('--processor', choices=['cpu'], default='cpu')
4949
# If not specified, will default to {framework-version}-{processor}-py{py-version}

test/integration/test_multiple_model_endpoint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ def test_load_and_unload_model():
150150
res_json = json.loads(res)
151151
assert res_json['status'] == 'Workers scaled'
152152

153-
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0, 0.0', model_name)
153+
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0', model_name)
154154
assert code == 200, res
155155

156156
code, res = make_unload_model_request(model_name)
157157
assert code == 200, res
158158
res_json = json.loads(res)
159159
assert res_json['status'] == "Model \"{}\" unregistered".format(model_name), res
160160

161-
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0, 0.0', model_name)
161+
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0', model_name)
162162
assert code == 404, res
163163
assert res['message'] == "Model not found: {}".format(model_name), res
164164

@@ -184,10 +184,10 @@ def test_load_and_unload_two_models():
184184
res_json = json.loads(res)
185185
assert res_json['status'] == 'Workers scaled'
186186

187-
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0, 0.0', model_name_0)
187+
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0', model_name_0)
188188
assert code == 200, res
189189

190-
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0, 0.0', model_name_1)
190+
code, res = make_invocation_request('0.0, 0.0, 0.0, 0.0, 0.0', model_name_1)
191191
assert code == 200, res
192192

193193
code, res = make_unload_model_request(model_name_0)
-625 Bytes
Binary file not shown.
Binary file not shown.

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[tox]
2-
envlist = {py3}-sklearn{1.0},flake8
2+
envlist = {py3}-sklearn{1.2},flake8
33

44
[flake8]
55
max-line-length = 120
66

77
[testenv]
88
deps =
9-
sklearn1.0: scikit-learn==1.0.2
9+
sklearn1.2: scikit-learn==1.2.1
1010
-r{toxinidir}/requirements.txt
1111
-r{toxinidir}/test-requirements.txt
1212
conda_deps=

0 commit comments

Comments
 (0)