Skip to content

Commit 6e884b4

Browse files
author
Dan
authored
Merge branch 'master' into fix-disable-profiler-settings
2 parents 3989034 + f38df4f commit 6e884b4

File tree

17 files changed

+1498
-23
lines changed

17 files changed

+1498
-23
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Changelog
22

3+
## v2.26.0 (2021-02-26)
4+
5+
### Features
6+
7+
* Add Framework Version support for PyTorch compilation (Neo)
8+
9+
### Bug Fixes and Other Changes
10+
11+
* add mxnet 1.7.0 eia configuration
12+
* update source constructor for lineage action and artifact
13+
14+
### Documentation Changes
15+
16+
* fix typo in create_monitoring_schedule method
17+
18+
## v2.25.2 (2021-02-25)
19+
20+
### Bug Fixes and Other Changes
21+
22+
* Use the output path to store the Clarify config file
23+
* feature group should ignore nan values
24+
* ignore failing smdataparallel test
25+
* Add tests for Training job & Transform job in visualizer
26+
* visualizer for pipeline processing job steps
27+
28+
### Documentation Changes
29+
30+
* update doc for Elastic Inference MXNet 1.7.0
31+
332
## v2.25.1 (2021-02-20)
433

534
### Bug Fixes and Other Changes

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.25.2.dev0
1+
2.26.1.dev0

src/sagemaker/image_uri_config/mxnet.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@
694694
"version_aliases": {
695695
"1.3": "1.3.0",
696696
"1.4": "1.4.1",
697-
"1.5": "1.5.1"
697+
"1.5": "1.5.1",
698+
"1.7": "1.7.0"
698699
},
699700
"versions": {
700701
"1.3.0": {
@@ -816,6 +817,36 @@
816817
},
817818
"repository": "mxnet-inference-eia",
818819
"py_versions": ["py2", "py3"]
820+
},
821+
"1.7.0": {
822+
"registries": {
823+
"af-south-1": "626614931356",
824+
"ap-east-1": "871362719292",
825+
"ap-northeast-1": "763104351884",
826+
"ap-northeast-2": "763104351884",
827+
"ap-south-1": "763104351884",
828+
"ap-southeast-1": "763104351884",
829+
"ap-southeast-2": "763104351884",
830+
"ca-central-1": "763104351884",
831+
"cn-north-1": "727897471807",
832+
"cn-northwest-1": "727897471807",
833+
"eu-central-1": "763104351884",
834+
"eu-north-1": "763104351884",
835+
"eu-west-1": "763104351884",
836+
"eu-west-2": "763104351884",
837+
"eu-west-3": "763104351884",
838+
"eu-south-1": "692866216735",
839+
"me-south-1": "217643126080",
840+
"sa-east-1": "763104351884",
841+
"us-east-1": "763104351884",
842+
"us-east-2": "763104351884",
843+
"us-gov-west-1": "442386744353",
844+
"us-iso-east-1": "886529160074",
845+
"us-west-1": "763104351884",
846+
"us-west-2": "763104351884"
847+
},
848+
"repository": "mxnet-inference-eia",
849+
"py_versions": ["py3"]
819850
}
820851
}
821852
}

