Skip to content

Commit ef6afc9

Browse files
authored
Merge branch 'master' into dependabot/pip/tests/data/serve_resources/mlflow/pytorch/mlflow-2.20.3
2 parents f19aa8e + 9ba3997 commit ef6afc9

22 files changed

+1315
-69
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v2.243.3 (2025-04-23)
4+
5+
### Bug Fixes and Other Changes
6+
7+
* update readme to reflect py312 upgrade
8+
* Revert the PR changes 5122
9+
* Py312 upgrade step 2: Update dependencies, integ tests and unit tests
10+
* update pr test to deprecate py38 and add py312
11+
* update image_uri_configs 04-16-2025 07:18:18 PST
12+
* update image_uri_configs 04-15-2025 07:18:10 PST
13+
* update image_uri_configs 04-11-2025 07:18:19 PST
14+
315
## v2.243.2 (2025-04-16)
416

517
### Bug Fixes and Other Changes

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.243.3.dev0
1+
2.243.4.dev0

src/sagemaker/image_uri_config/huggingface.json

+151-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"4.26": "4.26.0",
1515
"4.28": "4.28.1",
1616
"4.36": "4.36.0",
17-
"4.46": "4.46.1"
17+
"4.46": "4.46.1",
18+
"4.48": "4.48.0",
19+
"4.49": "4.49.0"
1820
},
1921
"versions": {
2022
"4.4.2": {
@@ -1066,6 +1068,100 @@
10661068
"gpu": "cu121-ubuntu20.04"
10671069
}
10681070
}
1071+
},
1072+
"4.48.0": {
1073+
"version_aliases": {
1074+
"pytorch2.3": "pytorch2.3.0"
1075+
},
1076+
"pytorch2.3.0": {
1077+
"py_versions": [
1078+
"py311"
1079+
],
1080+
"registries": {
1081+
"af-south-1": "626614931356",
1082+
"il-central-1": "780543022126",
1083+
"ap-east-1": "871362719292",
1084+
"ap-northeast-1": "763104351884",
1085+
"ap-northeast-2": "763104351884",
1086+
"ap-northeast-3": "364406365360",
1087+
"ap-south-1": "763104351884",
1088+
"ap-southeast-1": "763104351884",
1089+
"ap-southeast-2": "763104351884",
1090+
"ap-southeast-3": "907027046896",
1091+
"ca-central-1": "763104351884",
1092+
"cn-north-1": "727897471807",
1093+
"cn-northwest-1": "727897471807",
1094+
"eu-central-1": "763104351884",
1095+
"eu-north-1": "763104351884",
1096+
"eu-west-1": "763104351884",
1097+
"eu-west-2": "763104351884",
1098+
"eu-west-3": "763104351884",
1099+
"eu-south-1": "692866216735",
1100+
"me-south-1": "217643126080",
1101+
"me-central-1": "914824155844",
1102+
"sa-east-1": "763104351884",
1103+
"us-east-1": "763104351884",
1104+
"us-east-2": "763104351884",
1105+
"us-gov-east-1": "446045086412",
1106+
"us-gov-west-1": "442386744353",
1107+
"us-iso-east-1": "886529160074",
1108+
"us-isob-east-1": "094389454867",
1109+
"us-west-1": "763104351884",
1110+
"us-west-2": "763104351884",
1111+
"ca-west-1": "204538143572"
1112+
},
1113+
"repository": "huggingface-pytorch-training",
1114+
"container_version": {
1115+
"gpu": "cu121-ubuntu20.04"
1116+
}
1117+
}
1118+
},
1119+
"4.49.0": {
1120+
"version_aliases": {
1121+
"pytorch2.5": "pytorch2.5.1"
1122+
},
1123+
"pytorch2.5.1": {
1124+
"py_versions": [
1125+
"py311"
1126+
],
1127+
"registries": {
1128+
"af-south-1": "626614931356",
1129+
"il-central-1": "780543022126",
1130+
"ap-east-1": "871362719292",
1131+
"ap-northeast-1": "763104351884",
1132+
"ap-northeast-2": "763104351884",
1133+
"ap-northeast-3": "364406365360",
1134+
"ap-south-1": "763104351884",
1135+
"ap-southeast-1": "763104351884",
1136+
"ap-southeast-2": "763104351884",
1137+
"ap-southeast-3": "907027046896",
1138+
"ca-central-1": "763104351884",
1139+
"cn-north-1": "727897471807",
1140+
"cn-northwest-1": "727897471807",
1141+
"eu-central-1": "763104351884",
1142+
"eu-north-1": "763104351884",
1143+
"eu-west-1": "763104351884",
1144+
"eu-west-2": "763104351884",
1145+
"eu-west-3": "763104351884",
1146+
"eu-south-1": "692866216735",
1147+
"me-south-1": "217643126080",
1148+
"me-central-1": "914824155844",
1149+
"sa-east-1": "763104351884",
1150+
"us-east-1": "763104351884",
1151+
"us-east-2": "763104351884",
1152+
"us-gov-east-1": "446045086412",
1153+
"us-gov-west-1": "442386744353",
1154+
"us-iso-east-1": "886529160074",
1155+
"us-isob-east-1": "094389454867",
1156+
"us-west-1": "763104351884",
1157+
"us-west-2": "763104351884",
1158+
"ca-west-1": "204538143572"
1159+
},
1160+
"repository": "huggingface-pytorch-training",
1161+
"container_version": {
1162+
"gpu": "cu124-ubuntu22.04"
1163+
}
1164+
}
10691165
}
10701166
}
10711167
},
@@ -1082,7 +1178,8 @@
10821178
"4.17": "4.17.0",
10831179
"4.26": "4.26.0",
10841180
"4.28": "4.28.1",
1085-
"4.37": "4.37.0"
1181+
"4.37": "4.37.0",
1182+
"4.49": "4.49.0"
10861183
},
10871184
"versions": {
10881185
"4.6.1": {
@@ -1983,6 +2080,58 @@
19832080
"cpu": "ubuntu22.04"
19842081
}
19852082
}
2083+
},
2084+
"4.49.0": {
2085+
"version_aliases": {
2086+
"pytorch2.6": "pytorch2.6.0"
2087+
},
2088+
"pytorch2.6.0": {
2089+
"py_versions": [
2090+
"py312"
2091+
],
2092+
"registries": {
2093+
"af-south-1": "626614931356",
2094+
"il-central-1": "780543022126",
2095+
"ap-east-1": "871362719292",
2096+
"ap-northeast-1": "763104351884",
2097+
"ap-northeast-2": "763104351884",
2098+
"ap-northeast-3": "364406365360",
2099+
"ap-south-1": "763104351884",
2100+
"ap-south-2": "772153158452",
2101+
"ap-southeast-1": "763104351884",
2102+
"ap-southeast-2": "763104351884",
2103+
"ap-southeast-3": "907027046896",
2104+
"ap-southeast-4": "457447274322",
2105+
"ca-central-1": "763104351884",
2106+
"cn-north-1": "727897471807",
2107+
"cn-northwest-1": "727897471807",
2108+
"eu-central-1": "763104351884",
2109+
"eu-central-2": "380420809688",
2110+
"eu-north-1": "763104351884",
2111+
"eu-west-1": "763104351884",
2112+
"eu-west-2": "763104351884",
2113+
"eu-west-3": "763104351884",
2114+
"eu-south-1": "692866216735",
2115+
"eu-south-2": "503227376785",
2116+
"me-south-1": "217643126080",
2117+
"me-central-1": "914824155844",
2118+
"sa-east-1": "763104351884",
2119+
"us-east-1": "763104351884",
2120+
"us-east-2": "763104351884",
2121+
"us-gov-east-1": "446045086412",
2122+
"us-gov-west-1": "442386744353",
2123+
"us-iso-east-1": "886529160074",
2124+
"us-isob-east-1": "094389454867",
2125+
"us-west-1": "763104351884",
2126+
"us-west-2": "763104351884",
2127+
"ca-west-1": "204538143572"
2128+
},
2129+
"repository": "huggingface-pytorch-inference",
2130+
"container_version": {
2131+
"gpu": "cu124-ubuntu22.04",
2132+
"cpu": "ubuntu22.04"
2133+
}
2134+
}
19862135
}
19872136
}
19882137
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"processors": ["cpu", "gpu"],
3+
"scope": ["inference"],
4+
"version_aliases": {
5+
"3.0": "3.0.0"
6+
},
7+
"versions": {
8+
"3.0.0": {
9+
"registries": {
10+
"us-east-1": "885854791233",
11+
"us-east-2": "137914896644",
12+
"us-west-1": "053634841547",
13+
"us-west-2": "542918446943",
14+
"af-south-1": "238384257742",
15+
"ap-east-1": "523751269255",
16+
"ap-south-1": "245090515133",
17+
"ap-northeast-2": "064688005998",
18+
"ap-southeast-1": "022667117163",
19+
"ap-southeast-2": "648430277019",
20+
"ap-northeast-1": "010972774902",
21+
"ca-central-1": "481561238223",
22+
"eu-central-1": "545423591354",
23+
"eu-west-1": "819792524951",
24+
"eu-west-2": "021081402939",
25+
"eu-west-3": "856416204555",
26+
"eu-north-1": "175620155138",
27+
"eu-south-1": "810671768855",
28+
"sa-east-1": "567556641782",
29+
"ap-northeast-3": "564864627153",
30+
"ap-southeast-3": "370607712162",
31+
"me-south-1": "523774347010",
32+
"me-central-1": "358593528301"
33+
},
34+
"repository": "sagemaker-distribution-prod"
35+
}
36+
}
37+
}

