Skip to content

Commit 3b65c30

Browse files
authored
Merge branch 'master' into mask-creds-local-mode
2 parents 91563fb + 0578a3d commit 3b65c30

23 files changed

+1608
-166
lines changed

CHANGELOG.md

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

3+
## v2.25.2 (2021-02-25)
4+
5+
### Bug Fixes and Other Changes
6+
7+
* Use the output path to store the Clarify config file
8+
* feature group should ignore nan values
9+
* ignore failing smdataparallel test
10+
* Add tests for Training job & Transform job in visualizer
11+
* visualizer for pipeline processing job steps
12+
13+
### Documentation Changes
14+
15+
* update doc for Elastic Inference MXNet 1.7.0
16+
317
## v2.25.1 (2021-02-20)
418

519
### 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.25.3.dev0

src/sagemaker/clarify.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import tempfile
2222

2323
from sagemaker.processing import ProcessingInput, ProcessingOutput, Processor
24-
from sagemaker import image_uris, utils
24+
from sagemaker import image_uris, s3, utils
2525

2626

2727
class DataConfig:
@@ -405,9 +405,15 @@ def _run(
405405
analysis_config_file = os.path.join(tmpdirname, "analysis_config.json")
406406
with open(analysis_config_file, "w") as f:
407407
json.dump(analysis_config, f)
408+
s3_analysis_config_file = _upload_analysis_config(
409+
analysis_config_file,
410+
data_config.s3_output_path,
411+
self.sagemaker_session,
412+
kms_key,
413+
)
408414
config_input = ProcessingInput(
409415
input_name="analysis_config",
410-
source=analysis_config_file,
416+
source=s3_analysis_config_file,
411417
destination=self._CLARIFY_CONFIG_INPUT,
412418
s3_data_type="S3Prefix",
413419
s3_input_mode="File",
@@ -638,6 +644,30 @@ def run_explainability(
638644
self._run(data_config, analysis_config, wait, logs, job_name, kms_key)
639645

640646

647+
def _upload_analysis_config(analysis_config_file, s3_output_path, sagemaker_session, kms_key):
648+
"""Uploads the local analysis_config_file to the s3_output_path.
649+
650+
Args:
651+
analysis_config_file (str): File path to the local analysis config file.
652+
s3_output_path (str): S3 prefix to store the analysis config file.
653+
sagemaker_session (:class:`~sagemaker.session.Session`):
654+
Session object which manages interactions with Amazon SageMaker and
655+
any other AWS services needed. If not specified, the processor creates
656+
one using the default AWS configuration chain.
657+
kms_key (str): The ARN of the KMS key that is used to encrypt the
658+
user code file (default: None).
659+
660+
Returns:
661+
The S3 uri of the uploaded file.
662+
"""
663+
return s3.S3Uploader.upload(
664+
local_path=analysis_config_file,
665+
desired_s3_uri=s3_output_path,
666+
sagemaker_session=sagemaker_session,
667+
kms_key=kms_key,
668+
)
669+
670+
641671
def _set(value, key, dictionary):
642672
"""Sets dictionary[key] = value if value is not None."""
643673
if value is not None:

src/sagemaker/feature_store/feature_group.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def _ingest_single_batch(
185185
feature_name=data_frame.columns[index], value_as_string=str(row[index])
186186
)
187187
for index in range(len(row))
188+
if pd.notna(row[index])
188189
]
189190
sagemaker_session.put_record(
190191
feature_group_name=feature_group_name, record=[value.to_dict() for value in record]

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"):

0 commit comments

Comments
 (0)