src/sagemaker/image_uri_config/neo-pytorch.json

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,73 @@
22
"processors": ["cpu", "gpu"],
33
"scope": ["inference"],
44
"version_aliases": {
5-
"0.4.0": "1.4.0",
6-
"1.0.0": "1.4.0",
7-
"1.1.0": "1.4.0",
8-
"1.2.0": "1.4.0",
9-
"1.3.0": "1.4.0"
5+
"0.4.0": "1.4",
6+
"1.0.0": "1.4",
7+
"1.1.0": "1.4",
8+
"1.2.0": "1.4",
9+
"1.3.0": "1.4",
10+
"1.4.0": "1.4"
1011
},
1112
"versions": {
12-
"1.4.0": {
13+
"1.4": {
14+
"py_versions": ["py3"],
15+
"registries": {
16+
"af-south-1": "774647643957",
17+
"ap-east-1": "110948597952",
18+
"ap-northeast-1": "941853720454",
19+
"ap-northeast-2": "151534178276",
20+
"ap-south-1": "763008648453",
21+
"ap-southeast-1": "324986816169",
22+
"ap-southeast-2": "355873309152",
23+
"ca-central-1": "464438896020",
24+
"cn-north-1": "472730292857",
25+
"cn-northwest-1": "474822919863",
26+
"eu-central-1": "746233611703",
27+
"eu-north-1": "601324751636",
28+
"eu-south-1": "966458181534",
29+
"eu-west-1": "802834080501",
30+
"eu-west-2": "205493899709",
31+
"eu-west-3": "254080097072",
32+
"me-south-1": "836785723513",
33+
"sa-east-1": "756306329178",
34+
"us-east-1": "785573368785",
35+
"us-east-2": "007439368137",
36+
"us-gov-west-1": "263933020539",
37+
"us-west-1": "710691900526",
38+
"us-west-2": "301217895009"
39+
},
40+
"repository": "sagemaker-inference-pytorch"
41+
},
42+
"1.5": {
43+
"py_versions": ["py3"],
44+
"registries": {
45+
"af-south-1": "774647643957",
46+
"ap-east-1": "110948597952",
47+
"ap-northeast-1": "941853720454",
48+
"ap-northeast-2": "151534178276",
49+
"ap-south-1": "763008648453",
50+
"ap-southeast-1": "324986816169",
51+
"ap-southeast-2": "355873309152",
52+
"ca-central-1": "464438896020",
53+
"cn-north-1": "472730292857",
54+
"cn-northwest-1": "474822919863",
55+
"eu-central-1": "746233611703",
56+
"eu-north-1": "601324751636",
57+
"eu-south-1": "966458181534",
58+
"eu-west-1": "802834080501",
59+
"eu-west-2": "205493899709",
60+
"eu-west-3": "254080097072",
61+
"me-south-1": "836785723513",
62+
"sa-east-1": "756306329178",
63+
"us-east-1": "785573368785",
64+
"us-east-2": "007439368137",
65+
"us-gov-west-1": "263933020539",
66+
"us-west-1": "710691900526",
67+
"us-west-2": "301217895009"
68+
},
69+
"repository": "sagemaker-inference-pytorch"
70+
},
71+
"1.6": {
1372
"py_versions": ["py3"],
1473
"registries": {
1574
"af-south-1": "774647643957",

src/sagemaker/lineage/action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def create(
186186
return super(Action, cls)._construct(
187187
cls._boto_create_method,
188188
action_name=action_name,
189-
source=_api_types.ContextSource(source_uri=source_uri, source_type=source_type),
189+
source=_api_types.ActionSource(source_uri=source_uri, source_type=source_type),
190190
action_type=action_type,
191191
description=description,
192192
status=status,

src/sagemaker/lineage/artifact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def create(
258258
return super(Artifact, cls)._construct(
259259
cls._boto_create_method,
260260
artifact_name=artifact_name,
261-
source=_api_types.ContextSource(source_uri=source_uri, source_types=source_types),
261+
source=_api_types.ArtifactSource(source_uri=source_uri, source_types=source_types),
262262
artifact_type=artifact_type,
263263
properties=properties,
264264
tags=tags,

src/sagemaker/model.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import json
1717
import logging
1818
import os
19+
import re
1920

2021
import sagemaker
2122
from sagemaker import (
@@ -398,6 +399,7 @@ def _compilation_job_config(
398399
target_platform_arch=None,
399400
target_platform_accelerator=None,
400401
compiler_options=None,
402+
framework_version=None,
401403
):
402404
"""Placeholder Docstring"""
403405
input_model_config = {
@@ -407,6 +409,14 @@ def _compilation_job_config(
407409
else input_shape,
408410
"Framework": framework.upper(),
409411
}
412+
413+
if (
414+
framework.lower() == "pytorch"
415+
and re.match("(?=^ml_)(?!ml_inf)", target_instance_type) is not None
416+
and framework_version is not None
417+
):
418+
input_model_config["FrameworkVersion"] = utils.get_short_version(framework_version)
419+
410420
role = self.sagemaker_session.expand_role(role)
411421
output_model_config = {
412422
"S3OutputLocation": output_path,
@@ -572,7 +582,8 @@ def compile(
572582
framework (str): The framework that is used to train the original
573583
model. Allowed values: 'mxnet', 'tensorflow', 'keras', 'pytorch',
574584
'onnx', 'xgboost'
575-
framework_version (str):
585+
framework_version (str): The version of framework, for example:
586+
'1.5' for PyTorch
576587
target_platform_os (str): Target Platform OS, for example: 'LINUX'.
577588
For allowed strings see
578589
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
@@ -626,11 +637,11 @@ def compile(
626637
target_platform_arch,
627638
target_platform_accelerator,
628639
compiler_options,
640+
framework_version,
629641
)
630642
self.sagemaker_session.compile_model(**config)
631643
job_status = self.sagemaker_session.wait_for_compilation_job(job_name)
632644
self.model_data = job_status["ModelArtifacts"]["S3ModelArtifacts"]
633-
634645
if target_instance_family is not None:
635646
if target_instance_family.startswith("ml_"):
636647
self.image_uri = self._compilation_image_uri(

src/sagemaker/model_monitor/model_monitoring.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def create_monitoring_schedule(
238238
schedule.
239239
statistics (sagemaker.model_monitor.Statistic or str): If provided alongside
240240
constraints, these will be used for monitoring the endpoint. This can be a
241-
sagemaker.model_monitor.Constraints object or an S3 uri pointing to a constraints
241+
sagemaker.model_monitor.Statistic object or an S3 uri pointing to a statistic
242242
JSON file.
243243
constraints (sagemaker.model_monitor.Constraints or str): If provided alongside
244244
statistics, these will be used for monitoring the endpoint. This can be a
@@ -352,7 +352,7 @@ def update_monitoring_schedule(
352352
schedule.
353353
statistics (sagemaker.model_monitor.Statistic or str): If provided alongside
354354
constraints, these will be used for monitoring the endpoint. This can be a
355-
sagemaker.model_monitor.Constraints object or an S3 uri pointing to a constraints
355+
sagemaker.model_monitor.Statistics object or an S3 uri pointing to a statistics
356356
JSON file.
357357
constraints (sagemaker.model_monitor.Constraints or str): If provided alongside
358358
statistics, these will be used for monitoring the endpoint. This can be a
@@ -1552,7 +1552,7 @@ def create_monitoring_schedule(
15521552
JSON file.
15531553
statistics (sagemaker.model_monitor.Statistic or str): If provided alongside
15541554
constraints, these will be used for monitoring the endpoint. This can be a
1555-
sagemaker.model_monitor.Constraints object or an s3_uri pointing to a constraints
1555+
sagemaker.model_monitor.Statistics object or an s3_uri pointing to a statistics
15561556
JSON file.
15571557
monitor_schedule_name (str): Schedule name. If not specified, the processor generates
15581558
a default job name, based on the image name and current timestamp.
@@ -1657,7 +1657,7 @@ def update_monitoring_schedule(
16571657
statistics json files.
16581658
statistics (sagemaker.model_monitor.Statistic or str): If provided alongside
16591659
constraints, these will be used for monitoring the endpoint. This can be a
1660-
sagemaker.model_monitor.Constraints object or an S3 uri pointing to a constraints
1660+
sagemaker.model_monitor.Statistics object or an S3 uri pointing to a statistics
16611661
JSON file.
16621662
constraints (sagemaker.model_monitor.Constraints or str): If provided alongside
16631663
statistics, these will be used for monitoring the endpoint. This can be a
@@ -1843,7 +1843,7 @@ def _update_data_quality_monitoring_schedule(
18431843
to a constraints JSON file.
18441844
statistics (sagemaker.model_monitor.Statistic or str): If provided alongside
18451845
constraints, these will be used for monitoring the endpoint. This can be a
1846-
sagemaker.model_monitor.Constraints object or an S3 uri pointing to a constraints
1846+
sagemaker.model_monitor.Statistics object or an S3 uri pointing to a statistics
18471847
JSON file.
18481848
schedule_cron_expression (str): The cron expression that dictates the frequency that
18491849
this job run. See sagemaker.model_monitor.CronExpressionGenerator for valid

tests/conftest.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,16 @@ def mxnet_training_py_version(mxnet_training_version, request):
157157

158158

159159
@pytest.fixture(scope="module", params=["py2", "py3"])
160-
def mxnet_eia_py_version(request):
161-
return request.param
160+
def mxnet_eia_py_version(mxnet_eia_version, request):
161+
if Version(mxnet_eia_version) < Version("1.7.0"):
162+
return request.param
163+
else:
164+
return "py3"
165+
166+
167+
@pytest.fixture(scope="module")
168+
def mxnet_eia_latest_py_version():
169+
return "py3"
162170

163171

164172
@pytest.fixture(scope="module", params=["py2", "py3"])
@@ -182,6 +190,26 @@ def pytorch_eia_py_version():
182190
return "py3"
183191

184192

193+
@pytest.fixture(scope="module")
194+
def neo_pytorch_latest_py_version():
195+
return "py3"
196+
197+
198+
@pytest.fixture(scope="module")
199+
def neo_pytorch_compilation_job_name():
200+
return utils.name_from_base("pytorch-neo-model")
201+
202+
203+
@pytest.fixture(scope="module")
204+
def neo_pytorch_target_device():
205+
return "ml_c5"
206+
207+
208+
@pytest.fixture(scope="module")
209+
def neo_pytorch_cpu_instance_type():
210+
return "ml.c5.xlarge"
211+
212+
185213
@pytest.fixture(scope="module")
186214
def xgboost_framework_version(xgboost_version):
187215
if xgboost_version in ("1", "latest"):

tests/data/mxnet_mnist/mnist_ei.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"). You
2+
# may not use this file except in compliance with the License. A copy of
3+
# the License is located at
4+
#
5+
# http://aws.amazon.com/apache2.0/
6+
#
7+
# or in the "license" file accompanying this file. This file is
8+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
9+
# ANY KIND, either express or implied. See the License for the specific
10+
# language governing permissions and limitations under the License.
11+
from __future__ import absolute_import
12+
13+
import argparse
14+
import gzip
15+
import json
16+
import logging
17+
import os
18+
import struct
19+
20+
import mxnet as mx
21+
import numpy as np
22+
23+
24+
def model_fn(model_dir):
25+
import eimx
26+
27+
def read_data_shapes(path, preferred_batch_size=1):
28+
with open(path, "r") as f:
29+
signatures = json.load(f)
30+
31+
data_names = []
32+
data_shapes = []
33+
34+
for s in signatures:
35+
name = s["name"]
36+
data_names.append(name)
37+
38+
shape = s["shape"]
39+
40+
if preferred_batch_size:
41+
shape[0] = preferred_batch_size
42+
43+
data_shapes.append((name, shape))
44+
45+
return data_names, data_shapes
46+
47+
shapes_file = os.path.join(model_dir, "model-shapes.json")
48+
data_names, data_shapes = read_data_shapes(shapes_file)
49+
50+
ctx = mx.cpu()
51+
sym, args, aux = mx.model.load_checkpoint(os.path.join(model_dir, "model"), 0)
52+
sym = sym.optimize_for("EIA")
53+
54+
mod = mx.mod.Module(symbol=sym, context=ctx, data_names=data_names, label_names=None)
55+
mod.bind(for_training=False, data_shapes=data_shapes)
56+
mod.set_params(args, aux, allow_missing=True)
57+
58+
return mod

tests/data/pytorch_neo/cat.jpg

114 KB
Loading

0 commit comments

Comments
 (0)