Skip to content

Commit 0fc8706

Browse files
authored
Merge branch 'aws:master' into master
2 parents b88493b + 15cb303 commit 0fc8706

File tree

67 files changed

+2315
-1247
lines changed

Some content is hidden

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

67 files changed

+2315
-1247
lines changed

.githooks/pre-push

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ start_time=`date +%s`
1212
tox -e sphinx,doc8 --parallel all
1313
./ci-scripts/displaytime.sh 'sphinx,doc8' $start_time
1414
start_time=`date +%s`
15-
tox -e py38,py39,py310 --parallel all -- tests/unit
16-
./ci-scripts/displaytime.sh 'py38,py39,py310 unit' $start_time
15+
tox -e py39,py310,py311,py312 --parallel all -- tests/unit
16+
./ci-scripts/displaytime.sh 'py39,py310,py311,py312 unit' $start_time

.github/workflows/codebuild-ci-health.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
python-version: ["py38", "py39", "py310", "py311"]
29+
python-version: ["py39", "py310", "py311","py312"]
3030
steps:
3131
- name: Configure AWS Credentials
3232
uses: aws-actions/configure-aws-credentials@v4

.github/workflows/codebuild-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
strategy:
6464
fail-fast: false
6565
matrix:
66-
python-version: ["py38","py39","py310","py311"]
66+
python-version: ["py39","py310","py311","py312"]
6767
steps:
6868
- name: Configure AWS Credentials
6969
uses: aws-actions/configure-aws-credentials@v4

.pylintrc

+19-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,24 @@ disable=
9494
useless-object-inheritance, # TODO: Enable this check and fix code once Python 2 is no longer supported.
9595
super-with-arguments,
9696
raise-missing-from,
97-
E1136,
97+
C0116, # Missing function or method docstring
98+
C0209, # Use f-string instead of format
99+
E0015, # Unrecognized option found in config
100+
E0702, # Raising a string instead of an exception
101+
E1101, # Module has no member (likely dynamic attr)
102+
E1136, # Value assigned to something inferred as None
103+
R0022, # Useless option value in config
104+
R1710, # Inconsistent return statements
105+
R1714, # Consider using `in` with comparisons
106+
R1729, # Use a generator
107+
R1732,
108+
R1735, # Consider using a dict or list literal
109+
W0237, # Argument renamed in override
110+
W0613, # Unused argument
111+
W0621, # Redefining name from outer scope
112+
W0719
113+
W1404, # Implicit string concatenation
114+
W1514, # `open()` used without encoding
98115

99116
[REPORTS]
100117
# Set the output format. Available formats are text, parseable, colorized, msvs
@@ -436,4 +453,4 @@ analyse-fallback-blocks=no
436453

437454
# Exceptions that will emit a warning when being caught. Defaults to
438455
# "Exception"
439-
overgeneral-exceptions=Exception
456+
overgeneral-exceptions=builtins.Exception

.readthedocs.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
version: 2
66

77
build:
8-
os: ubuntu-20.04
8+
os: ubuntu-22.04
99
tools:
10-
python: "3.9"
10+
python: "3.12"
1111

1212

1313
python:

CHANGELOG.md

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

3+
## v2.243.3 (2025-04-23)
4+
5+
### Bug Fixes and Other Changes
6+
7+
* update readme to reflect py312 upgrade
8+
* Revert the PR changes 5122
9+
* Py312 upgrade step 2: Update dependencies, integ tests and unit tests
10+
* update pr test to deprecate py38 and add py312
11+
* update image_uri_configs 04-16-2025 07:18:18 PST
12+
* update image_uri_configs 04-15-2025 07:18:10 PST
13+
* update image_uri_configs 04-11-2025 07:18:19 PST
14+
15+
## v2.243.2 (2025-04-16)
16+
17+
### Bug Fixes and Other Changes
18+
19+
* tgi image uri unit tests
20+
* Fix deepdiff dependencies
21+
22+
## v2.243.1 (2025-04-11)
23+
24+
### Bug Fixes and Other Changes
25+
26+
* Added handler for pipeline variable while creating process job
27+
* Fix issue #4856 by copying environment variables
28+
* remove historical job_name caching which causes long job name
29+
* Update instance gpu info
30+
* Master
31+
* Add mlflow tracking arn telemetry
32+
* chore: fix semantic versioning for wildcard identifier
33+
* flaky test
34+
35+
### Documentation Changes
36+
37+
* update pipelines step caching examples to include more steps
38+
* update ModelStep data dependency info
39+
340
## v2.243.0 (2025-03-27)
441

542
### Features

README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ Supported Python Versions
9494

