Skip to content

Commit ccb640c

Browse files
Merge branch 'master' into curated_hub_improvements
2 parents d8b173d + b7621dc commit ccb640c

File tree

97 files changed

+8203
-801
lines changed

Some content is hidden

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

97 files changed

+8203
-801
lines changed

CHANGELOG.md

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

3+
## v2.225.0 (2024-07-10)
4+
5+
### Features
6+
7+
* model optimization
8+
9+
### Bug Fixes and Other Changes
10+
11+
* fix integ test
12+
* update uris for v1.1.1
13+
* update image_uri_configs 07-04-2024 07:17:24 PST
14+
15+
## v2.224.4 (2024-07-04)
16+
17+
### Bug Fixes and Other Changes
18+
19+
* allow for inf spec and server override to be passed
20+
21+
## v2.224.3 (2024-07-03)
22+
23+
### Bug Fixes and Other Changes
24+
25+
* Upgrade local dependencies
26+
* Improve docstrings for estimator tags
27+
328
## v2.224.2 (2024-06-27)
429

530
### Bug Fixes and Other Changes

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.224.3.dev0
1+
2.225.1.dev0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
urllib3>=1.26.8,<3.0.0
2-
docker>=5.0.2,<7.0.0
2+
docker>=5.0.2,<8.0.0
33
PyYAML>=5.4.1,<7

