Skip to content

Commit 203820f

Browse files
authored
Merge branch 'master' into sap_add_missing_quote
2 parents f8ac982 + 42298df commit 203820f

File tree

5 files changed

+130
-55
lines changed

5 files changed

+130
-55
lines changed

VERSION

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

src/sagemaker/image_uri_config/huggingface.json

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"4.11": "4.11.0",
1010
"4.12": "4.12.3",
1111
"4.17": "4.17.0",
12-
"4.26": "4.26.0"
12+
"4.26": "4.26.0",
13+
"4.28": "4.28.1"
1314
},
1415
"versions": {
1516
"4.4.2": {
@@ -814,6 +815,47 @@
814815
"repository": "huggingface-pytorch-training",
815816
"container_version": {"gpu": "cu117-ubuntu20.04"}
816817
}
818+
},
819+
"4.28.1": {
820+
"version_aliases": {
821+
"pytorch2.0": "pytorch2.0.0"
822+
},
823+
"pytorch2.0.0": {
824+
"py_versions": ["py310"],
825+
"registries": {
826+
"af-south-1": "626614931356",
827+
"ap-east-1": "871362719292",
828+
"ap-northeast-1": "763104351884",
829+
"ap-northeast-2": "763104351884",
830+
"ap-northeast-3": "364406365360",
831+
"ap-south-1": "763104351884",
832+
"ap-southeast-1": "763104351884",
833+
"ap-southeast-2": "763104351884",
834+
"ap-southeast-3": "907027046896",
835+
"ca-central-1": "763104351884",
836+
"cn-north-1": "727897471807",
837+
"cn-northwest-1": "727897471807",
838+
"eu-central-1": "763104351884",
839+
"eu-north-1": "763104351884",
840+
"eu-west-1": "763104351884",
841+
"eu-west-2": "763104351884",
842+
"eu-west-3": "763104351884",
843+
"eu-south-1": "692866216735",
844+
"me-south-1": "217643126080",
845+
"me-central-1": "914824155844",
846+
"sa-east-1": "763104351884",
847+
"us-east-1": "763104351884",
848+
"us-east-2": "763104351884",
849+
"us-gov-east-1": "446045086412",
850+
"us-gov-west-1": "442386744353",
851+
"us-iso-east-1": "886529160074",
852+
"us-isob-east-1": "094389454867",
853+
"us-west-1": "763104351884",
854+
"us-west-2": "763104351884"
855+
},
856+
"repository": "huggingface-pytorch-training",
857+
"container_version": {"gpu": "cu118-ubuntu20.04"}
858+
}
817859
}
818860
}
819861
},
@@ -826,7 +868,8 @@
826868
"4.11": "4.11.0",
827869
"4.12": "4.12.3",
828870
"4.17": "4.17.0",
829-
"4.26": "4.26.0"
871+
"4.26": "4.26.0",
872+
"4.28": "4.28.1"
830873
},
831874
"versions": {
832875
"4.6.1": {
@@ -1466,6 +1509,51 @@
14661509
"repository": "huggingface-tensorflow-inference",
14671510
"container_version": {"gpu": "cu112-ubuntu20.04", "cpu": "ubuntu20.04" }
14681511
}
1512+
},
1513+
"4.28.1": {
1514+
"version_aliases": {
1515+
"pytorch2.0": "pytorch2.0.0"
1516+
},
1517+
"pytorch2.0.0": {
1518+
"py_versions": ["py310"],
1519+
"registries": {
1520+
"af-south-1": "626614931356",
1521+
"ap-east-1": "871362719292",
1522+
"ap-northeast-1": "763104351884",
1523+
"ap-northeast-2": "763104351884",
1524+
"ap-northeast-3": "364406365360",
1525+
"ap-south-1": "763104351884",
1526+
"ap-south-2": "772153158452",
1527+
"ap-southeast-1": "763104351884",
1528+
"ap-southeast-2": "763104351884",
1529+
"ap-southeast-3": "907027046896",
1530+
"ap-southeast-4": "457447274322",
1531+
"ca-central-1": "763104351884",
1532+
"cn-north-1": "727897471807",
1533+
"cn-northwest-1": "727897471807",
1534+
"eu-central-1": "763104351884",
1535+
"eu-central-2": "380420809688",
1536+
"eu-north-1": "763104351884",
1537+
"eu-west-1": "763104351884",
1538+
"eu-west-2": "763104351884",
1539+
"eu-west-3": "763104351884",
1540+
"eu-south-1": "692866216735",
1541+
"eu-south-2": "503227376785",
1542+
"me-south-1": "217643126080",
1543+
"me-central-1": "914824155844",
1544+
"sa-east-1": "763104351884",
1545+
"us-east-1": "763104351884",
1546+
"us-east-2": "763104351884",
1547+
"us-gov-east-1": "446045086412",
1548+
"us-gov-west-1": "442386744353",
1549+
"us-iso-east-1": "886529160074",
1550+
"us-isob-east-1": "094389454867",
1551+
"us-west-1": "763104351884",
1552+
"us-west-2": "763104351884"
1553+
},
1554+
"repository": "huggingface-pytorch-inference",
1555+
"container_version": {"gpu": "cu118-ubuntu20.04", "cpu": "ubuntu20.04" }
1556+
}
14691557
}
14701558
}
14711559
}