9595
SageMaker Python SDK is tested on:
9696

97-
- Python 3.8
9897
- Python 3.9
9998
- Python 3.10
10099
- Python 3.11
100+
- Python 3.12
101101

102102
Telemetry
103103
~~~~~~~~~~~~~~~
@@ -191,9 +191,9 @@ Setup a Python environment, and install the dependencies listed in ``doc/require
191191
::
192192

193193
# conda
194-
conda create -n sagemaker python=3.7
194+
conda create -n sagemaker python=3.12
195195
conda activate sagemaker
196-
conda install sphinx=3.1.1 sphinx_rtd_theme=0.5.0
196+
conda install sphinx=5.1.1 sphinx_rtd_theme=0.5.0
197197

198198
# pip
199199
pip install -r doc/requirements.txt

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.243.1.dev0
1+
2.243.4.dev0

doc/amazon_sagemaker_model_building_pipeline.rst

+213-1
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ Caching is supported for the following step types:
930930
- :class:`sagemaker.workflow.clarify_check_step.ClarifyCheckStep`
931931
- :class:`sagemaker.workflow.emr_step.EMRStep`
932932
933-
In order to create pipeline steps and eventually construct a SageMaker pipeline, you provide parameters within a Python script or notebook. The SageMaker Python SDK creates a pipeline definition by translating these parameters into SageMaker job attributes. Some of these attributes, when changed, cause the step to re-run (See `Caching Pipeline Steps <https://docs.aws.amazon.com/sagemaker/latest/dg/pipelines-caching.html>`__ for a detailed list). Therefore, if you update a SDK parameter that is used to create such an attribute, the step will rerun. See the following discussion for examples of this in processing and training steps, which are commonly used steps in Pipelines.
933+
In order to create pipeline steps and eventually construct a SageMaker pipeline, you provide parameters within a Python script or notebook. The SageMaker Python SDK creates a pipeline definition by translating these parameters into SageMaker job attributes. Some of these attributes, when changed, cause the step to re-run (See `Caching Pipeline Steps <https://docs.aws.amazon.com/sagemaker/latest/dg/pipelines-caching.html>`__ for a detailed list). Therefore, if you update a SDK parameter that is used to create such an attribute, the step will rerun. See the following discussion for examples of this in commonly used step types in Pipelines.
934934
935935
The following example creates a processing step:
936936
@@ -1055,6 +1055,218 @@ The following parameters from the example cause additional training step iterati
10551055
- :code:`entry_point`: The entry point file is included in the training job’s `InputDataConfig Channel <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html>`__ array. A unique hash is created from the file (and any other dependencies), and then the file is uploaded to S3 with the hash included in the path. When a different entry point file is used, a new hash is created and the S3 path for that `InputDataConfig Channel <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html>`__ object changes, initiating a new step run. For examples of what the S3 paths look like, see the **S3 Artifact Folder Structure** section.
10561056
- :code:`inputs`: The inputs are also included in the training job’s `InputDataConfig <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html>`__. Local inputs are uploaded to S3. If the S3 path changes, a new training job is initiated. For examples of S3 paths, see the **S3 Artifact Folder Structure** section.
10571057
1058+
The following example creates a tuning step:
1059+
1060+
.. code-block:: python
1061+
1062+
from sagemaker.workflow.steps import TuningStep
1063+
from sagemaker.tuner import HyperparameterTuner
1064+
from sagemaker.estimator import Estimator
1065+
from sagemaker.inputs import TrainingInput
1066+
1067+
model_path = f"s3://{default_bucket}/{base_job_prefix}/AbaloneTrain"
1068+
1069+
xgb_train = Estimator(
1070+
image_uri=image_uri,
1071+
instance_type=training_instance_type,
1072+
instance_count=1,
1073+
output_path=model_path,
1074+
base_job_name=f"{base_job_prefix}/abalone-train",
1075+
sagemaker_session=pipeline_session,
1076+
role=role,
1077+
)
1078+
1079+
xgb_train.set_hyperparameters(
1080+
eval_metric="rmse",
1081+
objective="reg:squarederror", # Define the object metric for the training job
1082+
num_round=50,
1083+
max_depth=5,
1084+
eta=0.2,
1085+
gamma=4,
1086+
min_child_weight=6,
1087+
subsample=0.7,
1088+
silent=0,
1089+
)
1090+
1091+
objective_metric_name = "validation:rmse"
1092+
1093+
hyperparameter_ranges = {
1094+
"alpha": ContinuousParameter(0.01, 10, scaling_type="Logarithmic"),
1095+
"lambda": ContinuousParameter(0.01, 10, scaling_type="Logarithmic"),
1096+
}
1097+
1098+
tuner = HyperparameterTuner(
1099+
xgb_train,
1100+
objective_metric_name,
1101+
hyperparameter_ranges,
1102+
max_jobs=3,
1103+
max_parallel_jobs=3,
1104+
strategy="Random",
1105+
objective_type="Minimize",
1106+
)
1107+
1108+
hpo_args = tuner.fit(
1109+
inputs={
1110+
"train": TrainingInput(
1111+
s3_data=step_process.properties.ProcessingOutputConfig.Outputs["train"].S3Output.S3Uri,
1112+
content_type="text/csv",
1113+
),
1114+
"validation": TrainingInput(
1115+
s3_data=step_process.properties.ProcessingOutputConfig.Outputs[
1116+
"validation"
1117+
].S3Output.S3Uri,
1118+
content_type="text/csv",
1119+
),
1120+
}
1121+
)
1122+
1123+
step_tuning = TuningStep(
1124+
name="HPTuning",
1125+
step_args=hpo_args,
1126+
cache_config=cache_config,
1127+
)
1128+
1129+
The following parameters from the example cause additional tuning (or training) step iterations when you change them:
1130+
1131+
- :code:`image_uri`: The :code:`image_uri` parameter defines the image used for training, and is used directly in the `AlgorithmSpecification <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AlgorithmSpecification.html>`__ attribute of the training job(s) that are created from the tuning job.
1132+
- :code:`hyperparameters`: All of the hyperparameters passed in the :code:`xgb_train.set_hyperparameters()` method are used directly in the `StaticHyperParameters <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_HyperParameterTrainingJobDefinition.html>`__ attribute for the tuning job.
1133+
- The following parameters are all included in the `HyperParameterTuningJobConfig <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_HyperParameterTuningJobConfig.html>`__ and if any one of them changes, a new tuning job is initiated:
1134+
- :code:`hyperparameter_ranges`
1135+
- :code:`objective_metric_name`
1136+
- :code:`max_jobs`
1137+
- :code:`max_parallel_jobs`
1138+
- :code:`strategy`
1139+
- :code:`objective_type`
1140+
- :code:`inputs`: The inputs are included in any training job’s `InputDataConfig <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Channel.html>`__ that get created from the tuning job. Local inputs are uploaded to S3. If the S3 path changes, a new tuning job is initiated. For examples of S3 paths, see the S3 Artifact Folder Structure section.
1141+
1142+
The following examples creates a transform step:
1143+
1144+
.. code-block:: python
1145+
1146+
from sagemaker.transformer import Transformer
1147+
from sagemaker.inputs import TransformInput
1148+
from sagemaker.workflow.steps import TransformStep
1149+
1150+
base_uri = f"s3://{default_bucket}/abalone"
1151+
batch_data_uri = sagemaker.s3.S3Uploader.upload(
1152+
local_path=local_path,
1153+
desired_s3_uri=base_uri,
1154+
)
1155+
1156+
batch_data = ParameterString(
1157+
name="BatchData",
1158+
default_value=batch_data_uri,
1159+
)
1160+
1161+
transformer = Transformer(
1162+
model_name=step_create_model.properties.ModelName,
1163+
instance_type="ml.m5.xlarge",
1164+
instance_count=1,
1165+
output_path=f"s3://{default_bucket}/AbaloneTransform",
1166+
env={
1167+
'class': 'Transformer'
1168+
}
1169+
)
1170+
1171+
step_transform = TransformStep(
1172+
name="AbaloneTransform",
1173+
step_args=transformer.transform(
1174+
data=batch_data,
1175+
data_type="S3Prefix"
1176+
)
1177+
)
1178+
1179+
The following parameters from the example cause additional batch transform step iterations when you change them:
1180+
1181+
- :code:`model_name`: The name of the SageMaker model being used for the transform job.
1182+
- :code:`env`: Environment variables to be set for use during the transform job.
1183+
- :code:`batch_data`: The input data will be included in the transform job’s `TransformInputfield <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_TransformInput.html>`__. If the S3 path changes, a new transform job is initiated.
1184+
1185+
The following example creates an automl step:
1186+
1187+
.. code-block:: python
1188+
1189+
from sagemaker.workflow.pipeline_context import PipelineSession
1190+
from sagemaker.workflow.automl_step import AutoMLStep
1191+
1192+
pipeline_session = PipelineSession()
1193+
1194+
auto_ml = AutoML(...,
1195+
role=role,
1196+
target_attribute_name="my_target_attribute_name",
1197+
mode="ENSEMBLING",
1198+
sagemaker_session=pipeline_session)
1199+
1200+
input_training = AutoMLInput(
1201+
inputs="s3://amzn-s3-demo-bucket/my-training-data",
1202+
target_attribute_name="my_target_attribute_name",
1203+
channel_type="training",
1204+
)
1205+
input_validation = AutoMLInput(
1206+
inputs="s3://amzn-s3-demo-bucket/my-validation-data",
1207+
target_attribute_name="my_target_attribute_name",
1208+
channel_type="validation",
1209+
)
1210+
1211+
step_args = auto_ml.fit(
1212+
inputs=[input_training, input_validation]
1213+
)
1214+
1215+
step_automl = AutoMLStep(
1216+
name="AutoMLStep",
1217+
step_args=step_args,
1218+
)
1219+
1220+
best_model = step_automl.get_best_auto_ml_model(role=<role>)
1221+
1222+
The following parameters from the example cause additional automl step iterations when you change them:
1223+
1224+
- :code:`target_attribute_name`: The name of the target variable in supervised learning.
1225+
- :code:`mode`: The method that AutoML job uses to train the model - either AUTO, ENSEMBLING or HYPERPARAMETER_TUNING.
1226+
- :code:`inputs`: The inputs passed to the auto_ml.fit() method are included in the automl job’s `InputDataConfig <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AutoMLChannel.html>`__. If the included S3 path(s) change, a new automl job is initiated.
1227+
1228+
The following example creates an EMR step:
1229+
1230+
.. code-block:: python
1231+
1232+
from sagemaker.workflow.emr_step import EMRStep, EMRStepConfig
1233+
1234+
emr_config = EMRStepConfig(
1235+
jar="jar-location", # required, path to jar file used
1236+
args=["--verbose", "--force"], # optional list of arguments to pass to the jar
1237+
main_class="com.my.Main1", # optional main class, this can be omitted if jar above has a manifest
1238+
properties=[ # optional list of Java properties that are set when the step runs
1239+
{
1240+
"key": "mapred.tasktracker.map.tasks.maximum",
1241+
"value": "2"
1242+
},
1243+
{
1244+
"key": "mapreduce.map.sort.spill.percent",
1245+
"value": "0.90"
1246+
},
1247+
{
1248+
"key": "mapreduce.tasktracker.reduce.tasks.maximum",
1249+
"value": "5"
1250+
}
1251+
]
1252+
)
1253+
1254+
step_emr = EMRStep(
1255+
name="EMRSampleStep", # required
1256+
cluster_id="j-1ABCDEFG2HIJK", # include cluster_id to use a running cluster
1257+
step_config=emr_config, # required
1258+
display_name="My EMR Step",
1259+
description="Pipeline step to execute EMR job"
1260+
)
1261+
1262+
The following parameters from the example cause additional EMR step iterations when you change them:
1263+
1264+
- :code:`cluster_id`: The id of a running cluster to leverage for the EMR job.
1265+
- :code:`emr_config`: Configuration regarding the code that will run on the EMR cluster during the job.
1266+
1267+
:class:`Note`: A :code:`cluster_config` parameter may also be passed into :code:`EMRStep` in order to spin up a new cluster. This parameter will also trigger additional step iterations if changed.
1268+
1269+
10581270
S3 Artifact Folder Structure
10591271
----------------------------
10601272

