Skip to content

Commit 14a6b87

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # tests/data/serve_resources/mlflow/pytorch/requirements.txt # tests/data/serve_resources/mlflow/xgboost/requirements.txt
2 parents 7b18f45 + 75efdef commit 14a6b87

File tree

139 files changed

+7645
-1664
lines changed

Some content is hidden

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

139 files changed

+7645
-1664
lines changed

.github/workflows/codebuild-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Run Codestyle & Doc Tests
5656
uses: aws-actions/aws-codebuild-run-build@v1
5757
with:
58-
project-name: sagemaker-python-sdk-ci-codestyle-doc-tests
58+
project-name: ${{ github.event.repository.name }}-ci-codestyle-doc-tests
5959
source-version-override: 'refs/pull/${{ github.event.pull_request.number }}/head^{${{ github.event.pull_request.head.sha }}}'
6060
unit-tests:
6161
runs-on: ubuntu-latest
@@ -74,7 +74,7 @@ jobs:
7474
- name: Run Unit Tests
7575
uses: aws-actions/aws-codebuild-run-build@v1
7676
with:
77-
project-name: sagemaker-python-sdk-ci-unit-tests
77+
project-name: ${{ github.event.repository.name }}-ci-unit-tests
7878
source-version-override: 'refs/pull/${{ github.event.pull_request.number }}/head^{${{ github.event.pull_request.head.sha }}}'
7979
env-vars-for-codebuild: |
8080
PY_VERSION
@@ -93,5 +93,5 @@ jobs:
9393
- name: Run Integ Tests
9494
uses: aws-actions/aws-codebuild-run-build@v1
9595
with:
96-
project-name: sagemaker-python-sdk-ci-integ-tests
96+
project-name: ${{ github.event.repository.name }}-ci-integ-tests
9797
source-version-override: 'refs/pull/${{ github.event.pull_request.number }}/head^{${{ github.event.pull_request.head.sha }}}'

CHANGELOG.md

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

3+
## v2.222.1 (2024-06-12)
4+
5+
### Bug Fixes and Other Changes
6+
7+
* First changes
8+
* estimator.deploy not respecting instance type
9+
10+
## v2.222.0 (2024-06-07)
11+
12+
### Features
13+
14+
* jumpstart telemetry
15+
16+
### Bug Fixes and Other Changes
17+
18+
* update image_uri_configs 06-06-2024 07:17:31 PST
19+
* bump requests from 2.31.0 to 2.32.2 in /requirements/extras
20+
* chore: add HF LLM neuronx 0.0.23 image
21+
* Updates for DJL 0.28.0 release
22+
* chore(deps): bump mlflow from 2.11.1 to 2.12.1 in /tests/data/serve_resources/mlflow/tensorflow
23+
* chore(deps): bump mlflow from 2.11.1 to 2.12.1 in /tests/data/serve_resources/mlflow/xgboost
24+
* chore(deps): bump mlflow from 2.10.2 to 2.12.1 in /tests/data/serve_resources/mlflow/pytorch
25+
* chore(deps): bump apache-airflow from 2.9.0 to 2.9.1 in /requirements/extras
26+
* chore(deps): bump requests from 2.31.0 to 2.32.2 in /tests/data/serve_resources/mlflow/pytorch
27+
* Fix ci unit-tests
28+
* Making project name in workflow files dynamic
29+
* update image_uri_configs 05-29-2024 07:17:35 PST
30+
* Update: SM Endpoint Routing Strategy Support.
31+
32+
## v2.221.1 (2024-05-22)
33+
34+
### Bug Fixes and Other Changes
35+
36+
* Convert pytorchddp distribution to smdistributed distribution
37+
* Add tei cpu image
38+
39+
## v2.221.0 (2024-05-20)
40+
41+
### Features
42+
43+
* onboard tei image config to pysdk
44+
45+
### Bug Fixes and Other Changes
46+
47+
* JS Model with non-TGI/non-DJL deployment failure
48+
* cover tei with image_uris.retrieve API
49+
* Add more debuging
50+
* model builder limited container support for endpoint mode.
51+
* Image URI should take precedence for HF models
52+
53+
## v2.220.0 (2024-05-15)
54+
55+
### Features
56+
57+
* AutoGluon 1.1.0 image_uris update
58+
* add new images for HF TGI release
59+
* Add telemetry support for mlflow models
60+
61+
### Bug Fixes and Other Changes
62+
63+
* add debug logs to workflow container dist creation
64+
* model builder race condition on sagemaker session
65+
* Add tensorflow_serving support for mlflow models and enable lineage tracking for mlflow models
66+
* update image_uri_configs 05-09-2024 07:17:41 PST
67+
* skip flakey tests pending investigation
68+
69+
## v2.219.0 (2024-05-08)
70+
71+
### Features
72+
73+
* allow choosing js payload by alias in private method
74+
75+
### Bug Fixes and Other Changes
76+
77+
* chore(deps): bump jinja2 from 3.1.3 to 3.1.4 in /requirements/extras
78+
* chore(deps): bump tqdm from 4.66.2 to 4.66.3 in /tests/data/serve_resources/mlflow/pytorch
79+
* chore(deps): bump jinja2 from 3.1.3 to 3.1.4 in /doc
80+
* Updates for SMP v2.3.1
81+
82+
## v2.218.1 (2024-05-03)
83+
84+
### Bug Fixes and Other Changes
85+
86+
* Fix UserAgent logging in Python SDK
87+
* chore: release tgi 2.0.1
88+
* chore: update skipped flaky tests
89+
90+
## v2.218.0 (2024-05-01)
91+
92+
### Features
93+
94+
* set default allow_pickle param to False
95+
96+
### Bug Fixes and Other Changes
97+
98+
* properly close files in lineage queries and tests
99+
100+
## v2.217.0 (2024-04-24)
101+
102+
### Features
103+
104+
* support session tag chaining for training job
105+
106+
### Bug Fixes and Other Changes
107+
108+
* Add Triton v24.03 URI
109+
* mainline alt config parsing
110+
* Fix tox installs
111+
* Add PT 2.2 Graviton Inference DLC
112+
3113
## v2.216.1 (2024-04-22)
4114