src/sagemaker/model.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,15 +844,20 @@ def multi_version_compilation_supported(
844844
):
845845
if target_instance_type and framework and framework_version:
846846
framework = framework.lower()
847+
847848
multi_version_frameworks_support_mapping = {
848-
"inferentia": ["pytorch", "tensorflow", "mxnet"],
849+
"ml_inf1": ["pytorch", "tensorflow", "mxnet"],
850+
"ml_inf2": ["pytorch", "tensorflow"],
851+
"ml_trn1": ["pytorch", "tensorflow"],
849852
"neo_ioc_targets": ["pytorch", "tensorflow"],
850853
"neo_edge_targets": ["pytorch", "tensorflow"],
851854
}
852855
if target_instance_type in NEO_IOC_TARGET_DEVICES:
853856
return framework in multi_version_frameworks_support_mapping["neo_ioc_targets"]
854-
if target_instance_type == "ml_inf1":
855-
return framework in multi_version_frameworks_support_mapping["inferentia"]
857+
if target_instance_type in ["ml_inf1", "ml_inf2", "ml_trn1"]:
858+
return (
859+
framework in multi_version_frameworks_support_mapping[target_instance_type]
860+
)
856861
if target_instance_type not in NEO_MULTIVERSION_UNSUPPORTED:
857862
return framework in multi_version_frameworks_support_mapping["neo_edge_targets"]
858863
return False

tests/conftest.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ def huggingface_pytorch_training_version(huggingface_training_version):
277277

