Skip to content

Commit 5d5e180

Browse files
Merge branch 'master' into dependabot/pip/requirements/extras/transformers-4.36.0
2 parents 246a986 + 71a4c58 commit 5d5e180

File tree

105 files changed

+1349
-585
lines changed

Some content is hidden

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

105 files changed

+1349
-585
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
1212

1313
**To reproduce**
1414
A clear, step-by-step set of instructions to reproduce the bug.
15+
The provided code need to be **complete** and **runnable**, if additional data is needed, please include them in the issue.
1516

1617
**Expected behavior**
1718
A clear and concise description of what you expected to happen.

CHANGELOG.md

+37
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
# Changelog
22

3+
## v2.203.0 (2023-12-28)
4+
5+
### Features
6+
7+
* support local mode in SageMaker Studio (#1300)
8+
* Supporting tbac in load_run
9+
10+
### Bug Fixes and Other Changes
11+
12+
* update image_uri_configs 12-25-2023 06:17:33 PST
13+
* Disable failed test in IR
14+
* Raise Exception for debug
15+
* create role if needed in `get_execution_role`
16+
17+
## v2.202.1 (2023-12-22)
18+
19+
### Bug Fixes and Other Changes
20+
21+
* update image_uri_configs 12-22-2023 06:17:35 PST
22+
* update model path in local mode
23+
* Using logging instead of prints
24+
25+
### Documentation Changes
26+
27+
* update issue template.
28+
29+
## v2.202.0 (2023-12-21)
30+
31+
### Features
32+
33+
* support remote debug for sagemaker training job
34+
35+
### Bug Fixes and Other Changes
36+
37+
* update image_uri_configs 12-21-2023 08:32:41 PST
38+
* Update tblib constraint
39+
340
## v2.201.0 (2023-12-20)
441

542
### Features

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.201.1.dev0
1+
2.203.1.dev0

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@ test=pytest
1010
[metadata]
1111
description_file = README.rst
1212
license_files = LICENSE.txt
13-
14-
[wheel]
15-
universal = 1

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def read_requirements(filename):
6363
"PyYAML~=6.0",
6464
"jsonschema",
6565
"platformdirs",
66-
"tblib==1.7.0",
66+
"tblib>=1.7.0,<3",
6767
"urllib3<1.27",
6868
"uvicorn==0.22.0",
6969
"fastapi==0.95.2",

src/sagemaker/algorithm.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from sagemaker.session import Session
2929
from sagemaker.workflow.entities import PipelineVariable
3030
from sagemaker.workflow.pipeline_context import runnable_by_pipeline
31+
from sagemaker.utils import format_tags, Tags
3132

3233
from sagemaker.workflow import is_pipeline_variable
3334

@@ -58,7 +59,7 @@ def __init__(
5859
base_job_name: Optional[str] = None,
5960
sagemaker_session: Optional[Session] = None,
6061
hyperparameters: Optional[Dict[str, Union[str, PipelineVariable]]] = None,
61-
tags: Optional[List[Dict[str, Union[str, PipelineVariable]]]] = None,
62+
tags: Optional[Tags] = None,
6263
subnets: Optional[List[Union[str, PipelineVariable]]] = None,
6364
security_group_ids: Optional[List[Union[str, PipelineVariable]]] = None,
6465
model_uri: Optional[str] = None,
@@ -121,7 +122,7 @@ def __init__(
121122
interactions with Amazon SageMaker APIs and any other AWS services needed. If
122123
not specified, the estimator creates one using the default
123124
AWS configuration chain.
124-
tags (list[dict[str, str] or list[dict[str, PipelineVariable]]): List of tags for
125+
tags (Union[Tags]): Tags for
125126
labeling a training job. For more, see
126127
https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
127128
subnets (list[str] or list[PipelineVariable]): List of subnet ids. If not specified
@@ -170,7 +171,7 @@ def __init__(
170171
output_kms_key=output_kms_key,
171172
base_job_name=base_job_name,
172173
sagemaker_session=sagemaker_session,
173-
tags=tags,
174+
tags=format_tags(tags),
174175
subnets=subnets,
175176
security_group_ids=security_group_ids,
176177
model_uri=model_uri,
@@ -391,7 +392,7 @@ def transformer(
391392
if self._is_marketplace():
392393
transform_env = None
393394

394-
tags = tags or self.tags
395+
tags = format_tags(tags) or self.tags
395396
else:
396397
raise RuntimeError("No finished training job found associated with this estimator")
397398

src/sagemaker/apiutils/_base_types.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from __future__ import absolute_import
1515

1616
from sagemaker.apiutils import _boto_functions, _utils
17+
from sagemaker.utils import format_tags
1718

1819

1920
class ApiObject(object):
@@ -194,13 +195,13 @@ def _set_tags(self, resource_arn=None, tags=None):
194195
195196
Args:
196197
resource_arn (str): The arn of the Record
197-
tags (dict): An array of Tag objects that set to Record
198+
tags (Optional[Tags]): An array of Tag objects that set to Record
198199
199200
Returns:
200201
A list of key, value pair objects. i.e. [{"key":"value"}]
201202
"""
202203
tag_list = self.sagemaker_session.sagemaker_client.add_tags(
203-
ResourceArn=resource_arn, Tags=tags
204+
ResourceArn=resource_arn, Tags=format_tags(tags)
204205
)["Tags"]
205206
return tag_list
206207

src/sagemaker/automl/automl.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
)
2929
from sagemaker.job import _Job
3030
from sagemaker.session import Session
31-
from sagemaker.utils import name_from_base, resolve_value_from_config
31+
from sagemaker.utils import name_from_base, resolve_value_from_config, format_tags, Tags
3232
from sagemaker.workflow.entities import PipelineVariable
3333
from sagemaker.workflow.pipeline_context import runnable_by_pipeline
3434

@@ -127,7 +127,7 @@ def __init__(
127127
total_job_runtime_in_seconds: Optional[int] = None,
128128
job_objective: Optional[Dict[str, str]] = None,
129129
generate_candidate_definitions_only: Optional[bool] = False,
130-
tags: Optional[List[Dict[str, str]]] = None,
130+
tags: Optional[Tags] = None,
131131
content_type: Optional[str] = None,
132132
s3_data_type: Optional[str] = None,
133133
feature_specification_s3_uri: Optional[str] = None,
@@ -167,8 +167,7 @@ def __init__(
167167
In the format of: {"MetricName": str}
168168
generate_candidate_definitions_only (bool): Whether to generates
169169
possible candidates without training the models.
170-
tags (List[dict[str, str]]): The list of tags to attach to this
171-
specific endpoint.
170+
tags (Optional[Tags]): Tags to attach to this specific endpoint.
172171
content_type (str): The content type of the data from the input source.
173172
s3_data_type (str): The data type for S3 data source.
174173
Valid values: ManifestFile or S3Prefix.
@@ -203,7 +202,7 @@ def __init__(
203202
self.target_attribute_name = target_attribute_name
204203
self.job_objective = job_objective
205204
self.generate_candidate_definitions_only = generate_candidate_definitions_only
206-
self.tags = tags
205+
self.tags = format_tags(tags)
207206
self.content_type = content_type
208207
self.s3_data_type = s3_data_type
209208
self.feature_specification_s3_uri = feature_specification_s3_uri
@@ -332,7 +331,7 @@ def attach(cls, auto_ml_job_name, sagemaker_session=None):
332331
total_job_runtime_in_seconds=auto_ml_job_desc.get("AutoMLJobConfig", {})
333332
.get("CompletionCriteria", {})
334333
.get("MaxAutoMLJobRuntimeInSeconds"),
335-
job_objective=auto_ml_job_desc.get("AutoMLJobObjective", {}).get("MetricName"),
334+
job_objective=auto_ml_job_desc.get("AutoMLJobObjective", {}),
336335
generate_candidate_definitions_only=auto_ml_job_desc.get(
337336
"GenerateCandidateDefinitionsOnly", False
338337
),
@@ -581,7 +580,7 @@ def deploy(
581580
be selected on each ``deploy``.
582581
endpoint_name (str): The name of the endpoint to create (default:
583582
None). If not specified, a unique endpoint name will be created.
584-
tags (List[dict[str, str]]): The list of tags to attach to this
583+
tags (Optional[Tags]): The list of tags to attach to this
585584
specific endpoint.
586585
wait (bool): Whether the call should wait until the deployment of
587586
model completes (default: True).
@@ -633,7 +632,7 @@ def deploy(
633632
deserializer=deserializer,
634633
endpoint_name=endpoint_name,
635634
kms_key=model_kms_key,
636-
tags=tags,
635+
tags=format_tags(tags),
637636
wait=wait,
638637
volume_size=volume_size,
639638
model_data_download_timeout=model_data_download_timeout,

src/sagemaker/base_predictor.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
NumpySerializer,
5454
)
5555
from sagemaker.session import production_variant, Session
56-
from sagemaker.utils import name_from_base, stringify_object
56+
from sagemaker.utils import name_from_base, stringify_object, format_tags
5757

5858
from sagemaker.model_monitor.model_monitoring import DEFAULT_REPOSITORY_NAME
5959

@@ -63,6 +63,9 @@
6363
LOGGER = logging.getLogger("sagemaker")
6464

6565

66+
logger = logging.getLogger(__name__)
67+
68+
6669
class PredictorBase(abc.ABC):
6770
"""An object that encapsulates a deployed model."""
6871

@@ -406,7 +409,7 @@ def update_endpoint(
406409
self.sagemaker_session.create_endpoint_config_from_existing(
407410
current_endpoint_config_name,
408411
new_endpoint_config_name,
409-
new_tags=tags,
412+
new_tags=format_tags(tags),
410413
new_kms_key=kms_key,
411414
new_data_capture_config_dict=data_capture_config_dict,
412415
new_production_variants=production_variants,
@@ -714,7 +717,7 @@ def list_monitors(self):
714717
endpoint_name=self.endpoint_name
715718
)
716719
if len(monitoring_schedules_dict["MonitoringScheduleSummaries"]) == 0:
717-
print("No monitors found for endpoint. endpoint: {}".format(self.endpoint_name))
720+
logger.debug("No monitors found for endpoint. endpoint: %s", self.endpoint_name)
718721
return []
719722

720723
monitors = []

src/sagemaker/clarify.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from sagemaker.session import Session
3434
from sagemaker.network import NetworkConfig
3535
from sagemaker.processing import ProcessingInput, ProcessingOutput, Processor
36+
from sagemaker.utils import format_tags, Tags
3637

3738
logger = logging.getLogger(__name__)
3839

@@ -1417,7 +1418,7 @@ def __init__(
14171418
max_runtime_in_seconds: Optional[int] = None,
14181419
sagemaker_session: Optional[Session] = None,
14191420
env: Optional[Dict[str, str]] = None,
1420-
tags: Optional[List[Dict[str, str]]] = None,
1421+
tags: Optional[Tags] = None,
14211422
network_config: Optional[NetworkConfig] = None,
14221423
job_name_prefix: Optional[str] = None,
14231424
version: Optional[str] = None,
@@ -1454,7 +1455,7 @@ def __init__(
14541455
using the default AWS configuration chain.
14551456
env (dict[str, str]): Environment variables to be passed to
14561457
the processing jobs (default: None).
1457-
tags (list[dict]): List of tags to be passed to the processing job
1458+
tags (Optional[Tags]): Tags to be passed to the processing job
14581459
(default: None). For more, see
14591460
https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
14601461
network_config (:class:`~sagemaker.network.NetworkConfig`):
@@ -1482,7 +1483,7 @@ def __init__(
14821483
None, # We set method-specific job names below.
14831484
sagemaker_session,
14841485
env,
1485-
tags,
1486+
format_tags(tags),
14861487
network_config,
14871488
)
14881489

src/sagemaker/cli/compatibility/v2/files.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
from sagemaker.cli.compatibility.v2.ast_transformer import ASTTransformer
2424

25-
LOGGER = logging.getLogger(__name__)
25+
# Setting LOGGER for backward compatibility, in case users import this...
26+
logger = LOGGER = logging.getLogger(__name__)
2627

2728

2829
class FileUpdater(object):
@@ -59,7 +60,7 @@ def _make_output_dirs_if_needed(self):
5960
os.makedirs(output_dir)
6061

6162
if os.path.exists(self.output_path):
62-
LOGGER.warning("Overwriting file %s", self.output_path)
63+
logger.warning("Overwriting file %s", self.output_path)
6364

6465

6566
class PyFileUpdater(FileUpdater):

src/sagemaker/djl_inference/model.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from sagemaker.s3_utils import s3_path_join
3131
from sagemaker.serializers import JSONSerializer, BaseSerializer
3232
from sagemaker.session import Session
33-
from sagemaker.utils import _tmpdir, _create_or_update_code_dir
33+
from sagemaker.utils import _tmpdir, _create_or_update_code_dir, format_tags
3434
from sagemaker.workflow.entities import PipelineVariable
3535
from sagemaker.estimator import Estimator
3636
from sagemaker.s3 import S3Uploader
@@ -610,7 +610,7 @@ def deploy(
610610
default deserializer is set by the ``predictor_cls``.
611611
endpoint_name (str): The name of the endpoint to create (default:
612612
None). If not specified, a unique endpoint name will be created.
613-
tags (List[dict[str, str]]): The list of tags to attach to this
613+
tags (Optional[Tags]): The list of tags to attach to this
614614
specific endpoint.
615615
kms_key (str): The ARN of the KMS key that is used to encrypt the
616616
data on the storage volume attached to the instance hosting the
@@ -651,7 +651,7 @@ def deploy(
651651
serializer=serializer,
652652
deserializer=deserializer,
653653
endpoint_name=endpoint_name,
654-
tags=tags,
654+
tags=format_tags(tags),
655655
kms_key=kms_key,
656656
wait=wait,
657657
data_capture_config=data_capture_config,

0 commit comments

Comments
 (0)