Skip to content

Commit 82db05c

Browse files
authored
Merge branch 'master' into clarify-headers
2 parents 9f04b85 + dd76ad7 commit 82db05c

File tree

10 files changed

+66
-10
lines changed

10 files changed

+66
-10
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## v2.46.0 (2021-06-15)
4+
5+
### Features
6+
7+
* Add HF transformer version 4.6.1
8+
9+
### Bug Fixes and Other Changes
10+
11+
* encode localmode payload to UTF-8
12+
* call DescribeDomain as fallback in get_execution_role
13+
* parameterize PT and TF version for HuggingFace tests
14+
15+
### Documentation Changes
16+
17+
* Add import statement in Batch Transform Overview doc
18+
319
## v2.45.0 (2021-06-07)
420

521
### Features

VERSION

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

src/sagemaker/huggingface/estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(
6666
must point to a file located at the root of ``source_dir``.
6767
transformers_version (str): Transformers version you want to use for
6868
executing your model training code. Defaults to ``None``. Required unless
69-
``image_uri`` is provided. The current supported version is ``4.4.2``.
69+
``image_uri`` is provided. The current supported version is ``4.6.1``.
7070
tensorflow_version (str): TensorFlow version you want to use for
7171
executing your model training code. Defaults to ``None``. Required unless
7272
``pytorch_version`` is provided. The current supported version is ``1.6.0``.

src/sagemaker/inputs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def __init__(
7070
a local directory.
7171
* 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via
7272
a Unix-named pipe.
73+
* 'FastFile' - Amazon SageMaker streams data from S3 on demand instead of
74+
downloading the entire dataset before training begins.
7375
7476
attribute_names (list[str]): A list of one or more attribute names to use that are
7577
found in a specified AugmentedManifestFile.

src/sagemaker/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def _get_model_package_args(
195195
marketplace_cert=False,
196196
approval_status=None,
197197
description=None,
198+
tags=None,
198199
):
199200
"""Get arguments for session.create_model_package method.
200201
@@ -250,6 +251,8 @@ def _get_model_package_args(
250251
model_package_args["approval_status"] = approval_status
251252
if description is not None:
252253
model_package_args["description"] = description
254+
if tags is not None:
255+
model_package_args["tags"] = tags
253256
return model_package_args
254257

255258
def _init_sagemaker_session_if_does_not_exist(self, instance_type):

src/sagemaker/session.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ def train( # noqa: C901
467467
a directory in the Docker container.
468468
* 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via a
469469
Unix-named pipe.
470+
* 'FastFile' - Amazon SageMaker streams data from S3 on demand instead of
471+
downloading the entire dataset before training begins.
470472
input_config (list): A list of Channel objects. Each channel is a named input source.
471473
Please refer to the format details described:
472474
https://botocore.readthedocs.io/en/latest/reference/services/sagemaker.html#SageMaker.Client.create_training_job
@@ -609,6 +611,8 @@ def _get_train_request( # noqa: C901
609611
a directory in the Docker container.
610612
* 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via a
611613
Unix-named pipe.
614+
* 'FastFile' - Amazon SageMaker streams data from S3 on demand instead of
615+
downloading the entire dataset before training begins.
612616
input_config (list): A list of Channel objects. Each channel is a named input source.
613617
Please refer to the format details described:
614618
https://botocore.readthedocs.io/en/latest/reference/services/sagemaker.html#SageMaker.Client.create_training_job
@@ -1897,6 +1901,8 @@ def tune( # noqa: C901
18971901
a directory in the Docker container.
18981902
* 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via a
18991903
Unix-named pipe.
1904+
* 'FastFile' - Amazon SageMaker streams data from S3 on demand instead of
1905+
downloading the entire dataset before training begins.
19001906
metric_definitions (list[dict]): A list of dictionaries that defines the metric(s)
19011907
used to evaluate the training jobs. Each dictionary contains two keys: 'Name' for
19021908
the name of the metric, and 'Regex' for the regular expression used to extract the
@@ -2180,6 +2186,8 @@ def _map_training_config(
21802186
a directory in the Docker container.
21812187
* 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via a
21822188
Unix-named pipe.
2189+
* 'FastFile' - Amazon SageMaker streams data from S3 on demand instead of
2190+
downloading the entire dataset before training begins.
21832191
role (str): An AWS IAM role (either name or full ARN). The Amazon SageMaker training
21842192
jobs and APIs that create Amazon SageMaker endpoints use this role to access
21852193
training data and model artifacts. You must grant sufficient permissions to
@@ -2716,6 +2724,7 @@ def _get_create_model_package_request(
27162724
marketplace_cert=False,
27172725
approval_status="PendingManualApproval",
27182726
description=None,
2727+
tags=None,
27192728
):
27202729
"""Get request dictionary for CreateModelPackage API.
27212730
@@ -2753,6 +2762,8 @@ def _get_create_model_package_request(
27532762
request_dict["ModelPackageGroupName"] = model_package_group_name
27542763
if description is not None:
27552764
request_dict["ModelPackageDescription"] = description
2765+
if tags is not None:
2766+
request_dict["Tags"] = tags
27562767
if model_metrics:
27572768
request_dict["ModelMetrics"] = model_metrics
27582769
if metadata_properties:

src/sagemaker/workflow/_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def __init__(
225225
compile_model_family=None,
226226
description=None,
227227
depends_on: List[str] = None,
228+
tags=None,
228229
**kwargs,
229230
):
230231
"""Constructor of a register model step.
@@ -264,6 +265,7 @@ def __init__(
264265
self.inference_instances = inference_instances
265266
self.transform_instances = transform_instances
266267
self.model_package_group_name = model_package_group_name
268+
self.tags = tags
267269
self.model_metrics = model_metrics
268270
self.metadata_properties = metadata_properties
269271
self.approval_status = approval_status
@@ -324,10 +326,12 @@ def arguments(self) -> RequestType:
324326
metadata_properties=self.metadata_properties,
325327
approval_status=self.approval_status,
326328
description=self.description,
329+
tags=self.tags,
327330
)
328331
request_dict = model.sagemaker_session._get_create_model_package_request(
329332
**model_package_args
330333
)
334+
331335
# these are not available in the workflow service and will cause rejection
332336
if "CertifyForMarketplace" in request_dict:
333337
request_dict.pop("CertifyForMarketplace")

src/sagemaker/workflow/step_collections.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(
6767
image_uri=None,
6868
compile_model_family=None,
6969
description=None,
70+
tags=None,
7071
**kwargs,
7172
):
7273
"""Construct steps `_RepackModelStep` and `_RegisterModelStep` based on the estimator.
@@ -94,6 +95,10 @@ def __init__(
9495
compile_model_family (str): The instance family for the compiled model. If
9596
specified, a compiled model is used (default: None).
9697
description (str): Model Package description (default: None).
98+
tags (List[dict[str, str]]): The list of tags to attach to the model package group. Note
99+
that tags will only be applied to newly created model package groups; if the
100+
name of an existing group is passed to "model_package_group_name",
101+
tags will not be applied.
97102
**kwargs: additional arguments to `create_model`.
98103
"""
99104
steps: List[Step] = []
@@ -134,6 +139,7 @@ def __init__(
134139
image_uri=image_uri,
135140
compile_model_family=compile_model_family,
136141
description=description,
142+
tags=tags,
137143
**kwargs,
138144
)
139145
if not repack_model:

src/sagemaker/workflow/steps.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@
1616
import abc
1717

1818
from enum import Enum
19-
from typing import Dict, List
19+
from typing import Dict, List, Union
2020

2121
import attr
2222

2323
from sagemaker.estimator import EstimatorBase, _TrainingJob
24-
from sagemaker.inputs import (
25-
CreateModelInput,
26-
TrainingInput,
27-
TransformInput,
28-
)
24+
from sagemaker.inputs import CreateModelInput, TrainingInput, TransformInput, FileSystemInput
2925
from sagemaker.model import Model
3026
from sagemaker.processing import (
3127
ProcessingInput,
@@ -145,7 +141,7 @@ def __init__(
145141
self,
146142
name: str,
147143
estimator: EstimatorBase,
148-
inputs: TrainingInput = None,
144+
inputs: Union[TrainingInput, dict, str, FileSystemInput] = None,
149145
cache_config: CacheConfig = None,
150146
depends_on: List[str] = None,
151147
):
@@ -157,7 +153,23 @@ def __init__(
157153
Args:
158154
name (str): The name of the training step.
159155
estimator (EstimatorBase): A `sagemaker.estimator.EstimatorBase` instance.
160-
inputs (TrainingInput): A `sagemaker.inputs.TrainingInput` instance. Defaults to `None`.
156+
inputs (str or dict or sagemaker.inputs.TrainingInput
157+
or sagemaker.inputs.FileSystemInput): Information
158+
about the training data. This can be one of three types:
159+
160+
* (str) the S3 location where training data is saved, or a file:// path in
161+
local mode.
162+
* (dict[str, str] or dict[str, sagemaker.inputs.TrainingInput]) If using multiple
163+
channels for training data, you can specify a dict mapping channel names to
164+
strings or :func:`~sagemaker.inputs.TrainingInput` objects.
165+
* (sagemaker.inputs.TrainingInput) - channel configuration for S3 data sources
166+
that can provide additional information as well as the path to the training
167+
dataset.
168+
See :func:`sagemaker.inputs.TrainingInput` for full details.
169+
* (sagemaker.inputs.FileSystemInput) - channel configuration for
170+
a file system data source that can provide additional information as well as
171+
the path to the training dataset.
172+
161173
cache_config (CacheConfig): A `sagemaker.workflow.steps.CacheConfig` instance.
162174
depends_on (List[str]): A list of step names this `sagemaker.workflow.steps.TrainingStep`
163175
depends on

tests/unit/sagemaker/workflow/test_step_collections.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def test_register_model(estimator, model_metrics):
182182
approval_status="Approved",
183183
description="description",
184184
depends_on=["TestStep"],
185+
tags=[{"Key": "myKey", "Value": "myValue"}],
185186
)
186187
assert ordered(register_model.request_dicts()) == ordered(
187188
[
@@ -210,6 +211,7 @@ def test_register_model(estimator, model_metrics):
210211
},
211212
"ModelPackageDescription": "description",
212213
"ModelPackageGroupName": "mpg",
214+
"Tags": [{"Key": "myKey", "Value": "myValue"}],
213215
},
214216
},
215217
]

0 commit comments

Comments
 (0)