Skip to content

Commit 512d897

Browse files
Merge branch 'master' into approved-mpg
2 parents 1d534f3 + 9ead9c8 commit 512d897

File tree

23 files changed

+524
-204
lines changed

23 files changed

+524
-204
lines changed

CHANGELOG.md

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

3+
## v2.242.0 (2025-03-14)
4+
5+
### Features
6+
7+
* add integ tests for training JumpStart models in private hub
8+
9+
### Bug Fixes and Other Changes
10+
11+
* Torch upgrade
12+
* Prevent RunContext overlap between test_run tests
13+
* remove s3 output location requirement from hub class init
14+
* Fixing Pytorch training python version in tests
15+
* update image_uri_configs 03-11-2025 07:18:09 PST
16+
* resolve infinite loop in _find_config on Windows systems
17+
* pipeline definition function doc update
18+
319
## v2.241.0 (2025-03-06)
420

521
### Features

VERSION

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

doc/overview.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ To train a model by using the SageMaker Python SDK, you:
3030

3131
After you train a model, you can save it, and then serve the model as an endpoint to get real-time inferences or get inferences for an entire dataset by using batch transform.
3232

33+
34+
Important Note:
35+
36+
* When using torch to load Models, it is recommended to use version torch>=2.6.0 and torchvision>=0.17.0
37+
3338
Prepare a Training script
3439
=========================
3540