5115
### Bug Fixes and Other Changes

README.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ SageMaker Python SDK is tested on:
9595
- Python 3.10
9696
- Python 3.11
9797

98+
Telemetry
99+
~~~~~~~~~~~~~~~
100+
101+
The ``sagemaker`` library has telemetry enabled to help us better understand user needs, diagnose issues, and deliver new features. This telemetry tracks the usage of various SageMaker functions.
102+
103+
If you prefer to opt out of telemetry, you can easily do so by setting the ``TelemetryOptOut`` parameter to ``true`` in the SDK defaults configuration. For detailed instructions, please visit `Configuring and using defaults with the SageMaker Python SDK <https://sagemaker.readthedocs.io/en/stable/overview.html#configuring-and-using-defaults-with-the-sagemaker-python-sdk>`__.
104+
98105
AWS Permissions
99106
~~~~~~~~~~~~~~~
100107

VERSION

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

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ sphinx==5.1.1
22
sphinx-rtd-theme==0.5.0
33
docutils==0.15.2
44
packaging==20.9
5-
jinja2==3.1.3
5+
jinja2==3.1.4
66
schema==0.7.5
77
accelerate>=0.24.1,<=0.27.0

requirements/extras/test_requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ awslogs==0.14.0
1212
black==24.3.0
1313
stopit==1.1.2
1414
# Update tox.ini to have correct version of airflow constraints file
15-
apache-airflow==2.9.0
15+
apache-airflow==2.9.1
1616
apache-airflow-providers-amazon==7.2.1
1717
attrs>=23.1.0,<24
1818
fabric==2.6.0
19-
requests==2.31.0
19+
requests==2.32.2
2020
sagemaker-experiments==0.1.35
21-
Jinja2==3.1.3
21+
Jinja2==3.1.4
2222
pyvis==0.2.1
2323
pandas>=1.3.5,<1.5
2424
scikit-learn==1.3.0
@@ -36,3 +36,4 @@ onnx>=1.15.0
3636
nbformat>=5.9,<6
3737
accelerate>=0.24.1,<=0.27.0
3838
schema==0.7.5
39+
tensorflow>=2.1,<=2.16

