Skip to content

Commit b1eaa02

Browse files
authored
Merge branch 'master' into 2PR
2 parents 31a05b0 + 5158749 commit b1eaa02

14 files changed

+508
-66
lines changed

CHANGELOG.md

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

3+
## v2.210.0 (2024-02-28)
4+
5+
### Features
6+
7+
* Prepend SageMaker Studio App Type to boto3 User Agent string
8+
* TGI optimum 0.0.18 (general+llm)
9+
* TGI 1.4.2
10+
11+
### Bug Fixes and Other Changes
12+
13+
* tolerate vulnerable old model for integ test and temporarily skip test_list_jumpstart_models_script_filter
14+
* add missing regions to pytorch config
15+
* Add validation for sagemaker version on remote job
16+
* fixed implementation of fail_on_violation for transform with monitoring
17+
318
## v2.209.0 (2024-02-24)
419

520
### Features

VERSION

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

src/sagemaker/image_uri_config/huggingface-llm-neuronx.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,35 @@
6464
"container_version": {
6565
"inf2": "ubuntu22.04"
6666
}
67+
},
68+
"0.0.18": {
69+
"py_versions": [
70+
"py310"
71+
],
72+
"registries": {
73+
"ap-northeast-1": "763104351884",
74+
"ap-south-1": "763104351884",
75+
"ap-south-2": "772153158452",
76+
"ap-southeast-1": "763104351884",
77+
"ap-southeast-2": "763104351884",
78+
"ap-southeast-4": "457447274322",
79+
"eu-central-1": "763104351884",
80+
"eu-central-2": "380420809688",
81+
"eu-south-2": "503227376785",
82+
"eu-west-1": "763104351884",
83+
"eu-west-3": "763104351884",
84+
"il-central-1": "780543022126",
85+
"sa-east-1": "763104351884",
86+
"us-east-1": "763104351884",
87+
"us-east-2": "763104351884",
88+
"us-west-2": "763104351884",
89+
"ca-west-1": "204538143572"
90+
},
91+
"tag_prefix": "1.13.1-optimum0.0.18",
92+
"repository": "huggingface-pytorch-tgi-inference",
93+
"container_version": {
94+
"inf2": "ubuntu22.04"
95+
}
6796
}
6897
}
6998
}

src/sagemaker/image_uri_config/huggingface-llm.json

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"1.1": "1.1.0",
1212
"1.2": "1.2.0",
1313
"1.3": "1.3.3",
14-
"1.4": "1.4.0"
14+
"1.4": "1.4.2"
1515
},
1616
"versions": {
1717
"0.6.0": {
@@ -436,6 +436,53 @@
436436
"container_version": {
437437
"gpu": "cu121-ubuntu20.04"
438438
}
439+
},
440+
"1.4.2": {
441+
"py_versions": [
442+
"py310"
443+
],
444+
"registries": {
445+
"af-south-1": "626614931356",
446+
"il-central-1": "780543022126",
447+
"ap-east-1": "871362719292",
448+
"ap-northeast-1": "763104351884",
449+
"ap-northeast-2": "763104351884",
450+
"ap-northeast-3": "364406365360",
451+
"ap-south-1": "763104351884",
452+
"ap-south-2": "772153158452",
453+
"ap-southeast-1": "763104351884",
454+
"ap-southeast-2": "763104351884",
455+
"ap-southeast-3": "907027046896",
456+
"ap-southeast-4": "457447274322",
457+
"ca-central-1": "763104351884",
458+
"cn-north-1": "727897471807",
459+
"cn-northwest-1": "727897471807",
460+
"eu-central-1": "763104351884",
461+
"eu-central-2": "380420809688",
462+
"eu-north-1": "763104351884",
463+
"eu-west-1": "763104351884",
464+
"eu-west-2": "763104351884",
465+
"eu-west-3": "763104351884",
466+
"eu-south-1": "692866216735",
467+
"eu-south-2": "503227376785",
468+
"me-south-1": "217643126080",
469+
"me-central-1": "914824155844",
470+
"sa-east-1": "763104351884",
471+
"us-east-1": "763104351884",
472+
"us-east-2": "763104351884",
473+
"us-gov-east-1": "446045086412",
474+
"us-gov-west-1": "442386744353",
475+
"us-iso-east-1": "886529160074",
476+
"us-isob-east-1": "094389454867",
477+
"us-west-1": "763104351884",
478+
"us-west-2": "763104351884",
479+
"ca-west-1": "204538143572"
480+
},
481+
"tag_prefix": "2.1.1-tgi1.4.2",
482+
"repository": "huggingface-pytorch-tgi-inference",
483+
"container_version": {
484+
"gpu": "cu121-ubuntu22.04"
485+
}
439486
}
440487
}
441488
}

