Skip to content

Commit 0be4fd5

Browse files
authored
Merge branch 'master' into feat/jumpstart-extract-generated-text-from-response
2 parents 91cb900 + 5acad56 commit 0be4fd5

33 files changed

+1878
-185
lines changed

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## v2.193.0 (2023-10-18)
4+
5+
### Features
6+
7+
* jumpstart model artifact instance type variants
8+
* jumpstart instance specific hyperparameters
9+
* Feature Processor event based triggers (#1132)
10+
* Support job checkpoint in remote function
11+
* jumpstart model package arn instance type variants
12+
13+
### Bug Fixes and Other Changes
14+
15+
* Fix hyperlinks in feature_processor.scheduler parameter descriptions
16+
* add image_uris_unit_test pytest mark
17+
* bump apache-airflow to `v2.7.2`
18+
* clone distribution in validate_distribution
19+
* fix flaky Inference Recommender integration tests
20+
21+
### Documentation Changes
22+
23+
* Update PipelineModel.register documentation
24+
* specify that input_shape in no longer required for torch 2.0 mod…
25+
326
## v2.192.1 (2023-10-13)
427

528
### Bug Fixes and Other Changes

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.192.2.dev0
1+
2.193.1.dev0

doc/amazon_sagemaker_featurestore.rst

+8-4
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@ The following code from the fraud detection example shows a minimal
230230
    enable_online_store=True
231231
)
232232
233-
Creating a feature group takes time as the data is loaded. You will need
234-
to wait until it is created before you can use it. You can check status
235-
using the following method.
233+
Creating a feature group takes time as the data is loaded. You will
234+
need to wait until it is created before you can use it. You can
235+
check status using the following method. Note that it can take
236+
approximately 10-15 minutes to provision an online ``FeatureGroup``
237+
with the ``InMemory`` ``StorageType``.
236238

