Skip to content

Commit 54a8463

Browse files
authored
Merge branch 'master' into fix/make-instance-type-optional
2 parents 2c4fa5d + 60723ed commit 54a8463

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1137
-338
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.92.2 (2022-05-31)
4+
5+
### Bug Fixes and Other Changes
6+
7+
* turn off Pipeline Parameter inheritance from python primitives
8+
* Add more validations for pipeline step new interfaces
9+
* Changed method description per AWS request
10+
11+
## v2.92.1 (2022-05-26)
12+
13+
### Bug Fixes and Other Changes
14+
15+
* pin protobuf to < 4.0 to fix breaking change
16+
317
## v2.92.0 (2022-05-26)
418

519
### Features

VERSION

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

src/sagemaker/clarify.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def run_pre_training_bias(
827827
"`TVD <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-data-bias-metric-total-variation-distance.html>`_",
828828
"`KS <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-data-bias-metric-kolmogorov-smirnov.html>`_",
829829
"`CDDL <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-data-bias-metric-cddl.html>`_"].
830-
Defaults to computing all.
830+
Defaults to str "all" to run all metrics if left unspecified.
831831
wait (bool): Whether the call should wait until the job completes (default: True).
832832
logs (bool): Whether to show the logs produced by the job.
833833
Only meaningful when ``wait`` is True (default: True).
@@ -906,7 +906,7 @@ def run_post_training_bias(
906906
"`CDDPL <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-cddpl.html>`_
907907
", "`TE <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-te.html>`_",
908908
"`FT <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-ft.html>`_"].
909-
Defaults to computing all.
909+
Defaults to str "all" to run all metrics if left unspecified.
910910
wait (bool): Whether the call should wait until the job completes (default: True).
911911
logs (bool): Whether to show the logs produced by the job.
912912
Only meaningful when ``wait`` is True (default: True).
@@ -989,7 +989,7 @@ def run_bias(
989989
"`TVD <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-data-bias-metric-total-variation-distance.html>`_",
990990
"`KS <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-data-bias-metric-kolmogorov-smirnov.html>`_",
991991
"`CDDL <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-data-bias-metric-cddl.html>`_"].
992-
Defaults to computing all.
992+
Defaults to str "all" to run all metrics if left unspecified.
993993
post_training_methods (str or list[str]): Selector of a subset of potential metrics:
994994
["`DPPL <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-dppl.html>`_"
995995
, "`DI <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-di.html>`_",
@@ -1002,7 +1002,7 @@ def run_bias(
10021002
"`CDDPL <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-cddpl.html>`_
10031003
", "`TE <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-te.html>`_",
10041004
"`FT <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-post-training-bias-metric-ft.html>`_"].
1005-
Defaults to computing all.
1005+
Defaults to str "all" to run all metrics if left unspecified.
10061006
wait (bool): Whether the call should wait until the job completes (default: True).
10071007
logs (bool): Whether to show the logs produced by the job.
10081008
Only meaningful when ``wait`` is True (default: True).

src/sagemaker/estimator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ def __init__(
483483
if (
484484
not self.sagemaker_session.local_mode
485485
and output_path
486+
and not is_pipeline_variable(output_path)
486487
and output_path.startswith("file://")
487488
):
488489
raise RuntimeError("file:// output paths are only supported in Local Mode")
@@ -1340,6 +1341,11 @@ def register(
13401341
Returns:
13411342
str: A string of SageMaker Model Package ARN.
13421343
"""
1344+
if isinstance(self.sagemaker_session, PipelineSession):
1345+
raise TypeError(
1346+
"estimator.register does not support PipelineSession at this moment. "
1347+
"Please use model.register with PipelineSession if you're using the ModelStep."
1348+
)
13431349
default_name = name_from_base(self.base_job_name)
13441350
model_name = model_name or default_name
13451351
if compile_model_family is not None:

src/sagemaker/fw_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ def warn_if_parameter_server_with_multi_gpu(training_instance_type, distribution
428428
"""
429429
if training_instance_type == "local" or distribution is None:
430430
return
431+
if is_pipeline_variable(training_instance_type):
432+
# The training_instance_type is not available in compile time.
433+
# Rather, it's given in Pipeline execution time
434+
return
431435

432436
is_multi_gpu_instance = (
433437
training_instance_type == "local_gpu"
@@ -485,6 +489,10 @@ def validate_smdistributed(
485489
if "smdistributed" not in distribution:
486490
# Distribution strategy other than smdistributed is selected
487491
return
492+
if is_pipeline_variable(instance_type):
493+
# The instance_type is not available in compile time.
494+
# Rather, it's given in Pipeline execution time
495+
return
488496

489497
# distribution contains smdistributed
490498
smdistributed = distribution["smdistributed"]

src/sagemaker/image_uri_config/mxnet.json

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"1.4": "1.4.1",
1111
"1.6": "1.6.0",
1212
"1.7": "1.7.0",
13-
"1.8": "1.8.0"
13+
"1.8": "1.8.0",
14+
"1.9": "1.9.0"
1415
},
1516
"versions": {
1617
"0.12.1": {
@@ -346,6 +347,37 @@
346347
},
347348
"repository": "mxnet-training",
348349
"py_versions": ["py37"]
350+
},
351+
"1.9.0": {
352+
"registries": {
353+
"af-south-1": "626614931356",
354+
"ap-east-1": "871362719292",
355+
"ap-northeast-1": "763104351884",
356+
"ap-northeast-2": "763104351884",
357+
"ap-northeast-3": "364406365360",
358+
"ap-south-1": "763104351884",
359+
"ap-southeast-1": "763104351884",
360+
"ap-southeast-2": "763104351884",
361+
"ca-central-1": "763104351884",
362+
"cn-north-1": "727897471807",
363+
"cn-northwest-1": "727897471807",
364+
"eu-central-1": "763104351884",
365+
"eu-north-1": "763104351884",
366+
"eu-west-1": "763104351884",
367+
"eu-west-2": "763104351884",
368+
"eu-west-3": "763104351884",
369+
"eu-south-1": "692866216735",
370+
"me-south-1": "217643126080",
371+
"sa-east-1": "763104351884",
372+
"us-east-1": "763104351884",
373+
"us-east-2": "763104351884",
374+
"us-gov-west-1": "442386744353",
375+
"us-iso-east-1": "886529160074",
376+
"us-west-1": "763104351884",
377+
"us-west-2": "763104351884"
378+
},
379+
"repository": "mxnet-training",
380+
"py_versions": ["py38"]
349381
}
350382
}
351383
},
@@ -358,7 +390,10 @@
358390
"1.2": "1.2.1",
359391
"1.3": "1.3.0",
360392
"1.4": "1.4.1",
361-
"1.6": "1.6.0"
393+
"1.6": "1.6.0",
394+
"1.7": "1.7.0",
395+
"1.8": "1.8.0",
396+
"1.9": "1.9.0"
362397
},
363398
"versions": {
364399
"0.12.1": {
@@ -694,6 +729,37 @@
694729
},
695730
"repository": "mxnet-inference",
696731
"py_versions": ["py37"]
732+
},
733+
"1.9.0": {
734+
"registries": {
735+
"af-south-1": "626614931356",
736+
"ap-east-1": "871362719292",
737+
"ap-northeast-1": "763104351884",
738+
"ap-northeast-2": "763104351884",
739+
"ap-northeast-3": "364406365360",
740+
"ap-south-1": "763104351884",
741+
"ap-southeast-1": "763104351884",
742+
"ap-southeast-2": "763104351884",
743+
"ca-central-1": "763104351884",
744+
"cn-north-1": "727897471807",
745+
"cn-northwest-1": "727897471807",
746+
"eu-central-1": "763104351884",
747+
"eu-north-1": "763104351884",
748+
"eu-west-1": "763104351884",
749+
"eu-west-2": "763104351884",
750+
"eu-west-3": "763104351884",
751+
"eu-south-1": "692866216735",
752+
"me-south-1": "217643126080",
753+
"sa-east-1": "763104351884",
754+
"us-east-1": "763104351884",
755+
"us-east-2": "763104351884",
756+
"us-gov-west-1": "442386744353",
757+
"us-iso-east-1": "886529160074",
758+
"us-west-1": "763104351884",
759+
"us-west-2": "763104351884"
760+
},
761+
"repository": "mxnet-inference",
762+
"py_versions": ["py38"]
697763
}
698764
}
699765
},