src/sagemaker/huggingface/model.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def deploy(
218218
container_startup_health_check_timeout=None,
219219
inference_recommendation_id=None,
220220
explainer_config=None,
221+
update_endpoint: Optional[bool] = False,
221222
**kwargs,
222223
):
223224
"""Deploy this ``Model`` to an ``Endpoint`` and optionally return a ``Predictor``.
@@ -296,6 +297,11 @@ def deploy(
296297
would like to deploy the model and endpoint with recommended parameters.
297298
explainer_config (sagemaker.explainer.ExplainerConfig): Specifies online explainability
298299
configuration for use with Amazon SageMaker Clarify. (default: None)
300+
update_endpoint (Optional[bool]):
301+
Flag to update the model in an existing Amazon SageMaker endpoint.
302+
If True, this will deploy a new EndpointConfig to an already existing endpoint
303+
and delete resources corresponding to the previous EndpointConfig. Default: False
304+
Note: Currently this is supported for single model endpoints
299305
Raises:
300306
ValueError: If arguments combination check failed in these circumstances:
301307
- If no role is specified or
@@ -335,6 +341,7 @@ def deploy(
335341
container_startup_health_check_timeout=container_startup_health_check_timeout,
336342
inference_recommendation_id=inference_recommendation_id,
337343
explainer_config=explainer_config,
344+
update_endpoint=update_endpoint,
338345
**kwargs,
339346
)
340347

src/sagemaker/image_uri_config/pytorch.json

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585
"2.2": "2.2.0",
8686
"2.3": "2.3.0",
8787
"2.4": "2.4.0",
88-
"2.5": "2.5.1"
88+
"2.5": "2.5.1",
89+
"2.6": "2.6.0"
8990
},
9091
"versions": {
9192
"0.4.0": {
@@ -1253,6 +1254,50 @@
12531254
"us-west-2": "763104351884"
12541255
},
12551256
"repository": "pytorch-inference"
1257+
},
1258+
"2.6.0": {
1259+
"py_versions": [
1260+
"py312"
1261+
],
1262+
"registries": {
1263+
"af-south-1": "626614931356",
1264+
"ap-east-1": "871362719292",
1265+
"ap-northeast-1": "763104351884",
1266+
"ap-northeast-2": "763104351884",
1267+
"ap-northeast-3": "364406365360",
1268+
"ap-south-1": "763104351884",
1269+
"ap-south-2": "772153158452",
1270+
"ap-southeast-1": "763104351884",
1271+
"ap-southeast-2": "763104351884",
1272+
"ap-southeast-3": "907027046896",
1273+
"ap-southeast-4": "457447274322",
1274+
"ap-southeast-5": "550225433462",
1275+
"ap-southeast-7": "590183813437",
1276+
"ca-central-1": "763104351884",
1277+
"ca-west-1": "204538143572",
1278+
"cn-north-1": "727897471807",
1279+
"cn-northwest-1": "727897471807",
1280+
"eu-central-1": "763104351884",
1281+
"eu-central-2": "380420809688",
1282+
"eu-north-1": "763104351884",
1283+
"eu-south-1": "692866216735",
1284+
"eu-south-2": "503227376785",
1285+
"eu-west-1": "763104351884",
1286+
"eu-west-2": "763104351884",
1287+
"eu-west-3": "763104351884",
1288+
"il-central-1": "780543022126",
1289+
"me-central-1": "914824155844",
1290+
"me-south-1": "217643126080",
1291+
"mx-central-1": "637423239942",
1292+
"sa-east-1": "763104351884",
1293+
"us-east-1": "763104351884",
1294+
"us-east-2": "763104351884",
1295+
"us-gov-east-1": "446045086412",
1296+
"us-gov-west-1": "442386744353",
1297+
"us-west-1": "763104351884",
1298+
"us-west-2": "763104351884"
1299+
},
1300+
"repository": "pytorch-inference"
12561301
}
12571302
}
12581303
},
@@ -1628,7 +1673,8 @@
16281673
"2.2": "2.2.0",
16291674
"2.3": "2.3.0",
16301675
"2.4": "2.4.0",
1631-
"2.5": "2.5.1"
1676+
"2.5": "2.5.1",
1677+
"2.6": "2.6.0"
16321678
},
16331679
"versions": {
16341680
"0.4.0": {
@@ -2801,6 +2847,50 @@
28012847
"us-west-2": "763104351884"
28022848
},
28032849
"repository": "pytorch-training"
2850+
},
2851+
"2.6.0": {
2852+
"py_versions": [
2853+
"py312"
2854+
],
2855+
"registries": {
2856+
"af-south-1": "626614931356",
2857+
"ap-east-1": "871362719292",
2858+
"ap-northeast-1": "763104351884",
2859+
"ap-northeast-2": "763104351884",
2860+
"ap-northeast-3": "364406365360",
2861+
"ap-south-1": "763104351884",
2862+
"ap-south-2": "772153158452",
2863+
"ap-southeast-1": "763104351884",
2864+
"ap-southeast-2": "763104351884",
2865+
"ap-southeast-3": "907027046896",
2866+
"ap-southeast-4": "457447274322",
2867+
"ap-southeast-5": "550225433462",
2868+
"ap-southeast-7": "590183813437",
2869+
"ca-central-1": "763104351884",
2870+
"ca-west-1": "204538143572",
2871+
"cn-north-1": "727897471807",
2872+
"cn-northwest-1": "727897471807",
2873+
"eu-central-1": "763104351884",
2874+
"eu-central-2": "380420809688",
2875+
"eu-north-1": "763104351884",
2876+
"eu-south-1": "692866216735",
2877+
"eu-south-2": "503227376785",
2878+
"eu-west-1": "763104351884",
2879+
"eu-west-2": "763104351884",
2880+
"eu-west-3": "763104351884",
2881+
"il-central-1": "780543022126",
2882+
"me-central-1": "914824155844",
2883+
"me-south-1": "217643126080",
2884+
"mx-central-1": "637423239942",
2885+
"sa-east-1": "763104351884",
2886+
"us-east-1": "763104351884",
2887+
"us-east-2": "763104351884",
2888+
"us-gov-east-1": "446045086412",
2889+
"us-gov-west-1": "442386744353",
2890+
"us-west-1": "763104351884",
2891+
"us-west-2": "763104351884"
2892+
},
2893+
"repository": "pytorch-training"
28042894
}
28052895
}
28062896
}

src/sagemaker/jumpstart/constants.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@
8181
gated_content_bucket="jumpstart-private-cache-prod-eu-north-1",
8282
neo_content_bucket="sagemaker-sd-models-prod-eu-north-1",
8383
),
84+
JumpStartLaunchedRegionInfo(
85+
region_name="eu-south-2",
86+
content_bucket="jumpstart-cache-prod-eu-south-2",
87+
gated_content_bucket="jumpstart-private-cache-prod-eu-south-2",
88+
neo_content_bucket="sagemaker-sd-models-prod-eu-south-2",
89+
),
8490
JumpStartLaunchedRegionInfo(
8591
region_name="me-south-1",
8692
content_bucket="jumpstart-cache-prod-me-south-1",
@@ -97,6 +103,12 @@
97103
gated_content_bucket="jumpstart-private-cache-prod-ap-south-1",
98104
neo_content_bucket="sagemaker-sd-models-prod-ap-south-1",
99105
),
106+
JumpStartLaunchedRegionInfo(
107+
region_name="ap-south-2",
108+
content_bucket="jumpstart-cache-prod-ap-south-2",
109+
gated_content_bucket="jumpstart-private-cache-prod-ap-south-2",
110+
neo_content_bucket="sagemaker-sd-models-prod-ap-south-2",
111+
),
100112
JumpStartLaunchedRegionInfo(
101113
region_name="eu-west-3",
102114
content_bucket="jumpstart-cache-prod-eu-west-3",
@@ -137,6 +149,12 @@
137149
gated_content_bucket="jumpstart-private-cache-prod-ap-southeast-3",
138150
neo_content_bucket="sagemaker-sd-models-prod-ap-southeast-3",
139151
),
152+
JumpStartLaunchedRegionInfo(
153+
region_name="ap-southeast-4",
154+
content_bucket="jumpstart-cache-prod-ap-southeast-4",
155+
gated_content_bucket="jumpstart-private-cache-prod-ap-southeast-4",
156+
neo_content_bucket="sagemaker-sd-models-prod-ap-southeast-4",
157+
),
140158
JumpStartLaunchedRegionInfo(
141159
region_name="ap-southeast-5",
142160
content_bucket="jumpstart-cache-prod-ap-southeast-5",
@@ -188,6 +206,12 @@
188206
gated_content_bucket="jumpstart-private-cache-prod-ca-central-1",
189207
neo_content_bucket="sagemaker-sd-models-prod-ca-central-1",
190208
),
209+
JumpStartLaunchedRegionInfo(
210+
region_name="ca-west-1",
211+
content_bucket="jumpstart-cache-prod-ca-west-1",
212+
gated_content_bucket="jumpstart-private-cache-prod-ca-west-1",
213+
neo_content_bucket="sagemaker-sd-models-prod-ca-west-1",
214+
),
191215
JumpStartLaunchedRegionInfo(
192216
region_name="cn-north-1",
193217
content_bucket="jumpstart-cache-prod-cn-north-1",

src/sagemaker/jumpstart/hub/hub.py

Lines changed: 16 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,25 @@
1616
from datetime import datetime
1717
import logging
1818
from typing import Optional, Dict, List, Any, Union
19-
from botocore import exceptions
2019

2120
from sagemaker.jumpstart.constants import JUMPSTART_MODEL_HUB_NAME
2221
from sagemaker.jumpstart.enums import JumpStartScriptScope
2322
from sagemaker.session import Session
2423

25-
from sagemaker.jumpstart.constants import (
26-
JUMPSTART_LOGGER,
27-
)
2824
from sagemaker.jumpstart.types import (
2925
HubContentType,
3026
)
3127
from sagemaker.jumpstart.filters import Constant, Operator, BooleanValues
3228
from sagemaker.jumpstart.hub.utils import (
3329
get_hub_model_version,
3430
get_info_from_hub_resource_arn,
35-
create_hub_bucket_if_it_does_not_exist,
36-
generate_default_hub_bucket_name,
37-
create_s3_object_reference_from_uri,
3831
construct_hub_arn_from_name,
3932
)
4033

4134
from sagemaker.jumpstart.notebook_utils import (
4235
list_jumpstart_models,
4336
)
4437

45-
from sagemaker.jumpstart.hub.types import (
46-
S3ObjectLocation,
47-
)
4838
from sagemaker.jumpstart.hub.interfaces import (
4939
DescribeHubResponse,
5040
DescribeHubContentResponse,
@@ -66,8 +56,8 @@ class Hub:
6656
def __init__(
6757
self,
6858
hub_name: str,
59+
sagemaker_session: Session,
6960
bucket_name: Optional[str] = None,
70-
sagemaker_session: Optional[Session] = None,
7161
) -> None:
7262
"""Instantiates a SageMaker ``Hub``.
7363
@@ -78,41 +68,11 @@ def __init__(
7868
"""
7969
self.hub_name = hub_name
8070
self.region = sagemaker_session.boto_region_name
71+
self.bucket_name = bucket_name
8172
self._sagemaker_session = (
8273
sagemaker_session
8374
or utils.get_default_jumpstart_session_with_user_agent_suffix(is_hub_content=True)
8475
)
85-
self.hub_storage_location = self._generate_hub_storage_location(bucket_name)
86-
87-
def _fetch_hub_bucket_name(self) -> str:
88-
"""Retrieves hub bucket name from Hub config if exists"""
89-
try:
90-
hub_response = self._sagemaker_session.describe_hub(hub_name=self.hub_name)
91-
hub_output_location = hub_response["S3StorageConfig"].get("S3OutputPath")
92-
if hub_output_location:
93-
location = create_s3_object_reference_from_uri(hub_output_location)
94-
return location.bucket
95-
default_bucket_name = generate_default_hub_bucket_name(self._sagemaker_session)
96-
JUMPSTART_LOGGER.warning(
97-
"There is not a Hub bucket associated with %s. Using %s",
98-
self.hub_name,
99-
default_bucket_name,
100-
)
101-
return default_bucket_name
102-
except exceptions.ClientError:
103-
hub_bucket_name = generate_default_hub_bucket_name(self._sagemaker_session)
104-
JUMPSTART_LOGGER.warning(
105-
"There is not a Hub bucket associated with %s. Using %s",
106-
self.hub_name,
107-
hub_bucket_name,
108-
)
109-
return hub_bucket_name
110-
111-
def _generate_hub_storage_location(self, bucket_name: Optional[str] = None) -> None:
112-
"""Generates an ``S3ObjectLocation`` given a Hub name."""
113-
hub_bucket_name = bucket_name or self._fetch_hub_bucket_name()
114-
curr_timestamp = datetime.now().timestamp()
115-
return S3ObjectLocation(bucket=hub_bucket_name, key=f"{self.hub_name}-{curr_timestamp}")
11676

11777
def _get_latest_model_version(self, model_id: str) -> str:
11878
"""Populates the lastest version of a model from specs no matter what is passed.
@@ -132,19 +92,22 @@ def create(
13292
tags: Optional[str] = None,
13393
) -> Dict[str, str]:
13494
"""Creates a hub with the given description"""
95+
curr_timestamp = datetime.now().timestamp()
13596

136-
create_hub_bucket_if_it_does_not_exist(
137-
self.hub_storage_location.bucket, self._sagemaker_session
138-
)
97+
request = {
98+
"hub_name": self.hub_name,
99+
"hub_description": description,
100+
"hub_display_name": display_name,
101+
"hub_search_keywords": search_keywords,
102+
"tags": tags,
103+
}
139104

140-
return self._sagemaker_session.create_hub(
141-
hub_name=self.hub_name,
142-
hub_description=description,
143-
hub_display_name=display_name,
144-
hub_search_keywords=search_keywords,
145-
s3_storage_config={"S3OutputPath": self.hub_storage_location.get_uri()},
146-
tags=tags,
147-
)
105+
if self.bucket_name:
106+
request["s3_storage_config"] = {
107+
"S3OutputPath": (f"s3://{self.bucket_name}/{self.hub_name}-{curr_timestamp}")
108+
}
109+
110+
return self._sagemaker_session.create_hub(**request)
148111

149112
def describe(self, hub_name: Optional[str] = None) -> DescribeHubResponse:
150113
"""Returns descriptive information about the Hub"""

0 commit comments

Comments
 (0)