Skip to content

Commit 431e853

Browse files
Merge branch 'dev' into inference-url
2 parents b31dd14 + 554d735 commit 431e853

33 files changed

+1033
-53
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ venv/
2727
*.swp
2828
.docker/
2929
env/
30-
.vscode/
30+
.vscode/
31+
.python-version

CHANGELOG.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,53 @@
11
# Changelog
22

3+
## v2.72.3 (2022-01-10)
4+
5+
### Features
6+
7+
* default repack encryption
8+
* support large pipeline
9+
* add support for pytorch 1.10.0
10+
11+
### Documentation Changes
12+
13+
* SageMaker model parallel library 1.6.0 API doc
14+
15+
### Bug Fixes and Other Changes
16+
17+
* Model Registration with BYO scripts
18+
* Add ContentType in test_auto_ml_describe
19+
* Re-deploy static integ test endpoint if it is not found
20+
* fix kmeans test deletion sequence, increment lineage statics
21+
* Increment static lineage pipeline
22+
* Fix lineage query integ tests
23+
* Add label_headers option for Clarify ModelExplainabilityMonitor
24+
* Add action type to lineage object
25+
* Collapse cross-account artifacts in query lineage response
26+
* Update CHANGELOG.md to remove defaulting dot characters
27+
28+
## v2.72.2 (2022-01-06)
29+
30+
### Bug Fixes and Other Changes
31+
32+
* Update CHANGELOG.md
33+
* Increment static lineage pipeline
34+
* fix kmeans test deletion sequence, increment lineage statics
35+
* Re-deploy static integ test endpoint if it is not found
36+
* Add ContentType in test_auto_ml_describe
37+
* Model Registration with BYO scripts
38+
39+
### Documentation Changes
40+
41+
* SageMaker model parallel library 1.6.0 API doc
42+
343
## v2.72.1 (2021-12-20)
444

545
### Bug Fixes and Other Changes
646

747
* typos and broken link
848
* S3Input - add support for instance attributes
949
* Prevent repack_model script from referencing nonexistent directories
10-
* Set ProcessingStep upload locations deterministically to avoid c…
50+
* Set ProcessingStep upload locations deterministically to avoid cache
1151

1252
## v2.72.0 (2021-12-13)
1353

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.72.2.dev0
1+
2.72.4.dev0

doc/workflows/pipelines/sagemaker.workflow.pipelines.rst

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ Pipeline
8282
.. autoclass:: sagemaker.workflow.pipeline._PipelineExecution
8383
:members:
8484

85+
Parallelism Configuration
86+
-------------------------
87+
88+
.. autoclass:: sagemaker.workflow.parallelism_config.ParallelismConfiguration
89+
:members:
90+
8591
Pipeline Experiment Config
8692
--------------------------
8793

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def read_version():
104104
"Programming Language :: Python :: 3.6",
105105
"Programming Language :: Python :: 3.7",
106106
"Programming Language :: Python :: 3.8",
107+
"Programming Language :: Python :: 3.9",
107108
],
108109
install_requires=required_packages,
109110
extras_require=extras,