237239
.. code:: python
238240
@@ -480,7 +482,9 @@ Feature Store `DatasetBuilder API Reference
480482
.. rubric:: Delete a feature group
481483
:name: bCe9CA61b78
482484

483-
You can delete a feature group with the ``delete`` function.
485+
You can delete a feature group with the ``delete`` function. Note that it
486+
can take approximately 10-15 minutes to delete an online ``FeatureGroup``
487+
with the ``InMemory`` ``StorageType``.
484488

485489
.. code:: python
486490

requirements/extras/test_requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ awslogs==0.14.0
1212
black==22.3.0
1313
stopit==1.1.2
1414
# Update tox.ini to have correct version of airflow constraints file
15-
apache-airflow==2.7.1
15+
apache-airflow==2.7.2
1616
apache-airflow-providers-amazon==7.2.1
1717
attrs>=23.1.0,<24
1818
fabric==2.6.0

src/sagemaker/djl_inference/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def serving_image_uri(self, region_name):
781781
str: The appropriate image URI based on the given parameters.
782782
"""
783783
if not self.djl_version:
784-
self.djl_version = "0.23.0"
784+
self.djl_version = "0.24.0"
785785

786786
return image_uris.retrieve(
787787
self._framework(),

src/sagemaker/feature_store/feature_processor/feature_scheduler.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,13 @@ def schedule(
281281
Args:
282282
pipeline_name (str): The SageMaker Pipeline name that will be scheduled.
283283
schedule_expression (str): The expression that defines when the schedule runs. It supports
284-
at expression, rate expression and cron expression. See https://docs.aws.amazon.com/
285-
scheduler/latest/APIReference/API_CreateSchedule.html#scheduler-CreateSchedule-request
286-
-ScheduleExpression for more details.
284+
at expression, rate expression and cron expression. See '''https://docs.aws.amazon.com\
285+
/scheduler/latest/APIReference/API_CreateSchedule.html#scheduler-CreateSchedule-\
286+
request-ScheduleExpression''' for more details.
287287
state (str): Specifies whether the schedule is enabled or disabled. Valid values are
288-
ENABLED and DISABLED. See https://docs.aws.amazon.com/scheduler/latest/APIReference/
289-
API_CreateSchedule.html#scheduler-CreateSchedule-request-State for more details.
290-
If not specified, it will default to ENABLED.
288+
ENABLED and DISABLED. See '''https://docs.aws.amazon.com/scheduler/latest/APIReference\
289+
/API_CreateSchedule.html#scheduler-CreateSchedule-request-State'''
290+
for more details. If not specified, it will default to ENABLED.
291291
start_date (Optional[datetime]): The date, in UTC, after which the schedule can begin
292292
invoking its target. Depending on the schedule’s recurrence expression, invocations
293293
might occur on, or after, the StartDate you specify.

src/sagemaker/huggingface/llm_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ def get_huggingface_llm_image_uri(
5151
image_scope="inference",
5252
)
5353
if backend == "lmi":
54-
version = version or "0.23.0"
54+
version = version or "0.24.0"
5555
return image_uris.retrieve(framework="djl-deepspeed", region=region, version=version)
5656
raise ValueError("Unsupported backend: %s" % backend)

src/sagemaker/image_uri_config/djl-deepspeed.json

+31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
{
22
"scope": ["inference"],
33
"versions": {
4+
"0.24.0": {
5+
"registries": {
6+
"af-south-1": "626614931356",
7+
"il-central-1": "780543022126",
8+
"ap-east-1": "871362719292",
9+
"ap-northeast-1": "763104351884",
10+
"ap-northeast-2": "763104351884",
11+
"ap-northeast-3": "364406365360",
12+
"ap-south-1": "763104351884",
13+
"ap-southeast-1": "763104351884",
14+
"ap-southeast-2": "763104351884",
15+
"ap-southeast-3": "907027046896",
16+
"ca-central-1": "763104351884",
17+
"cn-north-1": "727897471807",
18+
"cn-northwest-1": "727897471807",
19+
"eu-central-1": "763104351884",
20+
"eu-north-1": "763104351884",
21+
"eu-west-1": "763104351884",
22+
"eu-west-2": "763104351884",
23+
"eu-west-3": "763104351884",
24+
"eu-south-1": "692866216735",
25+
"me-south-1": "217643126080",
26+
"sa-east-1": "763104351884",
27+
"us-east-1": "763104351884",
28+
"us-east-2": "763104351884",
29+
"us-west-1": "763104351884",
30+
"us-west-2": "763104351884"
31+
},
32+
"repository": "djl-inference",
33+
"tag_prefix": "0.24.0-deepspeed0.10.0-cu118"
34+
},
435
"0.23.0": {
536
"registries": {
637
"af-south-1": "626614931356",

src/sagemaker/image_uri_config/djl-fastertransformer.json

+31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
{
22
"scope": ["inference"],
33
"versions": {
4+
"0.24.0": {
5+
"registries": {
6+
"af-south-1": "626614931356",
7+
"il-central-1": "780543022126",
8+
"ap-east-1": "871362719292",
9+
"ap-northeast-1": "763104351884",
10+
"ap-northeast-2": "763104351884",
11+
"ap-northeast-3": "364406365360",
12+
"ap-south-1": "763104351884",
13+
"ap-southeast-1": "763104351884",
14+
"ap-southeast-2": "763104351884",
15+
"ap-southeast-3": "907027046896",
16+
"ca-central-1": "763104351884",
17+
"cn-north-1": "727897471807",
18+
"cn-northwest-1": "727897471807",
19+
"eu-central-1": "763104351884",
20+
"eu-north-1": "763104351884",
21+
"eu-west-1": "763104351884",
22+
"eu-west-2": "763104351884",
23+
"eu-west-3": "763104351884",
24+
"eu-south-1": "692866216735",
25+
"me-south-1": "217643126080",
26+
"sa-east-1": "763104351884",
27+
"us-east-1": "763104351884",
28+
"us-east-2": "763104351884",
29+
"us-west-1": "763104351884",
30+
"us-west-2": "763104351884"
31+
},
32+
"repository": "djl-inference",
33+
"tag_prefix": "0.24.0-fastertransformer5.3.0-cu118"
34+
},
435
"0.23.0": {
536
"registries": {
637
"af-south-1": "626614931356",

src/sagemaker/jumpstart/artifacts/metric_definitions.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def _retrieve_default_training_metric_definitions(
3434
tolerate_vulnerable_model: bool = False,
3535
tolerate_deprecated_model: bool = False,
3636
sagemaker_session: Session = DEFAULT_JUMPSTART_SAGEMAKER_SESSION,
37+
instance_type: Optional[str] = None,
3738
) -> Optional[List[Dict[str, str]]]:
3839
"""Retrieves the default training metric definitions for the model.
3940
@@ -55,6 +56,8 @@ def _retrieve_default_training_metric_definitions(
5556
object, used for SageMaker interactions. If not
5657
specified, one is created using the default AWS configuration
5758
chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
59+
instance_type (str): An instance type to optionally supply in order to get
60+
metric definitions specific for the instance type.
5861
Returns:
5962
list: the default training metric definitions to use for the model or None.
6063
"""
@@ -72,4 +75,29 @@ def _retrieve_default_training_metric_definitions(
7275
sagemaker_session=sagemaker_session,
7376
)
7477

75-
return deepcopy(model_specs.metrics) if model_specs.metrics else None
78+
default_metric_definitions = (
79+
deepcopy(model_specs.metrics) if getattr(model_specs, "metrics") else []
80+
)
81+
82+
instance_specific_metric_definitions = (
83+
model_specs.training_instance_type_variants.get_instance_specific_metric_definitions(
84+
instance_type
85+
)
86+
if instance_type
87+
and getattr(model_specs, "training_instance_type_variants", None) is not None
88+
else []
89+
)
90+
91+
instance_specific_metric_name: str
92+
for instance_specific_metric_definition in instance_specific_metric_definitions:
93+
instance_specific_metric_name = instance_specific_metric_definition["Name"]
94+
default_metric_definitions = list(
95+
filter(
96+
lambda metric_definition: metric_definition["Name"]
97+
!= instance_specific_metric_name,
98+
default_metric_definitions,
99+
)
100+
)
101+
default_metric_definitions.append(instance_specific_metric_definition)
102+
103+
return default_metric_definitions

src/sagemaker/jumpstart/artifacts/model_uris.py

+67-3
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,68 @@
2828
verify_model_region_and_return_specs,
2929
)
3030
from sagemaker.session import Session
31+
from sagemaker.jumpstart.types import JumpStartModelSpecs
32+
33+
34+
def _retrieve_hosting_prepacked_artifact_key(
35+
model_specs: JumpStartModelSpecs, instance_type: str
36+
) -> str:
37+
"""Returns instance specific hosting prepacked artifact key or default one as fallback."""
38+
instance_specific_prepacked_hosting_artifact_key: Optional[str] = (
39+
model_specs.hosting_instance_type_variants.get_instance_specific_prepacked_artifact_key(
40+
instance_type=instance_type
41+
)
42+
if instance_type
43+
and getattr(model_specs, "hosting_instance_type_variants", None) is not None
44+
else None
45+
)
46+
47+
default_prepacked_hosting_artifact_key: Optional[str] = getattr(
48+
model_specs, "hosting_prepacked_artifact_key"
49+
)
50+
51+
return (
52+
instance_specific_prepacked_hosting_artifact_key or default_prepacked_hosting_artifact_key
53+
)
54+
55+
56+
def _retrieve_hosting_artifact_key(model_specs: JumpStartModelSpecs, instance_type: str) -> str:
57+
"""Returns instance specific hosting artifact key or default one as fallback."""
58+
instance_specific_hosting_artifact_key: Optional[str] = (
59+
model_specs.hosting_instance_type_variants.get_instance_specific_artifact_key(
60+
instance_type=instance_type
61+
)
62+
if instance_type
63+
and getattr(model_specs, "hosting_instance_type_variants", None) is not None
64+
else None
65+
)
66+
67+
default_hosting_artifact_key: str = model_specs.hosting_artifact_key
68+
69+
return instance_specific_hosting_artifact_key or default_hosting_artifact_key
70+
71+
72+
def _retrieve_training_artifact_key(model_specs: JumpStartModelSpecs, instance_type: str) -> str:
73+
"""Returns instance specific training artifact key or default one as fallback."""
74+
instance_specific_training_artifact_key: Optional[str] = (
75+
model_specs.training_instance_type_variants.get_instance_specific_artifact_key(
76+
instance_type=instance_type
77+
)
78+
if instance_type
79+
and getattr(model_specs, "training_instance_type_variants", None) is not None
80+
else None
81+
)
82+
83+
default_training_artifact_key: str = model_specs.training_artifact_key
84+
85+
return instance_specific_training_artifact_key or default_training_artifact_key
3186

3287

3388
def _retrieve_model_uri(
3489
model_id: str,
3590
model_version: str,
3691
model_scope: Optional[str] = None,
92+
instance_type: Optional[str] = None,
3793
region: Optional[str] = None,
3894
tolerate_vulnerable_model: bool = False,
3995
tolerate_deprecated_model: bool = False,
@@ -50,6 +106,7 @@ def _retrieve_model_uri(
50106
artifact S3 URI.
51107
model_scope (str): The model type, i.e. what it is used for.
52108
Valid values: "training" and "inference".
109+
instance_type (str): The ML compute instance type for the specified scope. (Default: None).
53110
region (str): Region for which to retrieve model S3 URI. (Default: None).
54111
tolerate_vulnerable_model (bool): True if vulnerable versions of model
55112
specifications should be tolerated (exception not raised). If False, raises an
@@ -84,14 +141,21 @@ def _retrieve_model_uri(
84141
sagemaker_session=sagemaker_session,
85142
)
86143

144+
model_artifact_key: str
145+
87146
if model_scope == JumpStartScriptScope.INFERENCE:
147+
148+
is_prepacked = not model_specs.use_inference_script_uri()
149+
88150
model_artifact_key = (
89-
getattr(model_specs, "hosting_prepacked_artifact_key", None)
90-
or model_specs.hosting_artifact_key
151+
_retrieve_hosting_prepacked_artifact_key(model_specs, instance_type)
152+
if is_prepacked
153+
else _retrieve_hosting_artifact_key(model_specs, instance_type)
91154
)
92155

93156
elif model_scope == JumpStartScriptScope.TRAINING:
94-
model_artifact_key = model_specs.training_artifact_key
157+
158+
model_artifact_key = _retrieve_training_artifact_key(model_specs, instance_type)
95159

96160
bucket = os.environ.get(
97161
ENV_VARIABLE_JUMPSTART_MODEL_ARTIFACT_BUCKET_OVERRIDE

src/sagemaker/jumpstart/factory/estimator.py

+2
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ def _add_model_uri_to_kwargs(kwargs: JumpStartEstimatorInitKwargs) -> JumpStartE
475475
tolerate_deprecated_model=kwargs.tolerate_deprecated_model,
476476
tolerate_vulnerable_model=kwargs.tolerate_vulnerable_model,
477477
sagemaker_session=kwargs.sagemaker_session,
478+
instance_type=kwargs.instance_type,
478479
)
479480

480481
if (
@@ -632,6 +633,7 @@ def _add_metric_definitions_to_kwargs(
632633
tolerate_deprecated_model=kwargs.tolerate_deprecated_model,
633634
tolerate_vulnerable_model=kwargs.tolerate_vulnerable_model,
634635
sagemaker_session=kwargs.sagemaker_session,
636+
instance_type=kwargs.instance_type,
635637
)
636638
or []
637639
)

0 commit comments

Comments
 (0)