Skip to content

Commit 5770d12

Browse files
authored
Merge branch 'master' into master
2 parents fd34078 + 7805aae commit 5770d12

23 files changed

+1156
-42
lines changed

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Changelog
22

3+
## v2.45.0 (2021-06-07)
4+
5+
### Features
6+
7+
* Add support for Callback steps in model building pipelines
8+
9+
## v2.44.0 (2021-06-01)
10+
11+
### Features
12+
13+
* support endpoint_name_prefix, seed and version for Clarify
14+
15+
## v2.43.0 (2021-05-31)
16+
17+
### Features
18+
19+
* add xgboost framework version 1.3-1
20+
21+
### Bug Fixes and Other Changes
22+
23+
* remove duplicated tags in _append_project_tags
24+
25+
## v2.42.1 (2021-05-27)
26+
27+
### Bug Fixes and Other Changes
28+
29+
* default value removed if zero for integer param
30+
331
## v2.42.0 (2021-05-24)
432

533
### Features

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.42.1.dev0
1+
2.45.1.dev0

src/sagemaker/_studio.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def _append_project_tags(tags=None, working_dir=None):
4646
return tags
4747

4848
all_tags = tags or []
49+
additional_tags = [tag for tag in additional_tags if tag not in all_tags]
4950
all_tags.extend(additional_tags)
5051

5152
return all_tags

src/sagemaker/clarify.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020
import os
2121
import tempfile
22-
22+
import re
2323
from sagemaker.processing import ProcessingInput, ProcessingOutput, Processor
2424
from sagemaker import image_uris, s3, utils
2525