src/sagemaker/clarify.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,15 @@ def __init__(
290290
probability_threshold (float): An optional value for binary prediction tasks in which
291291
the model returns a probability, to indicate the threshold to convert the
292292
prediction to a boolean value. Default is 0.5.
293-
label_headers (list): List of label values - one for each score of the ``probability``.
293+
label_headers (list[str]): List of headers, each for a predicted score in model output.
294+
For bias analysis, it is used to extract the label value with the highest score as
295+
predicted label. For explainability job, It is used to beautify the analysis report
296+
by replacing placeholders like "label0".
294297
"""
295298
self.label = label
296299
self.probability = probability
297300
self.probability_threshold = probability_threshold
301+
self.label_headers = label_headers
298302
if probability_threshold is not None:
299303
try:
300304
float(probability_threshold)
@@ -1060,10 +1064,10 @@ def run_explainability(
10601064
explainability_config (:class:`~sagemaker.clarify.ExplainabilityConfig` or list):
10611065
Config of the specific explainability method or a list of ExplainabilityConfig
10621066
objects. Currently, SHAP and PDP are the two methods supported.
1063-
model_scores(str|int|ModelPredictedLabelConfig): Index or JSONPath location in the
1064-
model output for the predicted scores to be explained. This is not required if the
1065-
model output is a single score. Alternatively, an instance of
1066-
ModelPredictedLabelConfig can be provided.
1067+
model_scores (int or str or :class:`~sagemaker.clarify.ModelPredictedLabelConfig`):
1068+
Index or JSONPath to locate the predicted scores in the model output. This is not
1069+
required if the model output is a single score. Alternatively, it can be an instance
1070+
of ModelPredictedLabelConfig to provide more parameters like label_headers.
10671071
wait (bool): Whether the call should wait until the job completes (default: True).
10681072
logs (bool): Whether to show the logs produced by the job.
10691073
Only meaningful when ``wait`` is True (default: True).

src/sagemaker/estimator.py

+1
Original file line numberDiff line numberDiff line change
@@ -2343,6 +2343,7 @@ def _stage_user_code_in_s3(self):
23432343
dependencies=self.dependencies,
23442344
kms_key=kms_key,
23452345
s3_resource=self.sagemaker_session.s3_resource,
2346+
settings=self.sagemaker_session.settings,
23462347
)
23472348

23482349
def _model_source_dir(self):

src/sagemaker/fw_utils.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
import shutil
2020
import tempfile
2121
from collections import namedtuple
22+
from typing import Optional
2223

2324
import sagemaker.image_uris
25+
from sagemaker.session_settings import SessionSettings
2426
import sagemaker.utils
2527

2628
from sagemaker.deprecations import renamed_warning
@@ -73,7 +75,20 @@
7375
"2.6.0",
7476
"2.6.2",
7577
],
76-
"pytorch": ["1.6", "1.6.0", "1.7", "1.7.1", "1.8", "1.8.0", "1.8.1", "1.9", "1.9.0", "1.9.1"],
78+
"pytorch": [
79+
"1.6",
80+
"1.6.0",
81+
"1.7",
82+
"1.7.1",
83+
"1.8",
84+
"1.8.0",
85+
"1.8.1",
86+
"1.9",
87+
"1.9.0",
88+
"1.9.1",
89+
"1.10",
90+
"1.10.0",
91+
],
7792
}
7893
SMDISTRIBUTED_SUPPORTED_STRATEGIES = ["dataparallel", "modelparallel"]
7994

@@ -203,6 +218,7 @@ def tar_and_upload_dir(
203218
dependencies=None,
204219
kms_key=None,
205220
s3_resource=None,
221+
settings: Optional[SessionSettings] = None,
206222
):
207223
"""Package source files and upload a compress tar file to S3.
208224
@@ -230,6 +246,9 @@ def tar_and_upload_dir(
230246
s3_resource (boto3.resource("s3")): Optional. Pre-instantiated Boto3 Resource
231247
for S3 connections, can be used to customize the configuration,
232248
e.g. set the endpoint URL (default: None).
249+
settings (sagemaker.session_settings.SessionSettings): Optional. The settings
250+
of the SageMaker ``Session``, can be used to override the default encryption
251+
behavior (default: None).
233252
Returns:
234253
sagemaker.fw_utils.UserCode: An object with the S3 bucket and key (S3 prefix) and
235254
script name.
@@ -241,6 +260,7 @@ def tar_and_upload_dir(
241260
dependencies = dependencies or []
242261
key = "%s/sourcedir.tar.gz" % s3_key_prefix
243262
tmp = tempfile.mkdtemp()
263+
encrypt_artifact = True if settings is None else settings.encrypt_repacked_artifacts
244264

245265
try:
246266
source_files = _list_files_to_compress(script, directory) + dependencies
@@ -250,6 +270,10 @@ def tar_and_upload_dir(
250270

251271
if kms_key:
252272
extra_args = {"ServerSideEncryption": "aws:kms", "SSEKMSKeyId": kms_key}
273+
elif encrypt_artifact:
274+
# encrypt the tarball at rest in S3 with the default AWS managed KMS key for S3
275+
# see https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_RequestSyntax
276+
extra_args = {"ServerSideEncryption": "aws:kms"}
253277
else:
254278
extra_args = None
255279

src/sagemaker/image_uri_config/pytorch.json

+70-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
"1.6": "1.6.0",
6464
"1.7": "1.7.1",
6565
"1.8": "1.8.1",
66-
"1.9": "1.9.1"
66+
"1.9": "1.9.1",
67+
"1.10": "1.10.0"
6768
},
6869
"versions": {
6970
"0.4.0": {
@@ -500,6 +501,39 @@
500501
"us-west-2": "763104351884"
501502
},
502503
"repository": "pytorch-inference"
504+
},
505+
"1.10.0": {
506+
"py_versions": [
507+
"py38"
508+
],
509+
"registries": {
510+
"af-south-1": "626614931356",
511+
"ap-east-1": "871362719292",
512+
"ap-northeast-1": "763104351884",
513+
"ap-northeast-2": "763104351884",
514+
"ap-northeast-3": "364406365360",
515+
"ap-south-1": "763104351884",
516+
"ap-southeast-1": "763104351884",
517+
"ap-southeast-2": "763104351884",
518+
"ca-central-1": "763104351884",
519+
"cn-north-1": "727897471807",
520+
"cn-northwest-1": "727897471807",
521+
"eu-central-1": "763104351884",
522+
"eu-north-1": "763104351884",
523+
"eu-west-1": "763104351884",
524+
"eu-west-2": "763104351884",
525+
"eu-west-3": "763104351884",
526+
"eu-south-1": "692866216735",
527+
"me-south-1": "217643126080",
528+
"sa-east-1": "763104351884",
529+
"us-east-1": "763104351884",
530+
"us-east-2": "763104351884",
531+
"us-gov-west-1": "442386744353",
532+
"us-iso-east-1": "886529160074",
533+
"us-west-1": "763104351884",
534+
"us-west-2": "763104351884"
535+
},
536+
"repository": "pytorch-inference"
503537
}
504538
}
505539
},
@@ -519,7 +553,8 @@
519553
"1.6": "1.6.0",
520554
"1.7": "1.7.1",
521555
"1.8": "1.8.1",
522-
"1.9": "1.9.1"
556+
"1.9": "1.9.1",
557+
"1.10": "1.10.0"
523558
},
524559
"versions": {
525560
"0.4.0": {
@@ -957,6 +992,39 @@
957992
"us-west-2": "763104351884"
958993
},
959994
"repository": "pytorch-training"
995+
},
996+
"1.10.0": {
997+
"py_versions": [
998+
"py38"
999+
],
1000+
"registries": {
1001+
"af-south-1": "626614931356",
1002+
"ap-east-1": "871362719292",
1003+
"ap-northeast-1": "763104351884",
1004+
"ap-northeast-2": "763104351884",
1005+
"ap-northeast-3": "364406365360",
1006+
"ap-south-1": "763104351884",
1007+
"ap-southeast-1": "763104351884",
1008+
"ap-southeast-2": "763104351884",
1009+
"ca-central-1": "763104351884",
1010+
"cn-north-1": "727897471807",
1011+
"cn-northwest-1": "727897471807",
1012+
"eu-central-1": "763104351884",
1013+
"eu-north-1": "763104351884",
1014+
"eu-west-1": "763104351884",
1015+
"eu-west-2": "763104351884",
1016+
"eu-west-3": "763104351884",
1017+
"eu-south-1": "692866216735",
1018+
"me-south-1": "217643126080",
1019+
"sa-east-1": "763104351884",
1020+
"us-east-1": "763104351884",
1021+
"us-east-2": "763104351884",
1022+
"us-gov-west-1": "442386744353",
1023+
"us-iso-east-1": "886529160074",
1024+
"us-west-1": "763104351884",
1025+
"us-west-2": "763104351884"
1026+
},
1027+
"repository": "pytorch-training"
9601028
}
9611029
}
9621030
}