src/sagemaker/modules/configs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class SourceCode(BaseConfig):
8888
8989
Parameters:
9090
source_dir (Optional[str]):
91-
The local directory containing the source code to be used in the training job container.
91+
The local directory, s3 uri, or path to tar.gz file stored locally or in s3 that contains
92+
the source code to be used in the training job container.
9293
requirements (Optional[str]):
9394
The path within ``source_dir`` to a ``requirements.txt`` file. If specified, the listed
9495
requirements will be installed in the training job container.

src/sagemaker/modules/train/model_trainer.py

+43-21
Original file line numberDiff line numberDiff line change
@@ -407,28 +407,45 @@ def _validate_source_code(self, source_code: Optional[SourceCode]):
407407
"If 'requirements' or 'entry_script' is provided in 'source_code', "
408408
+ "'source_dir' must also be provided.",
409409
)
410-
if not _is_valid_path(source_dir, path_type="Directory"):
410+
if not (
411+
_is_valid_path(source_dir, path_type="Directory")
412+
or _is_valid_s3_uri(source_dir, path_type="Directory")
413+
or (
414+
_is_valid_path(source_dir, path_type="File")
415+
and source_dir.endswith(".tar.gz")
416+
)
417+
or (
418+
_is_valid_s3_uri(source_dir, path_type="File")
419+
and source_dir.endswith(".tar.gz")
420+
)
421+
):
411422
raise ValueError(
412-
f"Invalid 'source_dir' path: {source_dir}. " + "Must be a valid directory.",
423+
f"Invalid 'source_dir' path: {source_dir}. "
424+
+ "Must be a valid local directory, "
425+
"s3 uri or path to tar.gz file stored locally or in s3.",
413426
)
414427
if requirements:
415-
if not _is_valid_path(
416-
f"{source_dir}/{requirements}",
417-
path_type="File",
418-
):
419-
raise ValueError(
420-
f"Invalid 'requirements': {requirements}. "
421-
+ "Must be a valid file within the 'source_dir'.",
422-
)
428+
if not source_dir.endswith(".tar.gz"):
429+
if not _is_valid_path(
430+
f"{source_dir}/{requirements}", path_type="File"
431+
) and not _is_valid_s3_uri(
432+
f"{source_dir}/{requirements}", path_type="File"
433+
):
434+
raise ValueError(
435+
f"Invalid 'requirements': {requirements}. "
436+
+ "Must be a valid file within the 'source_dir'.",
437+
)
423438
if entry_script:
424-
if not _is_valid_path(
425-
f"{source_dir}/{entry_script}",
426-
path_type="File",
427-
):
428-
raise ValueError(
429-
f"Invalid 'entry_script': {entry_script}. "
430-
+ "Must be a valid file within the 'source_dir'.",
431-
)
439+
if not source_dir.endswith(".tar.gz"):
440+
if not _is_valid_path(
441+
f"{source_dir}/{entry_script}", path_type="File"
442+
) and not _is_valid_s3_uri(
443+
f"{source_dir}/{entry_script}", path_type="File"
444+
):
445+
raise ValueError(
446+
f"Invalid 'entry_script': {entry_script}. "
447+
+ "Must be a valid file within the 'source_dir'.",
448+
)
432449

433450
def model_post_init(self, __context: Any):
434451
"""Post init method to perform custom validation and set default values."""
@@ -838,12 +855,17 @@ def _prepare_train_script(
838855

839856
install_requirements = ""
840857
if source_code.requirements:
841-
install_requirements = "echo 'Installing requirements'\n"
842-
install_requirements = f"$SM_PIP_CMD install -r {source_code.requirements}"
858+
install_requirements = (
859+
"echo 'Installing requirements'\n"
860+
+ f"$SM_PIP_CMD install -r {source_code.requirements}"
861+
)
843862

844863
working_dir = ""
845864
if source_code.source_dir:
846-
working_dir = f"cd {SM_CODE_CONTAINER_PATH}"
865+
working_dir = f"cd {SM_CODE_CONTAINER_PATH} \n"
866+
if source_code.source_dir.endswith(".tar.gz"):
867+
tarfile_name = os.path.basename(source_code.source_dir)
868+
working_dir += f"tar --strip-components=1 -xzf {tarfile_name} \n"
847869

848870
if base_command:
849871
execute_driver = EXECUTE_BASE_COMMANDS.format(base_command=base_command)

0 commit comments

Comments
 (0)