src/sagemaker/image_uri_config/huggingface-neuronx.json

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"trn"
55
],
66
"version_aliases": {
7-
"4.28": "4.28.1"
7+
"4.28": "4.28.1",
8+
"4.34": "4.34.1"
89
},
910
"versions": {
1011
"4.28.1": {
@@ -86,7 +87,9 @@
8687
"inf"
8788
],
8889
"version_aliases": {
89-
"4.28": "4.28.1"
90+
"4.28": "4.28.1",
91+
"4.34": "4.34.1",
92+
"4.36": "4.36.2"
9093
},
9194
"versions": {
9295
"4.28.1": {
@@ -192,6 +195,58 @@
192195
"sdk2.15.0"
193196
]
194197
}
198+
},
199+
"4.36.2": {
200+
"version_aliases": {
201+
"pytorch1.13": "pytorch1.13.1"
202+
},
203+
"pytorch1.13.1": {
204+
"py_versions": [
205+
"py310"
206+
],
207+
"repository": "huggingface-pytorch-inference-neuronx",
208+
"registries": {
209+
"af-south-1": "626614931356",
210+
"il-central-1": "780543022126",
211+
"ap-east-1": "871362719292",
212+
"ap-northeast-1": "763104351884",
213+
"ap-northeast-2": "763104351884",
214+
"ap-northeast-3": "364406365360",
215+
"ap-south-1": "763104351884",
216+
"ap-south-2": "772153158452",
217+
"ap-southeast-1": "763104351884",
218+
"ap-southeast-2": "763104351884",
219+
"ap-southeast-4": "457447274322",
220+
"ca-central-1": "763104351884",
221+
"cn-north-1": "727897471807",
222+
"cn-northwest-1": "727897471807",
223+
"eu-central-1": "763104351884",
224+
"eu-central-2": "380420809688",
225+
"eu-north-1": "763104351884",
226+
"eu-west-1": "763104351884",
227+
"eu-west-2": "763104351884",
228+
"eu-west-3": "763104351884",
229+
"eu-south-1": "692866216735",
230+
"eu-south-2": "503227376785",
231+
"me-south-1": "217643126080",
232+
"sa-east-1": "763104351884",
233+
"us-east-1": "763104351884",
234+
"us-east-2": "763104351884",
235+
"us-gov-east-1": "446045086412",
236+
"us-gov-west-1": "442386744353",
237+
"us-iso-east-1": "886529160074",
238+
"us-isob-east-1": "094389454867",
239+
"us-west-1": "763104351884",
240+
"us-west-2": "763104351884",
241+
"ca-west-1": "204538143572"
242+
},
243+
"container_version": {
244+
"inf": "ubuntu20.04"
245+
},
246+
"sdk_versions": [
247+
"sdk2.16.1"
248+
]
249+
}
195250
}
196251
}
197252
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"processors": [
3+
"cpu",
4+
"gpu"
5+
],
6+
"scope": [
7+
"inference"
8+
],
9+
"versions": {
10+
"23.12": {
11+
"registries": {
12+
"af-south-1": "626614931356",
13+
"il-central-1": "780543022126",
14+
"ap-east-1": "871362719292",
15+
"ap-northeast-1": "763104351884",
16+
"ap-northeast-2": "763104351884",
17+
"ap-northeast-3": "364406365360",
18+
"ap-south-1": "763104351884",
19+
"ap-southeast-1": "763104351884",
20+
"ap-southeast-2": "763104351884",
21+
"ap-southeast-3": "907027046896",
22+
"ca-central-1": "763104351884",
23+
"cn-north-1": "727897471807",
24+
"cn-northwest-1": "727897471807",
25+
"eu-central-1": "763104351884",
26+
"eu-north-1": "763104351884",
27+
"eu-west-1": "763104351884",
28+
"eu-west-2": "763104351884",
29+
"eu-west-3": "763104351884",
30+
"eu-south-1": "692866216735",
31+
"me-south-1": "217643126080",
32+
"sa-east-1": "763104351884",
33+
"us-east-1": "763104351884",
34+
"us-east-2": "763104351884",
35+
"us-west-1": "763104351884",
36+
"us-west-2": "763104351884",
37+
"ca-west-1": "204538143572"
38+
},
39+
"repository": "sagemaker-tritonserver",
40+
"tag_prefix": "23.12-py3"
41+
},
42+
"24.01": {
43+
"registries": {
44+
"af-south-1": "626614931356",
45+
"il-central-1": "780543022126",
46+
"ap-east-1": "871362719292",
47+
"ap-northeast-1": "763104351884",
48+
"ap-northeast-2": "763104351884",
49+
"ap-northeast-3": "364406365360",
50+
"ap-south-1": "763104351884",
51+
"ap-southeast-1": "763104351884",
52+
"ap-southeast-2": "763104351884",
53+
"ap-southeast-3": "907027046896",
54+
"ca-central-1": "763104351884",
55+
"cn-north-1": "727897471807",
56+
"cn-northwest-1": "727897471807",
57+
"eu-central-1": "763104351884",
58+
"eu-north-1": "763104351884",
59+
"eu-west-1": "763104351884",
60+
"eu-west-2": "763104351884",
61+
"eu-west-3": "763104351884",
62+
"eu-south-1": "692866216735",
63+
"me-south-1": "217643126080",
64+
"sa-east-1": "763104351884",
65+
"us-east-1": "763104351884",
66+
"us-east-2": "763104351884",
67+
"us-west-1": "763104351884",
68+
"us-west-2": "763104351884",
69+
"ca-west-1": "204538143572"
70+
},
71+
"repository": "sagemaker-tritonserver",
72+
"tag_prefix": "24.01-py3"
73+
}
74+
}
75+
}