src/sagemaker/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,14 @@ def _upload_code(self, key_prefix: str, repack: bool = False) -> None:
500500
if is_pipeline_variable(self.model_data):
501501
# model is not yet there, defer repacking to later during pipeline execution
502502
if not isinstance(self.sagemaker_session, PipelineSession):
503-
# TODO: link the doc in the warning once ready
504503
logging.warning(
505504
"The model_data is a Pipeline variable of type %s, "
506505
"which should be used under `PipelineSession` and "
507506
"leverage `ModelStep` to create or register model. "
508507
"Otherwise some functionalities e.g. "
509-
"runtime repack may be missing",
508+
"runtime repack may be missing. For more, see: "
509+
"https://sagemaker.readthedocs.io/en/stable/"
510+
"amazon_sagemaker_model_building_pipeline.html#model-step",
510511
type(self.model_data),
511512
)
512513
return

src/sagemaker/pipeline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def register(
278278
description: Optional[str] = None,
279279
drift_check_baselines: Optional[DriftCheckBaselines] = None,
280280
customer_metadata_properties: Optional[Dict[str, str]] = None,
281+
domain: Optional[str] = None,
281282
):
282283
"""Creates a model package for creating SageMaker models or listing on Marketplace.
283284
@@ -305,6 +306,8 @@ def register(
305306
drift_check_baselines (DriftCheckBaselines): DriftCheckBaselines object (default: None).
306307
customer_metadata_properties (dict[str, str]): A dictionary of key-value paired
307308
metadata properties (default: None).
309+
domain (str): Domain values can be "COMPUTER_VISION", "NATURAL_LANGUAGE_PROCESSING",
310+
"MACHINE_LEARNING" (default: None).
308311
309312
Returns:
310313
A `sagemaker.model.ModelPackage` instance.
@@ -337,6 +340,7 @@ def register(
337340
container_def_list=container_def,
338341
drift_check_baselines=drift_check_baselines,
339342
customer_metadata_properties=customer_metadata_properties,
343+
domain=domain,
340344
)
341345

342346
self.sagemaker_session.create_model_package_from_containers(**model_pkg_args)

src/sagemaker/session.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ def submit(request):
591591
LOGGER.debug("train request: %s", json.dumps(request, indent=4))
592592
self.sagemaker_client.create_training_job(**request)
593593

594-
self._intercept_create_request(train_request, submit)
594+
self._intercept_create_request(train_request, submit, self.train.__name__)
595595

596596
def _get_train_request( # noqa: C901
597597
self,
@@ -922,7 +922,7 @@ def submit(request):
922922
LOGGER.debug("process request: %s", json.dumps(request, indent=4))
923923
self.sagemaker_client.create_processing_job(**request)
924924

925-
self._intercept_create_request(process_request, submit)
925+
self._intercept_create_request(process_request, submit, self.process.__name__)
926926

927927
def _get_process_request(
928928
self,
@@ -2099,7 +2099,7 @@ def submit(request):
20992099
LOGGER.debug("tune request: %s", json.dumps(request, indent=4))
21002100
self.sagemaker_client.create_hyper_parameter_tuning_job(**request)
21012101

2102-
self._intercept_create_request(tune_request, submit)
2102+
self._intercept_create_request(tune_request, submit, self.create_tuning_job.__name__)
21032103

21042104
def _get_tuning_request(
21052105
self,
@@ -2569,7 +2569,7 @@ def submit(request):
25692569
LOGGER.debug("Transform request: %s", json.dumps(request, indent=4))
25702570
self.sagemaker_client.create_transform_job(**request)
25712571

2572-
self._intercept_create_request(transform_request, submit)
2572+
self._intercept_create_request(transform_request, submit, self.transform.__name__)
25732573

25742574
def _create_model_request(
25752575
self,

src/sagemaker/tensorflow/estimator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from sagemaker.tensorflow.model import TensorFlowModel
2626
from sagemaker.transformer import Transformer
2727
from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
28+
from sagemaker.workflow import is_pipeline_variable
2829

2930
logger = logging.getLogger("sagemaker")
3031

@@ -378,6 +379,9 @@ def _default_s3_path(self, directory, mpi=False):
378379
if mpi:
379380
return "/opt/ml/model"
380381
if self._current_job_name:
382+
if is_pipeline_variable(self.output_path):
383+
output_path = "s3://{}".format(self.sagemaker_session.default_bucket())
384+
return s3.s3_path_join(output_path, self._current_job_name, directory)
381385
return s3.s3_path_join(self.output_path, self._current_job_name, directory)
382386
return None
383387

src/sagemaker/tensorflow/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,14 @@ def prepare_container_def(
362362
if isinstance(self.sagemaker_session, PipelineSession):
363363
self.sagemaker_session.context.need_runtime_repack.add(id(self))
364364
else:
365-
# TODO: link the doc in the warning once ready
366365
logging.warning(
367366
"The model_data is a Pipeline variable of type %s, "
368367
"which should be used under `PipelineSession` and "
369368
"leverage `ModelStep` to create or register model. "
370369
"Otherwise some functionalities e.g. "
371-
"runtime repack may be missing",
370+
"runtime repack may be missing. For more, see: "
371+
"https://sagemaker.readthedocs.io/en/stable/"
372+
"amazon_sagemaker_model_building_pipeline.html#model-step",
372373
type(self.model_data),
373374
)
374375
model_data = self.model_data

src/sagemaker/transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def transform(
191191
Only meaningful when wait is ``True`` (default: ``True``).
192192
"""
193193
local_mode = self.sagemaker_session.local_mode
194-
if not local_mode and not data.startswith("s3://"):
194+
if not local_mode and not is_pipeline_variable(data) and not data.startswith("s3://"):
195195
raise ValueError("Invalid S3 URI: {}".format(data))
196196

197197
if job_name is not None:

src/sagemaker/workflow/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@
1212
# language governing permissions and limitations under the License.
1313
"""Defines Types etc. used in workflow."""
1414
from __future__ import absolute_import
15-
from typing import Union
1615

1716
from sagemaker.workflow.entities import Expression
18-
from sagemaker.workflow.execution_variables import ExecutionVariable
19-
from sagemaker.workflow.parameters import Parameter
20-
from sagemaker.workflow.properties import Properties
21-
22-
PipelineNonPrimitiveInputTypes = Union[ExecutionVariable, Expression, Parameter, Properties]
2317

2418

2519
def is_pipeline_variable(var: object) -> bool:

0 commit comments

Comments
 (0)