Skip to content

Commit 9d07415

Browse files
authored
Merge branch 'master' into accelerate-source
2 parents 84b42ef + c8d1428 commit 9d07415

File tree

8 files changed

+77
-13
lines changed

8 files changed

+77
-13
lines changed

CHANGELOG.md

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

3+
## v2.213.0 (2024-03-15)
4+
5+
### Features
6+
7+
* Add support for Streaming Inference
8+
* tgi optimum 0.0.19, 0.0.20 releases
9+
* support JumpStart proprietary models
10+
* Add ModelDataSource and SourceUri support for model package and while registering
11+
* Accept user-defined env variables for the entry-point
12+
* Add overriding logic in ModelBuilder when task is provided
13+
14+
### Bug Fixes and Other Changes
15+
16+
* Improvement of the tuner documentation
17+
* Skip of tests which are long running and causing the ResourceLimitInUse exception
18+
* Add AutoML -> AutoMLV2 mapper
19+
* add ci-health checks
20+
* split coverage out from testenv in tox.ini
21+
* add PT 2.2 support for smdistributed, pytorchddp, and torch_distributed distributions
22+
* sagemaker session region not being used
23+
* chore: emit warning when no instance specific gated training env var is available, and raise exception when accept_eula flag is not supplied
24+
* enable github actions for PRs
25+
* Move sagemaker pysdk version check after bootstrap in remote job
26+
* make unit tests compatible with pytest-xdist
27+
* Update tblib constraint
28+
329
## v2.212.0 (2024-03-06)
430

531
### Features

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@ Table of Contents
6767
Installing the SageMaker Python SDK
6868
-----------------------------------
6969

70-
The SageMaker Python SDK is built to PyPI and can be installed with pip as follows:
71-
70+
The SageMaker Python SDK is built to PyPI and the latest version of the SageMaker Python SDK can be installed with pip as follows
7271
::
7372

74-
pip install sagemaker
73+
pip install sagemaker==<Latest version from pyPI from https://pypi.org/project/sagemaker/>
7574

7675
You can install from source by cloning this repository and running a pip install command in the root directory of the repository:
7776

VERSION

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