src/sagemaker/image_uris.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
INFERENCE_GRAVITON = "inference_graviton"
4545
DATA_WRANGLER_FRAMEWORK = "data-wrangler"
4646
STABILITYAI_FRAMEWORK = "stabilityai"
47+
SAGEMAKER_TRITONSERVER_FRAMEWORK = "sagemaker-tritonserver"
4748

4849

4950
@override_pipeline_parameter_var
@@ -335,6 +336,11 @@ def _get_image_tag(
335336
if key in container_versions:
336337
tag = "-".join([tag, container_versions[key]])
337338

339+
# Triton images don't have a trailing -gpu tag. Only -cpu images do.
340+
if framework == SAGEMAKER_TRITONSERVER_FRAMEWORK:
341+
if processor == "gpu":
342+
tag = tag.rstrip("-gpu")
343+
338344
return tag
339345

340346

src/sagemaker/user_agent.py

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,18 @@
1515

1616
import platform
1717
import sys
18+
import json
19+
import os
1820

1921
import importlib_metadata
2022

23+
SDK_PREFIX = "AWS-SageMaker-Python-SDK"
24+
STUDIO_PREFIX = "AWS-SageMaker-Studio"
25+
NOTEBOOK_PREFIX = "AWS-SageMaker-Notebook-Instance"
26+
27+
NOTEBOOK_METADATA_FILE = "/etc/opt/ml/sagemaker-notebook-instance-version.txt"
28+
STUDIO_METADATA_FILE = "/opt/ml/metadata/resource-metadata.json"
29+
2130
SDK_VERSION = importlib_metadata.version("sagemaker")
2231
OS_NAME = platform.system() or "UnresolvedOS"
2332
OS_VERSION = platform.release() or "UnresolvedOSVersion"
@@ -27,30 +36,69 @@
2736
)
2837