@@ -124,8 +124,9 @@ def __init__(
124124
content_template=None,
125125
custom_attributes=None,
126126
accelerator_type=None,
127+
endpoint_name_prefix=None,
127128
):
128-
"""Initializes a configuration of a model and the endpoint to be created for it.
129+
r"""Initializes a configuration of a model and the endpoint to be created for it.
129130
130131
Args:
131132
model_name (str): Model name (as created by 'CreateModel').
@@ -155,12 +156,21 @@ def __init__(
155156
accelerator_type (str): The Elastic Inference accelerator type to deploy to the model
156157
endpoint instance for making inferences to the model, see
157158
https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html.
159+
endpoint_name_prefix (str): The endpoint name prefix of a new endpoint. Must follow
160+
pattern "^[a-zA-Z0-9](-\*[a-zA-Z0-9]".
158161
"""
159162
self.predictor_config = {
160163
"model_name": model_name,
161164
"instance_type": instance_type,
162165
"initial_instance_count": instance_count,
163166
}
167+
if endpoint_name_prefix is not None:
168+
if re.search("^[a-zA-Z0-9](-*[a-zA-Z0-9])", endpoint_name_prefix) is None:
169+
raise ValueError(
170+
"Invalid endpoint_name_prefix."
171+
" Please follow pattern ^[a-zA-Z0-9](-*[a-zA-Z0-9])."
172+
)
173+
self.predictor_config["endpoint_name_prefix"] = endpoint_name_prefix
164174
if accept_type is not None:
165175
if accept_type not in ["text/csv", "application/jsonlines"]:
166176
raise ValueError(
@@ -277,6 +287,7 @@ def __init__(
277287
agg_method,
278288
use_logit=False,
279289
save_local_shap_values=True,
290+
seed=None,
280291
):
281292
"""Initializes config for SHAP.
282293
@@ -297,6 +308,7 @@ def __init__(
297308
have log-odds units.
298309
save_local_shap_values (bool): Indicator of whether to save the local SHAP values
299310
in the output location. Default is True.
311+
seed (int): seed value to get deterministic SHAP values. Default is None.
300312
"""
301313
if agg_method not in ["mean_abs", "median", "mean_sq"]:
302314
raise ValueError(
@@ -310,6 +322,8 @@ def __init__(
310322
"use_logit": use_logit,
311323
"save_local_shap_values": save_local_shap_values,
312324
}
325+
if seed is not None:
326+
self.shap_config["seed"] = seed
313327

314328
def get_explainability_config(self):
315329
"""Returns config."""
@@ -336,6 +350,7 @@ def __init__(
336350
env=None,
337351
tags=None,
338352
network_config=None,
353+
version=None,
339354
):
340355
"""Initializes a ``Processor`` instance, computing bias metrics and model explanations.
341356
@@ -369,8 +384,9 @@ def __init__(
369384
A :class:`~sagemaker.network.NetworkConfig`
370385
object that configures network isolation, encryption of
371386
inter-container traffic, security group IDs, and subnets.
387+
version (str): Clarify version want to be used.
372388
"""
373-
container_uri = image_uris.retrieve("clarify", sagemaker_session.boto_region_name)
389+
container_uri = image_uris.retrieve("clarify", sagemaker_session.boto_region_name, version)
374390
super(SageMakerClarifyProcessor, self).__init__(
375391
role,
376392
container_uri,

src/sagemaker/image_uri_config/huggingface.json

+99-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"processors": ["gpu"],
44
"version_aliases": {
55
"4.4": "4.4.2",
6-
"4.5": "4.5.0"
6+
"4.5": "4.5.0",
7+
"4.6": "4.6.1"
78
},
89
"versions": {
910
"4.4.2": {
@@ -137,6 +138,103 @@
137138
},
138139
"repository": "huggingface-tensorflow-training"
139140
}
141+
},
142+
"4.6.1": {
143+
"version_aliases": {
144+
"pytorch1.6": "pytorch1.6.0",
145+
"pytorch1.7": "pytorch1.7.1",
146+
"tensorflow2.4": "tensorflow2.4.1"
147+
},
148+
"pytorch1.6.0": {
149+
"py_versions": ["py36"],
150+
"registries": {
151+
"af-south-1": "626614931356",
152+
"ap-east-1": "871362719292",
153+
"ap-northeast-1": "763104351884",
154+
"ap-northeast-2": "763104351884",
155+
"ap-south-1": "763104351884",
156+
"ap-southeast-1": "763104351884",
157+
"ap-southeast-2": "763104351884",
158+
"ca-central-1": "763104351884",
159+
"cn-north-1": "727897471807",
160+
"cn-northwest-1": "727897471807",
161+
"eu-central-1": "763104351884",
162+
"eu-north-1": "763104351884",
163+
"eu-west-1": "763104351884",
164+
"eu-west-2": "763104351884",
165+
"eu-west-3": "763104351884",
166+
"eu-south-1": "692866216735",
167+
"me-south-1": "217643126080",
168+
"sa-east-1": "763104351884",
169+
"us-east-1": "763104351884",
170+
"us-east-2": "763104351884",
171+
"us-gov-west-1": "442386744353",
172+
"us-iso-east-1": "886529160074",
173+
"us-west-1": "763104351884",
174+
"us-west-2": "763104351884"
175+
},
176+
"repository": "huggingface-pytorch-training"
177+
},
178+
"pytorch1.7.1": {
179+
"py_versions": ["py36"],
180+
"registries": {
181+
"af-south-1": "626614931356",
182+
"ap-east-1": "871362719292",
183+
"ap-northeast-1": "763104351884",
184+
"ap-northeast-2": "763104351884",
185+
"ap-south-1": "763104351884",
186+
"ap-southeast-1": "763104351884",
187+
"ap-southeast-2": "763104351884",
188+
"ca-central-1": "763104351884",
189+
"cn-north-1": "727897471807",
190+
"cn-northwest-1": "727897471807",
191+
"eu-central-1": "763104351884",
192+
"eu-north-1": "763104351884",
193+
"eu-west-1": "763104351884",
194+
"eu-west-2": "763104351884",
195+
"eu-west-3": "763104351884",
196+
"eu-south-1": "692866216735",
197+
"me-south-1": "217643126080",
198+
"sa-east-1": "763104351884",
199+
"us-east-1": "763104351884",
200+
"us-east-2": "763104351884",
201+
"us-gov-west-1": "442386744353",
202+
"us-iso-east-1": "886529160074",
203+
"us-west-1": "763104351884",
204+
"us-west-2": "763104351884"
205+
},
206+
"repository": "huggingface-pytorch-training"
207+
},
208+
"tensorflow2.4.1": {
209+
"py_versions": ["py37"],
210+
"registries": {
211+
"af-south-1": "626614931356",
212+
"ap-east-1": "871362719292",
213+
"ap-northeast-1": "763104351884",
214+
"ap-northeast-2": "763104351884",
215+
"ap-south-1": "763104351884",
216+
"ap-southeast-1": "763104351884",
217+
"ap-southeast-2": "763104351884",
218+
"ca-central-1": "763104351884",
219+
"cn-north-1": "727897471807",
220+
"cn-northwest-1": "727897471807",
221+
"eu-central-1": "763104351884",
222+
"eu-north-1": "763104351884",
223+
"eu-south-1": "692866216735",
224+
"eu-west-1": "763104351884",
225+
"eu-west-2": "763104351884",
226+
"eu-west-3": "763104351884",
227+
"me-south-1": "217643126080",
228+
"sa-east-1": "763104351884",
229+
"us-east-1": "763104351884",
230+
"us-east-2": "763104351884",
231+
"us-gov-west-1": "442386744353",
232+
"us-iso-east-1": "886529160074",
233+
"us-west-1": "763104351884",
234+
"us-west-2": "763104351884"
235+
},
236+
"repository": "huggingface-tensorflow-training"
237+
}
140238
}
141239
}
142240
}

src/sagemaker/image_uri_config/xgboost.json

+29
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,35 @@
183183
"us-west-2": "246618743249"
184184
},
185185
"repository": "sagemaker-xgboost"
186+
},
187+
"1.3-1": {
188+
"registries": {
189+
"af-south-1": "510948584623",
190+
"ap-east-1": "651117190479",
191+
"ap-northeast-1": "354813040037",
192+
"ap-northeast-2": "366743142698",
193+
"ap-south-1": "720646828776",
194+
"ap-southeast-1": "121021644041",
195+
"ap-southeast-2": "783357654285",
196+
"ca-central-1": "341280168497",
197+
"cn-north-1": "450853457545",
198+
"cn-northwest-1": "451049120500",
199+
"eu-central-1": "492215442770",
200+
"eu-north-1": "662702820516",
201+
"eu-west-1": "141502667606",
202+
"eu-west-2": "764974769150",
203+
"eu-west-3": "659782779980",
204+
"eu-south-1": "978288397137",
205+
"me-south-1": "801668240914",
206+
"sa-east-1": "737474898029",
207+
"us-east-1": "683313688378",
208+
"us-east-2": "257758044811",
209+
"us-gov-west-1": "414596584902",
210+
"us-iso-east-1": "833128469047",
211+
"us-west-1": "746614075791",
212+
"us-west-2": "246618743249"
213+
},
214+
"repository": "sagemaker-xgboost"
186215
}
187216
}
188217
}

src/sagemaker/local/local_session.py

+3
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ def invoke_endpoint(
469469
if InferenceId is not None:
470470
headers["X-Amzn-SageMaker-Inference-Id"] = InferenceId
471471

472+
# The http client encodes all strings using latin-1, which is not what we want.
473+
if isinstance(Body, str):
474+
Body = Body.encode("utf-8")
472475
r = self.http.request("POST", url, body=Body, preload_content=False, headers=headers)
473476

474477
return {"Body": r, "ContentType": Accept}

src/sagemaker/session.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3515,7 +3515,11 @@ def get_caller_identity_arn(self):
35153515
user_profile_desc = self.sagemaker_client.describe_user_profile(
35163516
DomainId=domain_id, UserProfileName=user_profile_name
35173517
)
3518-
return user_profile_desc["UserSettings"]["ExecutionRole"]
3518+
if user_profile_desc.get("UserSettings") is not None:
3519+
return user_profile_desc["UserSettings"]["ExecutionRole"]
3520+
3521+
domain_desc = self.sagemaker_client.describe_domain(DomainId=domain_id)
3522+
return domain_desc["DefaultUserSettings"]["ExecutionRole"]
35193523
except ClientError:
35203524
LOGGER.debug(
35213525
"Couldn't call 'describe_notebook_instance' to get the Role "

0 commit comments

Comments
 (0)