src/sagemaker/base_deserializers.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ class NumpyDeserializer(SimpleBaseDeserializer):
196196
single array.
197197
"""
198198

199-
def __init__(self, dtype=None, accept="application/x-npy", allow_pickle=True):
199+
def __init__(self, dtype=None, accept="application/x-npy", allow_pickle=False):
200200
"""Initialize a ``NumpyDeserializer`` instance.
201201
202202
Args:
203203
dtype (str): The dtype of the data (default: None).
204204
accept (union[str, tuple[str]]): The MIME type (or tuple of allowable MIME types) that
205205
is expected from the inference endpoint (default: "application/x-npy").
206-
allow_pickle (bool): Allow loading pickled object arrays (default: True).
206+
allow_pickle (bool): Allow loading pickled object arrays (default: False).
207207
"""
208208
super(NumpyDeserializer, self).__init__(accept=accept)
209209
self.dtype = dtype
@@ -227,10 +227,21 @@ def deserialize(self, stream, content_type):
227227
if content_type == "application/json":
228228
return np.array(json.load(codecs.getreader("utf-8")(stream)), dtype=self.dtype)
229229
if content_type == "application/x-npy":
230-
return np.load(io.BytesIO(stream.read()), allow_pickle=self.allow_pickle)
230+
try:
231+
return np.load(io.BytesIO(stream.read()), allow_pickle=self.allow_pickle)
232+
except ValueError as ve:
233+
raise ValueError(
234+
"Please set the param allow_pickle=True \
235+
to deserialize pickle objects in NumpyDeserializer"
236+
).with_traceback(ve.__traceback__)
231237
if content_type == "application/x-npz":
232238
try:
233239
return np.load(io.BytesIO(stream.read()), allow_pickle=self.allow_pickle)
240+
except ValueError as ve:
241+
raise ValueError(
242+
"Please set the param allow_pickle=True \
243+
to deserialize pickle objectsin NumpyDeserializer"
244+
).with_traceback(ve.__traceback__)
234245
finally:
235246
stream.close()
236247
finally:

src/sagemaker/chainer/model.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
from sagemaker.model import FrameworkModel, MODEL_SERVER_WORKERS_PARAM_NAME
2929
from sagemaker.chainer import defaults
3030
from sagemaker.deserializers import NumpyDeserializer
31+
from sagemaker.model_card import (
32+
ModelCard,
33+
ModelPackageModelCard,
34+
)
3135
from sagemaker.predictor import Predictor
3236
from sagemaker.serializers import NumpySerializer
3337
from sagemaker.utils import to_string
@@ -175,6 +179,7 @@ def register(
175179
data_input_configuration: Optional[Union[str, PipelineVariable]] = None,
176180
skip_model_validation: Optional[Union[str, PipelineVariable]] = None,
177181
source_uri: Optional[Union[str, PipelineVariable]] = None,
182+
model_card: Optional[Union[ModelPackageModelCard, ModelCard]] = None,
178183
):
179184
"""Creates a model package for creating SageMaker models or listing on Marketplace.
180185
@@ -226,6 +231,8 @@ def register(
226231
validation. Values can be "All" or "None" (default: None).
227232
source_uri (str or PipelineVariable): The URI of the source for the model package
228233
(default: None).
234+
model_card (ModeCard or ModelPackageModelCard): document contains qualitative and
235+
quantitative information about a model (default: None).
229236
230237
Returns:
231238
str: A string of SageMaker Model Package ARN.
@@ -266,6 +273,7 @@ def register(
266273
data_input_configuration=data_input_configuration,
267274
skip_model_validation=skip_model_validation,
268275
source_uri=source_uri,
276+
model_card=model_card,
269277
)
270278

271279
def prepare_container_def(

src/sagemaker/enums.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,15 @@ class EndpointType(Enum):
2828
INFERENCE_COMPONENT_BASED = (
2929
"InferenceComponentBased" # Amazon SageMaker Inference Component Based Endpoint
3030
)
31+
32+
33+
class RoutingStrategy(Enum):
34+
"""Strategy for routing https traffics."""
35+
36+
RANDOM = "RANDOM"
37+
"""The endpoint routes each request to a randomly chosen instance.
38+
"""
39+
LEAST_OUTSTANDING_REQUESTS = "LEAST_OUTSTANDING_REQUESTS"
40+
"""The endpoint routes requests to the specific instances that have
41+
more capacity to process them.
42+
"""

src/sagemaker/estimator.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def __init__(
181181
container_arguments: Optional[List[str]] = None,
182182
disable_output_compression: bool = False,
183183
enable_remote_debug: Optional[Union[bool, PipelineVariable]] = None,
184+
enable_session_tag_chaining: Optional[Union[bool, PipelineVariable]] = None,
184185
**kwargs,
185186
):
186187
"""Initialize an ``EstimatorBase`` instance.
@@ -544,7 +545,9 @@ def __init__(
544545
enable_infra_check (bool or PipelineVariable): Optional.
545546
Specifies whether it is running Sagemaker built-in infra check jobs.
546547
enable_remote_debug (bool or PipelineVariable): Optional.
547-
Specifies whether RemoteDebug is enabled for the training job
548+
Specifies whether RemoteDebug is enabled for the training job.
549+
enable_session_tag_chaining (bool or PipelineVariable): Optional.
550+
Specifies whether SessionTagChaining is enabled for the training job.
548551
"""
549552
instance_count = renamed_kwargs(
550553
"train_instance_count", "instance_count", instance_count, kwargs
@@ -785,6 +788,8 @@ def __init__(
785788

786789
self._enable_remote_debug = enable_remote_debug
787790

791+
self._enable_session_tag_chaining = enable_session_tag_chaining
792+
788793
@abstractmethod
789794
def training_image_uri(self):
790795
"""Return the Docker image to use for training.
@@ -1719,6 +1724,7 @@ def register(
17191724
data_input_configuration=None,
17201725
skip_model_validation=None,
17211726
source_uri=None,
1727+
model_card=None,
17221728
**kwargs,
17231729
):
17241730
"""Creates a model package for creating SageMaker models or listing on Marketplace.
@@ -1767,6 +1773,8 @@ def register(
17671773
skip_model_validation (str): Indicates if you want to skip model validation.
17681774
Values can be "All" or "None" (default: None).
17691775
source_uri (str): The URI of the source for the model package (default: None).
1776+
model_card (ModeCard or ModelPackageModelCard): document contains qualitative and
1777+
quantitative information about a model (default: None).
17701778
**kwargs: Passed to invocation of ``create_model()``. Implementations may customize
17711779
``create_model()`` to accept ``**kwargs`` to customize model creation during
17721780
deploy. For more, see the implementation docs.
@@ -1812,6 +1820,7 @@ def register(
18121820
data_input_configuration=data_input_configuration,
18131821
skip_model_validation=skip_model_validation,
18141822
source_uri=source_uri,
1823+
model_card=model_card,
18151824
)
18161825

18171826
@property
@@ -2318,6 +2327,14 @@ def get_remote_debug_config(self):
23182327
else {"EnableRemoteDebug": self._enable_remote_debug}
23192328
)
23202329

2330+
def get_session_chaining_config(self):
2331+
"""dict: Return the configuration of SessionChaining"""
2332+
return (
2333+
None
2334+
if self._enable_session_tag_chaining is None
2335+
else {"EnableSessionTagChaining": self._enable_session_tag_chaining}
2336+
)
2337+
23212338
def enable_remote_debug(self):
23222339
"""Enable remote debug for a training job."""
23232340
self._update_remote_debug(True)
@@ -2574,6 +2591,9 @@ def _get_train_args(cls, estimator, inputs, experiment_config):
25742591
if estimator.get_remote_debug_config() is not None:
25752592
train_args["remote_debug_config"] = estimator.get_remote_debug_config()
25762593

2594+
if estimator.get_session_chaining_config() is not None:
2595+
train_args["session_chaining_config"] = estimator.get_session_chaining_config()
2596+
25772597
return train_args
25782598

25792599
@classmethod
@@ -2766,6 +2786,7 @@ def __init__(
27662786
disable_output_compression: bool = False,
27672787
enable_infra_check: Optional[Union[bool, PipelineVariable]] = None,
27682788
enable_remote_debug: Optional[Union[bool, PipelineVariable]] = None,
2789+
enable_session_tag_chaining: Optional[Union[bool, PipelineVariable]] = None,
27692790
**kwargs,
27702791
):
27712792
"""Initialize an ``Estimator`` instance.
@@ -3129,6 +3150,8 @@ def __init__(
31293150
Specifies whether it is running Sagemaker built-in infra check jobs.
31303151
enable_remote_debug (bool or PipelineVariable): Optional.
31313152
Specifies whether RemoteDebug is enabled for the training job
3153+
enable_session_tag_chaining (bool or PipelineVariable): Optional.
3154+
Specifies whether SessionTagChaining is enabled for the training job
31323155
"""
31333156
self.image_uri = image_uri
31343157
self._hyperparameters = hyperparameters.copy() if hyperparameters else {}
@@ -3181,6 +3204,7 @@ def __init__(
31813204
container_arguments=container_arguments,
31823205
disable_output_compression=disable_output_compression,
31833206
enable_remote_debug=enable_remote_debug,
3207+
enable_session_tag_chaining=enable_session_tag_chaining,
31843208
**kwargs,
31853209
)
31863210

0 commit comments

Comments
 (0)