src/sagemaker/jumpstart/notebook_utils.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ def list_jumpstart_scripts( # pylint: disable=redefined-builtin
262262
return sorted(list(scripts))
263263

264264

265+
def _is_valid_version(version: str) -> bool:
266+
"""Checks if the version is convertable to Version class."""
267+
try:
268+
Version(version)
269+
return True
270+
except Exception: # pylint: disable=broad-except
271+
return False
272+
273+
265274
def list_jumpstart_models( # pylint: disable=redefined-builtin
266275
filter: Union[Operator, str] = Constant(BooleanValues.TRUE),
267276
region: Optional[str] = None,
@@ -304,7 +313,8 @@ def list_jumpstart_models( # pylint: disable=redefined-builtin
304313
):
305314
if model_id not in model_id_version_dict:
306315
model_id_version_dict[model_id] = list()
307-
model_id_version_dict[model_id].append(Version(version))
316+
model_version = Version(version) if _is_valid_version(version) else version
317+
model_id_version_dict[model_id].append(model_version)
308318

309319
if not list_versions:
310320
return sorted(list(model_id_version_dict.keys()))

src/sagemaker/tuner.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
"""Placeholder docstring"""
14+
1415
from __future__ import absolute_import
1516

1617
import importlib
@@ -641,8 +642,11 @@ def __init__(
641642
extract the metric from the logs. This should be defined only
642643
for hyperparameter tuning jobs that don't use an Amazon
643644
algorithm.
644-
strategy (str or PipelineVariable): Strategy to be used for hyperparameter estimations
645-
(default: 'Bayesian').
645+
strategy (str or PipelineVariable): Strategy to be used for hyperparameter estimations.
646+
More information about different strategies:
647+
https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html.
648+
Available options are: 'Bayesian', 'Random', 'Hyperband',
649+
'Grid' (default: 'Bayesian')
646650
objective_type (str or PipelineVariable): The type of the objective metric for
647651
evaluating training jobs. This value can be either 'Minimize' or
648652
'Maximize' (default: 'Maximize').
@@ -759,7 +763,8 @@ def __init__(
759763
self.autotune = autotune
760764

761765
def override_resource_config(
762-
self, instance_configs: Union[List[InstanceConfig], Dict[str, List[InstanceConfig]]]
766+
self,
767+
instance_configs: Union[List[InstanceConfig], Dict[str, List[InstanceConfig]]],
763768
):
764769
"""Override the instance configuration of the estimators used by the tuner.
765770
@@ -966,7 +971,7 @@ def fit(
966971
include_cls_metadata: Union[bool, Dict[str, bool]] = False,
967972
estimator_kwargs: Optional[Dict[str, dict]] = None,
968973
wait: bool = True,
969-
**kwargs
974+
**kwargs,
970975
):
971976
"""Start a hyperparameter tuning job.
972977
@@ -1055,7 +1060,7 @@ def _fit_with_estimator_dict(self, inputs, job_name, include_cls_metadata, estim
10551060
allowed_keys=estimator_names,
10561061
)
10571062

1058-
for (estimator_name, estimator) in self.estimator_dict.items():
1063+
for estimator_name, estimator in self.estimator_dict.items():
10591064
ins = inputs.get(estimator_name, None) if inputs is not None else None
10601065
args = estimator_kwargs.get(estimator_name, {}) if estimator_kwargs is not None else {}
10611066
self._prepare_estimator_for_tuning(estimator, ins, job_name, **args)
@@ -1282,7 +1287,7 @@ def _attach_with_training_details_list(cls, sagemaker_session, estimator_cls, jo
12821287
objective_metric_name_dict=objective_metric_name_dict,
12831288
hyperparameter_ranges_dict=hyperparameter_ranges_dict,
12841289
metric_definitions_dict=metric_definitions_dict,
1285-
**init_params
1290+
**init_params,
12861291
)
12871292

12881293
def deploy(
@@ -1297,7 +1302,7 @@ def deploy(
12971302
model_name=None,
12981303
kms_key=None,
12991304
data_capture_config=None,
1300-
**kwargs
1305+
**kwargs,
13011306
):
13021307
"""Deploy the best trained or user specified model to an Amazon SageMaker endpoint.
13031308
@@ -1363,7 +1368,7 @@ def deploy(
13631368
model_name=model_name,
13641369
kms_key=kms_key,
13651370
data_capture_config=data_capture_config,
1366-
**kwargs
1371+
**kwargs,
13671372
)
13681373

13691374
def stop_tuning_job(self):

tests/integ/sagemaker/serve/test_serve_pt_happy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def model_builder(request):
181181
# ), f"{caught_ex} was thrown when running pytorch squeezenet local container test"
182182

183183

184+
@pytest.mark.skip(reason="Failing test. Fix is pending.")
184185
@pytest.mark.skipif(
185186
PYTHON_VERSION_IS_NOT_310, # or NOT_RUNNING_ON_INF_EXP_DEV_PIPELINE,
186187
reason="The goal of these test are to test the serving components of our feature",

tests/unit/sagemaker/jumpstart/constants.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7577,6 +7577,20 @@
75777577
"spec_key": "proprietary-models/ai21-paraphrase/proprietary_specs_1.0.005.json",
75787578
"search_keywords": ["Text2Text", "Generation"],
75797579
},
7580+
{
7581+
"model_id": "ai21-paraphrase",
7582+
"version": "v1.00-rc2-not-valid-version",
7583+
"min_version": "2.0.0",
7584+
"spec_key": "proprietary-models/ai21-paraphrase/proprietary_specs_1.0.005.json",
7585+
"search_keywords": ["Text2Text", "Generation"],
7586+
},
7587+
{
7588+
"model_id": "nc-soft-model-1",
7589+
"version": "v3.0-not-valid-version!",
7590+
"min_version": "2.0.0",
7591+
"spec_key": "proprietary-models/nc-soft-model-1/proprietary_specs_1.0.005.json",
7592+
"search_keywords": ["Text2Text", "Generation"],
7593+
},
75807594
]
75817595

75827596
BASE_PROPRIETARY_SPEC = {

tests/unit/sagemaker/jumpstart/test_notebook_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
list_jumpstart_models,
2626
list_jumpstart_scripts,
2727
list_jumpstart_tasks,
28+
_is_valid_version,
2829
)
2930

3031

@@ -185,6 +186,13 @@ def test_list_jumpstart_frameworks(
185186
patched_get_model_specs.assert_not_called()
186187

187188

189+
def test_is_valid_version():
190+
valid_version_strs = ["1.0", "1.0.0", "2012.4", "1!1.0", "1.dev0", "1.2.3+abc.dev1"]
191+
invalid_version_strs = ["1.1.053_m", "invalid version", "v1-1.0-v2", "@"]
192+
assert all(_is_valid_version(v) for v in valid_version_strs)
193+
assert not any(_is_valid_version(v) for v in invalid_version_strs)
194+
195+
188196
class ListJumpStartModels(TestCase):
189197
@patch("sagemaker.jumpstart.accessors.JumpStartModelsAccessor._get_manifest")
190198
@patch("sagemaker.jumpstart.accessors.JumpStartModelsAccessor.get_model_specs")
@@ -626,6 +634,7 @@ def test_list_jumpstart_proprietary_models(
626634
"ai21-paraphrase",
627635
"ai21-summarization",
628636
"lighton-mini-instruct40b",
637+
"nc-soft-model-1",
629638
]
630639

631640
all_open_weight_model_ids = [

0 commit comments

Comments
 (0)