src/sagemaker/image_uris.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def retrieve(
5353
py_version (str): The Python version. This is required if there is
5454
more than one supported Python version for the given framework version.
5555
instance_type (str): The SageMaker instance type. For supported types, see
56-
https://aws.amazon.com/sagemaker/pricing/instance-types. This is required if
56+
https://aws.amazon.com/sagemaker/pricing. This is required if
5757
there are different images for different processor types.
5858
accelerator_type (str): Elastic Inference accelerator type. For more, see
5959
https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html.

src/sagemaker/lineage/context.py

+49
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,55 @@ def models(self) -> List[association.Association]:
283283
]
284284
return model_list
285285

286+
def models_v2(
287+
self, direction: LineageQueryDirectionEnum = LineageQueryDirectionEnum.DESCENDANTS
288+
) -> List[Artifact]:
289+
"""Get artifacts representing models from the context lineage by querying lineage data.
290+
291+
Args:
292+
direction (LineageQueryDirectionEnum, optional): The query direction.
293+
294+
Returns:
295+
list of Artifacts: Artifacts representing a model.
296+
"""
297+
# Firstly query out the model_deployment vertices
298+
query_filter = LineageFilter(
299+
entities=[LineageEntityEnum.ACTION], sources=[LineageSourceEnum.MODEL_DEPLOYMENT]
300+
)
301+
model_deployment_query_result = LineageQuery(self.sagemaker_session).query(
302+
start_arns=[self.context_arn],
303+
query_filter=query_filter,
304+
direction=direction,
305+
include_edges=False,
306+
)
307+
if not model_deployment_query_result:
308+
return []
309+
310+
model_deployment_vertices: [] = model_deployment_query_result.vertices
311+
312+
# Secondary query model based on model deployment
313+
model_vertices = []
314+
for vertex in model_deployment_vertices:
315+
query_result = LineageQuery(self.sagemaker_session).query(
316+
start_arns=[vertex.arn],
317+
query_filter=LineageFilter(
318+
entities=[LineageEntityEnum.ARTIFACT], sources=[LineageSourceEnum.MODEL]
319+
),
320+
direction=LineageQueryDirectionEnum.DESCENDANTS,
321+
include_edges=False,
322+
)
323+
model_vertices.extend(query_result.vertices)
324+
325+
if not model_vertices:
326+
return []
327+
328+
model_artifacts = []
329+
for vertex in model_vertices:
330+
lineage_object = vertex.to_lineage_object()
331+
model_artifacts.append(lineage_object)
332+
333+
return model_artifacts
334+
286335
def dataset_artifacts(
287336
self, direction: LineageQueryDirectionEnum = LineageQueryDirectionEnum.ASCENDANTS
288337
) -> List[Artifact]:

0 commit comments

Comments
 (0)