2938

39+
def process_notebook_metadata_file():
40+
"""Check if the platform is SageMaker Notebook, if yes, return the InstanceType
41+
42+
Returns:
43+
str: The InstanceType of the SageMaker Notebook if it exists, otherwise None
44+
"""
45+
if os.path.exists(NOTEBOOK_METADATA_FILE):
46+
with open(NOTEBOOK_METADATA_FILE, "r") as sagemaker_nbi_file:
47+
return sagemaker_nbi_file.read().strip()
48+
49+
return None
50+
51+
52+
def process_studio_metadata_file():
53+
"""Check if the platform is SageMaker Studio, if yes, return the AppType
54+
55+
Returns:
56+
str: The AppType of the SageMaker Studio if it exists, otherwise None
57+
"""
58+
if os.path.exists(STUDIO_METADATA_FILE):
59+
with open(STUDIO_METADATA_FILE, "r") as sagemaker_studio_file:
60+
metadata = json.load(sagemaker_studio_file)
61+
return metadata.get("AppType")
62+
63+
return None
64+
65+
3066
def determine_prefix(user_agent=""):
31-
"""Placeholder docstring"""
32-
prefix = "AWS-SageMaker-Python-SDK/{}".format(SDK_VERSION)
67+
"""Determines the prefix for the user agent string.
68+
69+
Args:
70+
user_agent (str): The user agent string to prepend the prefix to.
71+
72+
Returns:
73+
str: The user agent string with the prefix prepended.
74+
"""
75+
prefix = "{}/{}".format(SDK_PREFIX, SDK_VERSION)
3376

3477
if PYTHON_VERSION not in user_agent:
3578
prefix = "{} {}".format(prefix, PYTHON_VERSION)
3679

3780
if OS_NAME_VERSION not in user_agent:
3881
prefix = "{} {}".format(prefix, OS_NAME_VERSION)
3982

40-
try:
41-
with open("/etc/opt/ml/sagemaker-notebook-instance-version.txt") as sagemaker_nbi_file:
42-
prefix = "{} AWS-SageMaker-Notebook-Instance/{}".format(
43-
prefix, sagemaker_nbi_file.read().strip()
44-
)
45-
except IOError:
46-
# This file isn't expected to always exist, and we DO want to silently ignore failures.
47-
pass
83+
# Get the notebook instance type and prepend it to the user agent string if exists
84+
notebook_instance_type = process_notebook_metadata_file()
85+
if notebook_instance_type:
86+
prefix = "{} {}/{}".format(prefix, NOTEBOOK_PREFIX, notebook_instance_type)
87+
88+
# Get the studio app type and prepend it to the user agent string if exists
89+
studio_app_type = process_studio_metadata_file()
90+
if studio_app_type:
91+
prefix = "{} {}/{}".format(prefix, STUDIO_PREFIX, studio_app_type)
4892

4993
return prefix
5094

5195

5296
def prepend_user_agent(client):
53-
"""Placeholder docstring"""
97+
"""Prepends the user agent string with the SageMaker Python SDK version.
98+
99+
Args:
100+
client (botocore.client.BaseClient): The client to prepend the user agent string for.
101+
"""
54102
prefix = determine_prefix(client._client_config.user_agent)
55103

56104
if client._client_config.user_agent is None:

0 commit comments

Comments
 (0)