requirements/extras/test_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ accelerate>=0.24.1,<=0.27.0
3838
schema==0.7.5
3939
tensorflow>=2.1,<=2.16
4040
mlflow>=2.12.2,<2.13
41+
huggingface_hub>=0.23.4

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def read_requirements(filename):
4949
# Declare minimal set for installation
5050
required_packages = [
5151
"attrs>=23.1.0,<24",
52-
"boto3>=1.33.3,<2.0",
52+
"boto3>=1.34.142,<2.0",
5353
"cloudpickle==2.2.1",
5454
"google-pasta",
5555
"numpy>=1.9.0,<2.0",

src/sagemaker/accept_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def retrieve_default(
8282
tolerate_deprecated_model: bool = False,
8383
sagemaker_session: Session = DEFAULT_JUMPSTART_SAGEMAKER_SESSION,
8484
model_type: JumpStartModelType = JumpStartModelType.OPEN_WEIGHTS,
85+
config_name: Optional[str] = None,
8586
) -> str:
8687
"""Retrieves the default accept type for the model matching the given arguments.
8788
@@ -105,6 +106,7 @@ def retrieve_default(
105106
object, used for SageMaker interactions. If not
106107
specified, one is created using the default AWS configuration
107108
chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
109+
config_name (Optional[str]): Name of the JumpStart Model config to apply. (Default: None).
108110
Returns:
109111
str: The default accept type to use for the model.
110112
@@ -125,4 +127,5 @@ def retrieve_default(
125127
tolerate_deprecated_model=tolerate_deprecated_model,
126128
sagemaker_session=sagemaker_session,
127129
model_type=model_type,
130+
config_name=config_name,
128131
)

src/sagemaker/content_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def retrieve_default(
8282
tolerate_deprecated_model: bool = False,
8383
sagemaker_session: Session = DEFAULT_JUMPSTART_SAGEMAKER_SESSION,
8484
model_type: JumpStartModelType = JumpStartModelType.OPEN_WEIGHTS,
85+
config_name: Optional[str] = None,
8586
) -> str:
8687
"""Retrieves the default content type for the model matching the given arguments.
8788
@@ -105,6 +106,7 @@ def retrieve_default(
105106
object, used for SageMaker interactions. If not
106107
specified, one is created using the default AWS configuration
107108
chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
109+
config_name (Optional[str]): Name of the JumpStart Model config to apply. (Default: None).
108110
Returns:
109111
str: The default content type to use for the model.
110112
@@ -125,6 +127,7 @@ def retrieve_default(
125127
tolerate_deprecated_model=tolerate_deprecated_model,
126128
sagemaker_session=sagemaker_session,
127129
model_type=model_type,
130+
config_name=config_name,
128131
)
129132

130133

src/sagemaker/deserializers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def retrieve_default(
102102
tolerate_deprecated_model: bool = False,
103103
sagemaker_session: Session = DEFAULT_JUMPSTART_SAGEMAKER_SESSION,
104104
model_type: JumpStartModelType = JumpStartModelType.OPEN_WEIGHTS,
105+
config_name: Optional[str] = None,
105106
) -> BaseDeserializer:
106107
"""Retrieves the default deserializer for the model matching the given arguments.
107108
@@ -125,6 +126,7 @@ def retrieve_default(
125126
object, used for SageMaker interactions. If not
126127
specified, one is created using the default AWS configuration
127128
chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
129+
config_name (Optional[str]): Name of the JumpStart Model config to apply. (Default: None).
128130
Returns:
129131
BaseDeserializer: The default deserializer to use for the model.
130132
@@ -146,4 +148,5 @@ def retrieve_default(
146148
tolerate_deprecated_model=tolerate_deprecated_model,
147149
sagemaker_session=sagemaker_session,
148150
model_type=model_type,
151+
config_name=config_name,
149152
)

src/sagemaker/enums.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,12 @@ class RoutingStrategy(Enum):
4040
"""The endpoint routes requests to the specific instances that have
4141
more capacity to process them.
4242
"""
43+
44+
45+
class Tag(str, Enum):
46+
"""Enum class for tag keys to apply to models."""
47+
48+
OPTIMIZATION_JOB_NAME = "sagemaker-sdk:optimization-job-name"
49+
SPECULATIVE_DRAFT_MODEL_PROVIDER = "sagemaker-sdk:speculative-draft-model-provider"
50+
FINE_TUNING_MODEL_PATH = "sagemaker-sdk:fine-tuning-model-path"
51+
FINE_TUNING_JOB_NAME = "sagemaker-sdk:fine-tuning-job-name"

src/sagemaker/environment_variables.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def retrieve_default(
3737
sagemaker_session: Session = DEFAULT_JUMPSTART_SAGEMAKER_SESSION,
3838
instance_type: Optional[str] = None,
3939
script: JumpStartScriptScope = JumpStartScriptScope.INFERENCE,
40+
config_name: Optional[str] = None,
4041
) -> Dict[str, str]:
4142
"""Retrieves the default container environment variables for the model matching the arguments.
4243
@@ -68,6 +69,7 @@ def retrieve_default(
6869
variables specific for the instance type.
6970
script (JumpStartScriptScope): The JumpStart script for which to retrieve environment
7071
variables.
72+
config_name (Optional[str]): Name of the JumpStart Model config to apply. (Default: None).
7173
Returns:
7274
dict: The variables to use for the model.
7375
@@ -91,4 +93,5 @@ def retrieve_default(
9193
sagemaker_session=sagemaker_session,
9294
instance_type=instance_type,
9395
script=script,
96+
config_name=config_name,
9497
)

src/sagemaker/huggingface/llm_utils.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"""Functions for generating ECR image URIs for pre-built SageMaker Docker images."""
1414
from __future__ import absolute_import
1515

16+
import os
1617
from typing import Optional
18+
import importlib.util
1719

1820
import urllib.request
1921
from urllib.error import HTTPError, URLError
@@ -123,3 +125,26 @@ def get_huggingface_model_metadata(model_id: str, hf_hub_token: Optional[str] =
123125
"Did not find model metadata for the following HuggingFace Model ID %s" % model_id
124126
)
125127
return hf_model_metadata_json
128+
129+
130+
def download_huggingface_model_metadata(
131+
model_id: str, model_local_path: str, hf_hub_token: Optional[str] = None
132+
) -> None:
133+
"""Downloads the HuggingFace Model snapshot via HuggingFace API.
134+
135+
Args:
136+
model_id (str): The HuggingFace Model ID
137+
model_local_path (str): The local path to save the HuggingFace Model snapshot.
138+
hf_hub_token (str): The HuggingFace Hub Token
139+
140+
Raises:
141+
ImportError: If huggingface_hub is not installed.
142+
"""
143+
if not importlib.util.find_spec("huggingface_hub"):
144+
raise ImportError("Unable to import huggingface_hub, check if huggingface_hub is installed")
145+
146+
from huggingface_hub import snapshot_download
147+
148+
os.makedirs(model_local_path, exist_ok=True)
149+
logger.info("Downloading model %s from Hugging Face Hub to %s", model_id, model_local_path)
150+
snapshot_download(repo_id=model_id, local_dir=model_local_path, token=hf_hub_token)

src/sagemaker/hyperparameters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def retrieve_default(
3737
tolerate_vulnerable_model: bool = False,
3838
tolerate_deprecated_model: bool = False,
3939
sagemaker_session: Session = DEFAULT_JUMPSTART_SAGEMAKER_SESSION,
40+
config_name: Optional[str] = None,
4041
) -> Dict[str, str]:
4142
"""Retrieves the default training hyperparameters for the model matching the given arguments.
4243
@@ -69,6 +70,7 @@ def retrieve_default(
6970
object, used for SageMaker interactions. If not
7071
specified, one is created using the default AWS configuration
7172
chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
73+
config_name (Optional[str]): Name of the JumpStart Model config to apply. (Default: None).
7274
Returns:
7375
dict: The hyperparameters to use for the model.
7476
@@ -90,6 +92,7 @@ def retrieve_default(
9092
tolerate_vulnerable_model=tolerate_vulnerable_model,
9193
tolerate_deprecated_model=tolerate_deprecated_model,
9294
sagemaker_session=sagemaker_session,
95+
config_name=config_name,
9396
)
9497

9598

src/sagemaker/image_uri_config/autogluon.json

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"0.7": "0.7.0",
1313
"0.8": "0.8.2",
1414
"1.0": "1.0.0",
15-
"1.1": "1.1.0"
15+
"1.1": "1.1.1"
1616
},
1717
"versions": {
1818
"0.3.1": {
@@ -522,6 +522,47 @@
522522
"py_versions": [
523523
"py310"
524524
]
525+
},
526+
"1.1.1": {
527+
"registries": {
528+
"af-south-1": "626614931356",
529+
"il-central-1": "780543022126",
530+
"ap-east-1": "871362719292",
531+
"ap-northeast-1": "763104351884",
532+
"ap-northeast-2": "763104351884",
533+
"ap-northeast-3": "364406365360",
534+
"ap-south-1": "763104351884",
535+
"ap-southeast-1": "763104351884",
536+
"ap-southeast-2": "763104351884",
537+
"ap-southeast-3": "907027046896",
538+
"ap-southeast-4": "457447274322",
539+
"ca-central-1": "763104351884",
540+
"eu-central-1": "763104351884",
541+
"eu-north-1": "763104351884",
542+
"eu-west-1": "763104351884",
543+
"eu-west-2": "763104351884",
544+
"eu-west-3": "763104351884",
545+
"eu-south-1": "692866216735",
546+
"me-south-1": "217643126080",
547+
"sa-east-1": "763104351884",
548+
"us-east-1": "763104351884",
549+
"us-east-2": "763104351884",
550+
"us-gov-east-1": "446045086412",
551+
"us-gov-west-1": "442386744353",
552+
"us-iso-east-1": "886529160074",
553+
"us-isob-east-1": "094389454867",
554+
"us-west-1": "763104351884",
555+
"us-west-2": "763104351884",
556+
"ca-west-1": "204538143572"
557+
},
558+
"repository": "autogluon-training",
559+
"processors": [
560+
"cpu",
561+
"gpu"
562+
],
563+
"py_versions": [
564+
"py311"
565+
]
525566
}
526567
}
527568
},
@@ -534,7 +575,7 @@
534575
"0.7": "0.7.0",
535576
"0.8": "0.8.2",
536577
"1.0": "1.0.0",
537-
"1.1": "1.1.0"
578+
"1.1": "1.1.1"
538579
},
539580
"versions": {
540581
"0.3.1": {
@@ -1073,6 +1114,49 @@
10731114
"py_versions": [
10741115
"py310"
10751116
]
1117+
},
1118+
"1.1.1": {
1119+
"registries": {
1120+
"af-south-1": "626614931356",
1121+
"il-central-1": "780543022126",
1122+
"ap-east-1": "871362719292",
1123+
"ap-northeast-1": "763104351884",
1124+
"ap-northeast-2": "763104351884",
1125+
"ap-northeast-3": "364406365360",
1126+
"ap-south-1": "763104351884",
1127+
"ap-southeast-1": "763104351884",
1128+
"ap-southeast-2": "763104351884",
1129+
"ap-southeast-3": "907027046896",
1130+
"ap-southeast-4": "457447274322",
1131+
"ca-central-1": "763104351884",
1132+
"cn-north-1": "727897471807",
1133+
"cn-northwest-1": "727897471807",
1134+
"eu-central-1": "763104351884",
1135+
"eu-north-1": "763104351884",
1136+
"eu-west-1": "763104351884",
1137+
"eu-west-2": "763104351884",
1138+
"eu-west-3": "763104351884",
1139+
"eu-south-1": "692866216735",
1140+
"me-south-1": "217643126080",
1141+
"sa-east-1": "763104351884",
1142+
"us-east-1": "763104351884",
1143+
"us-east-2": "763104351884",
1144+
"us-gov-east-1": "446045086412",
1145+
"us-gov-west-1": "442386744353",
1146+
"us-iso-east-1": "886529160074",
1147+
"us-isob-east-1": "094389454867",
1148+
"us-west-1": "763104351884",
1149+
"us-west-2": "763104351884",
1150+
"ca-west-1": "204538143572"
1151+
},
1152+
"repository": "autogluon-inference",
1153+
"processors": [
1154+
"cpu",
1155+
"gpu"
1156+
],
1157+
"py_versions": [
1158+
"py311"
1159+
]
10761160
}
10771161
}
10781162
}

src/sagemaker/image_uri_config/pytorch.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,8 @@
11071107
"1.12": "1.12.1",
11081108
"2.0": "2.0.1",
11091109
"2.1": "2.1.0",
1110-
"2.2": "2.2.1"
1110+
"2.2": "2.2.1",
1111+
"2.3": "2.3.0"
11111112
},
11121113
"versions": {
11131114
"1.12.1": {
@@ -1331,6 +1332,50 @@
13311332
"us-west-2": "763104351884"
13321333
},
13331334
"repository": "pytorch-inference-graviton"
1335+
},
1336+
"2.3.0": {
1337+
"container_version": {
1338+
"cpu": "ubuntu20.04"
1339+
},
1340+
"py_versions": [
1341+
"py311"
1342+
],
1343+
"registries": {
1344+
"af-south-1": "626614931356",
1345+
"ap-east-1": "871362719292",
1346+
"ap-northeast-1": "763104351884",
1347+
"ap-northeast-2": "763104351884",
1348+
"ap-northeast-3": "364406365360",
1349+
"ap-south-1": "763104351884",
1350+
"ap-south-2": "772153158452",
1351+
"ap-southeast-1": "763104351884",
1352+
"ap-southeast-2": "763104351884",
1353+
"ap-southeast-3": "907027046896",
1354+
"ap-southeast-4": "457447274322",
1355+
"ca-central-1": "763104351884",
1356+
"ca-west-1": "204538143572",
1357+
"cn-north-1": "727897471807",
1358+
"cn-northwest-1": "727897471807",
1359+
"eu-central-1": "763104351884",
1360+
"eu-central-2": "380420809688",
1361+
"eu-north-1": "763104351884",
1362+
"eu-south-1": "692866216735",
1363+
"eu-south-2": "503227376785",
1364+
"eu-west-1": "763104351884",
1365+
"eu-west-2": "763104351884",
1366+
"eu-west-3": "763104351884",
1367+
"il-central-1": "780543022126",
1368+
"me-central-1": "914824155844",
1369+
"me-south-1": "217643126080",
1370+
"sa-east-1": "763104351884",
1371+
"us-east-1": "763104351884",
1372+
"us-east-2": "763104351884",
1373+
"us-gov-east-1": "446045086412",
1374+
"us-gov-west-1": "442386744353",
1375+
"us-west-1": "763104351884",
1376+
"us-west-2": "763104351884"
1377+
},
1378+
"repository": "pytorch-inference-graviton"
13341379
}
13351380
}
13361381
},

0 commit comments

Comments
 (0)