Skip to content

Commit dbdaa4c

Browse files
Merge branch 'master' into master
2 parents e237f09 + 764f61b commit dbdaa4c

File tree

15 files changed

+111
-23
lines changed

15 files changed

+111
-23
lines changed

doc/amazon_sagemaker_model_building_pipeline.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Referable Property List:
239239
ProcessingOutput(output_name="train", source="/opt/ml/processing/train"),
240240
],
241241
code="./local/preprocess.py",
242-
job_arguments=["--input-data", "s3://my-input"]
242+
arguments=["--input-data", "s3://my-input"]
243243
),
244244
)
245245
@@ -496,7 +496,7 @@ A :class:`sagemaker.workflow.properties.PropertyFile` is designed to store infor
496496
ProcessingOutput(output_name="hyperparam", source="/opt/ml/processing/evaluation"),
497497
],
498498
code="./local/preprocess.py",
499-
job_arguments=["--input-data", "s3://my-input"],
499+
arguments=["--input-data", "s3://my-input"],
500500
)
501501
502502
hyperparam_report = PropertyFile(
@@ -577,7 +577,7 @@ There are eight types of condition are supported, they are:
577577
ProcessingOutput(output_name="hyperparam", source="/opt/ml/processing/evaluation"),
578578
],
579579
code="./local/preprocess.py",
580-
job_arguments=["--input-data", "s3://my-input"],
580+
arguments=["--input-data", "s3://my-input"],
581581
)
582582
583583
eval_report = PropertyFile(
@@ -668,7 +668,7 @@ Use :class:`sagemaker.workflow.functions.JsonGet` to extract a Json property fro
668668
ProcessingOutput(output_name="hyperparam", source="/opt/ml/processing/evaluation"),
669669
],
670670
code="./local/preprocess.py",
671-
job_arguments=["--input-data", "s3://my-input"],
671+
arguments=["--input-data", "s3://my-input"],
672672
)
673673
674674
hyperparam_report = PropertyFile(

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
@@ -501,13 +501,14 @@ def _upload_code(self, key_prefix: str, repack: bool = False) -> None:
501501
if is_pipeline_variable(self.model_data):
502502
# model is not yet there, defer repacking to later during pipeline execution
503503
if not isinstance(self.sagemaker_session, PipelineSession):
504-
# TODO: link the doc in the warning once ready
505504
logging.warning(
506505
"The model_data is a Pipeline variable of type %s, "
507506
"which should be used under `PipelineSession` and "
508507
"leverage `ModelStep` to create or register model. "
509508
"Otherwise some functionalities e.g. "
510-
"runtime repack may be missing",
509+
"runtime repack may be missing. For more, see: "
510+
"https://sagemaker.readthedocs.io/en/stable/"
511+
"amazon_sagemaker_model_building_pipeline.html#model-step",
511512
type(self.model_data),
512513
)
513514
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.
@@ -335,6 +338,7 @@ def register(
335338
container_def_list=container_def,
336339
drift_check_baselines=drift_check_baselines,
337340
customer_metadata_properties=customer_metadata_properties,
341+
domain=domain,
338342
)
339343

340344
self.sagemaker_session.create_model_package_from_containers(**model_pkg_args)

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/model_step.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def __init__(
111111
The display name provides better UI readability. (default: None).
112112
description (str): The description of the `ModelStep` (default: None).
113113
"""
114-
# TODO: add a doc link in error message once ready
115114
from sagemaker.workflow.utilities import validate_step_args_input
116115

117116
validate_step_args_input(
@@ -121,7 +120,8 @@ def __init__(
121120
Session.create_model_package_from_containers.__name__,
122121
},
123122
error_message="The step_args of ModelStep must be obtained from model.create() "
124-
"or model.register().",
123+
"or model.register(). For more, see: https://sagemaker.readthedocs.io/en/stable/"
124+
"amazon_sagemaker_model_building_pipeline.html#model-step",
125125
)
126126
if not (step_args.create_model_request is None) ^ (
127127
step_args.create_model_package_request is None

src/sagemaker/workflow/step_collections.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,13 @@ def __init__(
253253
steps.append(register_model_step)
254254
self.steps = steps
255255

256-
# TODO: add public document link here once ready
257256
warnings.warn(
258257
(
259258
"We are deprecating the use of RegisterModel. "
260259
"Instead, please use the ModelStep, which simply takes in the step arguments "
261-
"generated by model.register()."
260+
"generated by model.register(). For more, see: "
261+
"https://sagemaker.readthedocs.io/en/stable/"
262+
"amazon_sagemaker_model_building_pipeline.html#model-step"
262263
),
263264
DeprecationWarning,
264265
)

src/sagemaker/workflow/steps.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,13 @@ def __init__(
444444

445445
self._properties = Properties(path=f"Steps.{name}", shape_name="DescribeModelOutput")
446446

447-
# TODO: add public document link here once ready
448447
warnings.warn(
449448
(
450449
"We are deprecating the use of CreateModelStep. "
451450
"Instead, please use the ModelStep, which simply takes in the step arguments "
452-
"generated by model.create()."
451+
"generated by model.create(). For more, see: "
452+
"https://sagemaker.readthedocs.io/en/stable/"
453+
"amazon_sagemaker_model_building_pipeline.html#model-step"
453454
),
454455
DeprecationWarning,
455456
)

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ def mxnet_inference_py_version(mxnet_inference_version, request):
181181
return request.param
182182
elif Version(mxnet_inference_version) == Version("1.8.0"):
183183
return "py37"
184+
elif Version(mxnet_inference_version) == Version("1.9.0"):
185+
return "py38"
184186
else:
185187
return "py3"
186188

@@ -191,6 +193,8 @@ def mxnet_training_py_version(mxnet_training_version, request):
191193
return request.param
192194
elif Version(mxnet_training_version) == Version("1.8.0"):
193195
return "py37"
196+
elif Version(mxnet_training_version) == Version("1.9.0"):
197+
return "py38"
194198
else:
195199
return "py3"
196200

tests/integ/sagemaker/workflow/test_model_steps.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ def test_model_registration_with_tensorflow_model_with_pipeline_model(
608608
)
609609
inputs = TrainingInput(s3_data=input_path)
610610
instance_count = ParameterInteger(name="InstanceCount", default_value=1)
611+
output_path = ParameterString(
612+
name="OutputPath", default_value=f"s3://{pipeline_session.default_bucket()}"
613+
)
611614

612615
# If image_uri is not provided, the instance_type should not be a pipeline variable
613616
# since instance_type is used to retrieve image_uri in compile time (PySDK)
@@ -619,6 +622,7 @@ def test_model_registration_with_tensorflow_model_with_pipeline_model(
619622
framework_version=tf_full_version,
620623
py_version=tf_full_py_version,
621624
sagemaker_session=pipeline_session,
625+
output_path=output_path,
622626
)
623627
train_step_args = tensorflow_estimator.fit(inputs=inputs)
624628
step_train = TrainingStep(
@@ -648,7 +652,7 @@ def test_model_registration_with_tensorflow_model_with_pipeline_model(
648652
)
649653
pipeline = Pipeline(
650654
name=pipeline_name,
651-
parameters=[instance_count],
655+
parameters=[instance_count, output_path],
652656
steps=[step_train, step_register_model],
653657
sagemaker_session=pipeline_session,
654658
)

tests/unit/sagemaker/workflow/test_training_step.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import os
1616
import json
1717
from mock import Mock, PropertyMock
18+
import re
1819

1920
import pytest
2021
import warnings

tests/unit/sagemaker/workflow/test_transform_step.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ def test_transform_step_with_transformer(pipeline_session):
8989
output_path=f"s3://{pipeline_session.default_bucket()}/Transform",
9090
sagemaker_session=pipeline_session,
9191
)
92-
93-
transform_inputs = TransformInput(
94-
data=f"s3://{pipeline_session.default_bucket()}/batch-data",
92+
data = ParameterString(
93+
name="Data", default_value=f"s3://{pipeline_session.default_bucket()}/batch-data"
9594
)
95+
transform_inputs = TransformInput(data=data)
9696

9797
with warnings.catch_warnings(record=True) as w:
9898
step_args = transformer.transform(
@@ -120,10 +120,11 @@ def test_transform_step_with_transformer(pipeline_session):
120120
pipeline = Pipeline(
121121
name="MyPipeline",
122122
steps=[step],
123-
parameters=[model_name],
123+
parameters=[model_name, data],
124124
sagemaker_session=pipeline_session,
125125
)
126126
step_args.args["ModelName"] = model_name.expr
127+
step_args.args["TransformInput"]["DataSource"]["S3DataSource"]["S3Uri"] = data.expr
127128
assert json.loads(pipeline.definition())["Steps"][0] == {
128129
"Name": "MyTransformStep",
129130
"Type": "Transform",

tests/unit/test_mxnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ def test_model_prepare_container_def_no_instance_type_or_image(
747747

748748

749749
def test_attach(sagemaker_session, mxnet_training_version, mxnet_training_py_version):
750-
if mxnet_training_py_version == "py37":
750+
if mxnet_training_py_version in ["py37", "py38"]:
751751
training_image = "1.dkr.ecr.us-west-2.amazonaws.com/mxnet-training:{1}-cpu-{0}".format(
752752
mxnet_training_py_version, mxnet_training_version
753753
)

0 commit comments

Comments
 (0)