Skip to content

Commit 7077165

Browse files
Merge branch 'master' into user-short-lived-credentials-override
2 parents e3ac639 + 48141db commit 7077165

23 files changed

+1012
-47
lines changed

doc/api/governance/model_card.rst

+6
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ see `Amazon SageMaker Model Cards <https://docs.aws.amazon.com/sagemaker/latest/
4141

4242
.. autoclass:: TrainingJobDetails
4343
:show-inheritance:
44+
45+
.. autoclass:: BusinessDetails
46+
:show-inheritance:
47+
48+
.. autoclass:: HyperParameter
49+
:show-inheritance:

src/sagemaker/clarify.py

+24-8
Original file line numberDiff line numberDiff line change
@@ -1423,8 +1423,8 @@ def run_post_training_bias(
14231423
self,
14241424
data_config: DataConfig,
14251425
data_bias_config: BiasConfig,
1426-
model_config: ModelConfig,
1427-
model_predicted_label_config: ModelPredictedLabelConfig,
1426+
model_config: Optional[ModelConfig] = None,
1427+
model_predicted_label_config: Optional[ModelPredictedLabelConfig] = None,
14281428
methods: Union[str, List[str]] = "all",
14291429
wait: bool = True,
14301430
logs: bool = True,
@@ -1444,7 +1444,8 @@ def run_post_training_bias(
14441444
data_config (:class:`~sagemaker.clarify.DataConfig`): Config of the input/output data.
14451445
data_bias_config (:class:`~sagemaker.clarify.BiasConfig`): Config of sensitive groups.
14461446
model_config (:class:`~sagemaker.clarify.ModelConfig`): Config of the model and its
1447-
endpoint to be created.
1447+
endpoint to be created. This is required unless``predicted_label_dataset_uri`` or
1448+
``predicted_label`` is provided in ``data_config``.
14481449
model_predicted_label_config (:class:`~sagemaker.clarify.ModelPredictedLabelConfig`):
14491450
Config of how to extract the predicted label from the model output.
14501451
methods (str or list[str]): Selector of a subset of potential metrics:
@@ -1508,7 +1509,7 @@ def run_bias(
15081509
self,
15091510
data_config: DataConfig,
15101511
bias_config: BiasConfig,
1511-
model_config: ModelConfig,
1512+
model_config: Optional[ModelConfig] = None,
15121513
model_predicted_label_config: Optional[ModelPredictedLabelConfig] = None,
15131514
pre_training_methods: Union[str, List[str]] = "all",
15141515
post_training_methods: Union[str, List[str]] = "all",
@@ -1529,7 +1530,8 @@ def run_bias(
15291530
data_config (:class:`~sagemaker.clarify.DataConfig`): Config of the input/output data.
15301531
bias_config (:class:`~sagemaker.clarify.BiasConfig`): Config of sensitive groups.
15311532
model_config (:class:`~sagemaker.clarify.ModelConfig`): Config of the model and its
1532-
endpoint to be created.
1533+
endpoint to be created. This is required unless``predicted_label_dataset_uri`` or
1534+
``predicted_label`` is provided in ``data_config``.
15331535
model_predicted_label_config (:class:`~sagemaker.clarify.ModelPredictedLabelConfig`):
15341536
Config of how to extract the predicted label from the model output.
15351537
pre_training_methods (str or list[str]): Selector of a subset of potential metrics:
@@ -1930,16 +1932,30 @@ def _add_predictor(
19301932
):
19311933
"""Extends analysis config with predictor."""
19321934
analysis_config = {**analysis_config}
1933-
analysis_config["predictor"] = model_config.get_predictor_config()
1935+
if isinstance(model_config, ModelConfig):
1936+
analysis_config["predictor"] = model_config.get_predictor_config()
1937+
else:
1938+
if "shap" in analysis_config["methods"] or "pdp" in analysis_config["methods"]:
1939+
raise ValueError(
1940+
"model_config must be provided when explainability methods are selected."
1941+
)
1942+
if (
1943+
"predicted_label_dataset_uri" not in analysis_config
1944+
and "predicted_label" not in analysis_config
1945+
):
1946+
raise ValueError(
1947+
"model_config must be provided when `predicted_label_dataset_uri` or "
1948+
"`predicted_label` are not provided in data_config."
1949+
)
19341950
if isinstance(model_predicted_label_config, ModelPredictedLabelConfig):
19351951
(
19361952
probability_threshold,
19371953
predictor_config,
19381954
) = model_predicted_label_config.get_predictor_config()
1939-
if predictor_config:
1955+
if predictor_config and "predictor" in analysis_config:
19401956
analysis_config["predictor"].update(predictor_config)
19411957
_set(probability_threshold, "probability_threshold", analysis_config)
1942-
else:
1958+
elif "predictor" in analysis_config:
19431959
_set(model_predicted_label_config, "label", analysis_config["predictor"])
19441960
return analysis_config
19451961

src/sagemaker/image_uri_config/autogluon.json

+70-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"0.3": "0.3.2",
66
"0.4": "0.4.3",
77
"0.5": "0.5.2",
8-
"0.6": "0.6.1"
8+
"0.6": "0.6.2"
99
},
1010
"versions": {
1111
"0.3.1": {
@@ -242,6 +242,39 @@
242242
"repository": "autogluon-training",
243243
"processors": ["cpu", "gpu"],
244244
"py_versions": ["py38"]
245+
},
246+
"0.6.2": {
247+
"registries": {
248+
"af-south-1": "626614931356",
249+
"ap-east-1": "871362719292",
250+
"ap-northeast-1": "763104351884",
251+
"ap-northeast-2": "763104351884",
252+
"ap-northeast-3": "364406365360",
253+
"ap-south-1": "763104351884",
254+
"ap-southeast-1": "763104351884",
255+
"ap-southeast-2": "763104351884",
256+
"ap-southeast-3": "907027046896",
257+
"ca-central-1": "763104351884",
258+
"eu-central-1": "763104351884",
259+
"eu-north-1": "763104351884",
260+
"eu-west-1": "763104351884",
261+
"eu-west-2": "763104351884",
262+
"eu-west-3": "763104351884",
263+
"eu-south-1": "692866216735",
264+
"me-south-1": "217643126080",
265+
"sa-east-1": "763104351884",
266+
"us-east-1": "763104351884",
267+
"us-east-2": "763104351884",
268+
"us-gov-east-1": "446045086412",
269+
"us-gov-west-1": "442386744353",
270+
"us-iso-east-1": "886529160074",
271+
"us-isob-east-1": "094389454867",
272+
"us-west-1": "763104351884",
273+
"us-west-2": "763104351884"
274+
},
275+
"repository": "autogluon-training",
276+
"processors": ["cpu", "gpu"],
277+
"py_versions": ["py38"]
245278
}
246279
}
247280
},
@@ -250,7 +283,7 @@
250283
"0.3": "0.3.2",
251284
"0.4": "0.4.3",
252285
"0.5": "0.5.2",
253-
"0.6": "0.6.1"
286+
"0.6": "0.6.2"
254287
},
255288
"versions": {
256289
"0.3.1": {
@@ -521,6 +554,41 @@
521554
"repository": "autogluon-inference",
522555
"processors": ["cpu", "gpu"],
523556
"py_versions": ["py38"]
557+
},
558+
"0.6.2": {
559+
"registries": {
560+
"af-south-1": "626614931356",
561+
"ap-east-1": "871362719292",
562+
"ap-northeast-1": "763104351884",
563+
"ap-northeast-2": "763104351884",
564+
"ap-northeast-3": "364406365360",
565+
"ap-south-1": "763104351884",
566+
"ap-southeast-1": "763104351884",
567+
"ap-southeast-2": "763104351884",
568+
"ap-southeast-3": "907027046896",
569+
"ca-central-1": "763104351884",
570+
"cn-north-1": "727897471807",
571+
"cn-northwest-1": "727897471807",
572+
"eu-central-1": "763104351884",
573+
"eu-north-1": "763104351884",
574+
"eu-west-1": "763104351884",
575+
"eu-west-2": "763104351884",
576+
"eu-west-3": "763104351884",
577+
"eu-south-1": "692866216735",
578+
"me-south-1": "217643126080",
579+
"sa-east-1": "763104351884",
580+
"us-east-1": "763104351884",
581+
"us-east-2": "763104351884",
582+
"us-gov-east-1": "446045086412",
583+
"us-gov-west-1": "442386744353",
584+
"us-iso-east-1": "886529160074",
585+
"us-isob-east-1": "094389454867",
586+
"us-west-1": "763104351884",
587+
"us-west-2": "763104351884"
588+
},
589+
"repository": "autogluon-inference",
590+
"processors": ["cpu", "gpu"],
591+
"py_versions": ["py38"]
524592
}
525593
}
526594
}

src/sagemaker/image_uri_config/pytorch-training-compiler.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"gpu"
55
],
66
"version_aliases": {
7-
"1.12": "1.12.0"
7+
"1.12": "1.12.0",
8+
"1.13": "1.13.1"
89
},
910
"versions": {
1011
"1.12.0": {
@@ -35,6 +36,35 @@
3536
"us-west-2": "763104351884"
3637
},
3738
"repository": "pytorch-trcomp-training"
39+
},
40+
"1.13.1": {
41+
"py_versions": [
42+
"py39"
43+
],
44+
"registries": {
45+
"af-south-1": "626614931356",
46+
"ap-east-1": "871362719292",
47+
"ap-northeast-1": "763104351884",
48+
"ap-northeast-2": "763104351884",
49+
"ap-northeast-3": "364406365360",
50+
"ap-south-1": "763104351884",
51+
"ap-southeast-1": "763104351884",
52+
"ap-southeast-2": "763104351884",
53+
"ca-central-1": "763104351884",
54+
"eu-central-1": "763104351884",
55+
"eu-north-1": "763104351884",
56+
"eu-west-1": "763104351884",
57+
"eu-west-2": "763104351884",
58+
"eu-west-3": "763104351884",
59+
"eu-south-1": "692866216735",
60+
"me-south-1": "217643126080",
61+
"sa-east-1": "763104351884",
62+
"us-east-1": "763104351884",
63+
"us-east-2": "763104351884",
64+
"us-west-1": "763104351884",
65+
"us-west-2": "763104351884"
66+
},
67+
"repository": "pytorch-trcomp-training"
3868
}
3969
}
4070
}

src/sagemaker/inference_recommender/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@
1212
# language governing permissions and limitations under the License.
1313
"""Classes for using Inference Recommender with Amazon SageMaker."""
1414
from __future__ import absolute_import
15+
from sagemaker.inference_recommender.inference_recommender_mixin import ( # noqa: F401
16+
Phase,
17+
ModelLatencyThreshold,
18+
)

src/sagemaker/inference_recommender/inference_recommender_mixin.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -464,18 +464,24 @@ def _convert_to_resource_limit_json(self, max_tests: int, max_parallel_tests: in
464464
"""Bundle right_size() parameters into a resource limit for Advanced job"""
465465
if not max_tests and not max_parallel_tests:
466466
return None
467-
return {
468-
"MaxNumberOfTests": max_tests,
469-
"MaxParallelOfTests": max_parallel_tests,
470-
}
467+
resource_limit = {}
468+
if max_tests:
469+
resource_limit["MaxNumberOfTests"] = max_tests
470+
if max_parallel_tests:
471+
resource_limit["MaxParallelOfTests"] = max_parallel_tests
472+
return resource_limit
471473

472474
def _convert_to_stopping_conditions_json(
473475
self, max_invocations: int, model_latency_thresholds: List[ModelLatencyThreshold]
474476
):
475477
"""Bundle right_size() parameters into stopping conditions for Advanced job"""
476478
if not max_invocations and not model_latency_thresholds:
477479
return None
478-
return {
479-
"MaxInvocations": max_invocations,
480-
"ModelLatencyThresholds": [threshold.to_json for threshold in model_latency_thresholds],
481-
}
480+
stopping_conditions = {}
481+
if max_invocations:
482+
stopping_conditions["MaxInvocations"] = max_invocations
483+
if model_latency_thresholds:
484+
stopping_conditions["ModelLatencyThresholds"] = [
485+
threshold.to_json for threshold in model_latency_thresholds
486+
]
487+
return stopping_conditions

src/sagemaker/model_card/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
Environment,
1717
ModelOverview,
1818
IntendedUses,
19+
BusinessDetails,
1920
ObjectiveFunction,
2021
TrainingMetric,
22+
HyperParameter,
2123
Metric,
2224
Function,
2325
TrainingJobDetails,

0 commit comments

Comments
 (0)