doc/api/inference/model_builder.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Model Builder
33

44
This module contains classes related to Amazon Sagemaker Model Builder
55

6-
.. autoclass:: sagemaker.serve.builder.model_builder.ModelBuilder
6+
.. autoclass:: sagemaker.serve.ModelBuilder
77

8-
.. automethod:: sagemaker.serve.builder.model_builder.ModelBuilder.build
8+
.. automethod:: sagemaker.serve.ModelBuilder.build
99

10-
.. automethod:: sagemaker.serve.builder.model_builder.ModelBuilder.save
10+
.. automethod:: sagemaker.serve.ModelBuilder.save
1111

12-
.. autoclass:: sagemaker.serve.spec.inference_spec.InferenceSpec
12+
.. autoclass:: sagemaker.serve.InferenceSpec
1313

14-
.. autoclass:: sagemaker.serve.builder.schema_builder.SchemaBuilder
14+
.. autoclass:: sagemaker.serve.SchemaBuilder
1515

16-
.. autoclass:: sagemaker.serve.marshalling.custom_payload_translator.CustomPayloadTranslator
16+
.. autoclass:: sagemaker.serve.CustomPayloadTranslator

doc/api/training/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Training APIs
33
#############
44

55
.. toctree::
6-
:maxdepth: 4
6+
:maxdepth: 1
77

88
model_trainer
99
algorithm

0 commit comments

Comments
 (0)