278278
@pytest.fixture(scope="module")
279279
def huggingface_pytorch_training_py_version(huggingface_pytorch_training_version):
280-
if Version(huggingface_pytorch_training_version) >= Version("1.13"):
280+
if Version(huggingface_pytorch_training_version) >= Version("2.0"):
281+
return "py310"
282+
elif Version(huggingface_pytorch_training_version) >= Version("1.13"):
281283
return "py39"
282284
elif Version(huggingface_pytorch_training_version) >= Version("1.9"):
283285
return "py38"
@@ -337,7 +339,9 @@ def huggingface_training_compiler_pytorch_py_version(
337339
def huggingface_pytorch_latest_training_py_version(
338340
huggingface_training_pytorch_latest_version,
339341
):
340-
if Version(huggingface_training_pytorch_latest_version) >= Version("1.13"):
342+
if Version(huggingface_training_pytorch_latest_version) >= Version("2.0"):
343+
return "py310"
344+
elif Version(huggingface_training_pytorch_latest_version) >= Version("1.13"):
341345
return "py39"
342346
elif Version(huggingface_training_pytorch_latest_version) >= Version("1.9"):
343347
return "py38"
@@ -359,7 +363,9 @@ def pytorch_training_compiler_py_version(
359363
def huggingface_pytorch_latest_inference_py_version(
360364
huggingface_inference_pytorch_latest_version,
361365
):
362-
if Version(huggingface_inference_pytorch_latest_version) >= Version("1.13"):
366+
if Version(huggingface_inference_pytorch_latest_version) >= Version("2.0"):
367+
return "py310"
368+
elif Version(huggingface_inference_pytorch_latest_version) >= Version("1.13"):
363369
return "py39"
364370
elif Version(huggingface_inference_pytorch_latest_version) >= Version("1.9"):
365371
return "py38"

tests/unit/sagemaker/model/test_neo.py

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -362,59 +362,35 @@ def test_compile_with_tensorflow_neo_in_ml_inf(session):
362362
)
363363

364364

365-
def test_compile_validates_framework_version(sagemaker_session):
366-
sagemaker_session.wait_for_compilation_job = Mock(
367-
return_value={
368-
"CompilationJobStatus": "Completed",
369-
"ModelArtifacts": {"S3ModelArtifacts": "s3://output-path/model.tar.gz"},
370-
"InferenceImage": None,
371-
}
372-
)
365+
@pytest.mark.parametrize(
366+
"target,framework,fx_version,expected_fx_version",
367+
[
368+
("ml_c4", "pytorch", "1.6", "1.6"),
369+
("rasp3b", "pytorch", "1.6.1", "1.6"),
370+
("amba_cv2", "pytorch", "1.6.1", None),
371+
("ml_c4", "tensorflow", "1.15.1", "1.15"),
372+
("ml_c4", "tensorflow", "2.15.1", "2.15"),
373+
("ml_inf1", "tensorflow", "2.15.1", "2.15"),
374+
("ml_inf2", "pytorch", "2.0", "2.0"),
375+
("ml_inf2", "pytorch", "2.0.1", "2.0"),
376+
("ml_trn1", "pytorch", "2.0.1", "2.0"),
377+
("ml_trn1", "tensorflow", "2.0.1", "2.0"),
378+
],
379+
)
380+
def test_compile_validates_framework_version(
381+
sagemaker_session, target, framework, fx_version, expected_fx_version
382+
):
373383
model = _create_model(sagemaker_session)
374-
model.compile(
375-
target_instance_family="ml_c4",
376-
input_shape={"data": [1, 3, 1024, 1024]},
377-
output_path="s3://output",
378-
role="role",
379-
framework="pytorch",
380-
framework_version="1.6.1",
381-
job_name="compile-model",
382-
)
383-
384-
assert model.image_uri is None
385-
386-
sagemaker_session.wait_for_compilation_job = Mock(
387-
return_value={
388-
"CompilationJobStatus": "Completed",
389-
"ModelArtifacts": {"S3ModelArtifacts": "s3://output-path/model.tar.gz"},
390-
"InferenceImage": None,
391-
}
392-
)
393-
394-
config = model._compilation_job_config(
395-
"rasp3b",
396-
{"data": [1, 3, 1024, 1024]},
397-
"s3://output",
398-
"role",
399-
900,
400-
"compile-model",
401-
"pytorch",
402-
None,
403-
framework_version="1.6.1",
404-
)
405-
406-
assert config["input_model_config"]["FrameworkVersion"] == "1.6"
407-
408384
config = model._compilation_job_config(
409-
"amba_cv2",
385+
target,
410386
{"data": [1, 3, 1024, 1024]},
411387
"s3://output",
412388
"role",
413389
900,
414390
"compile-model",
415-
"pytorch",
391+
framework,
416392
None,
417-
framework_version="1.6.1",
393+
framework_version=fx_version,
418394
)
419395

420-
assert config["input_model_config"].get("FrameworkVersion", None) is None
396+
assert config["input_model_config"].get("FrameworkVersion", None) == expected_fx_version

0 commit comments

Comments
 (0)