Skip to content

Commit cd4f507

Browse files
author
Shibo Xing
committed
feat: (squash and push to use git hooks) add p2 deprecation for retrieving pytorch img uri
style: format _validate_instance_deprecation using black doc: add docstring for _validate_instance_deprecation doc: update deprecation error string doc: update docstring for _validate_instance_deprecation
1 parent 11ff7c0 commit cd4f507

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/sagemaker/image_uris.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def retrieve(
232232

233233
if repo == f"{framework}-inference-graviton":
234234
container_version = f"{container_version}-sagemaker"
235+
_validate_instance_deprecation(framework, instance_type, version)
235236

236237
tag = _get_image_tag(
237238
container_version,
@@ -365,6 +366,20 @@ def _config_for_framework_and_scope(framework, image_scope, accelerator_type=Non
365366
return config if "scope" in config else config[image_scope]
366367

367368

369+
def _validate_instance_deprecation(framework, instance_type, version):
370+
"""Check if instance type is deprecated for a certain framework with a certain version"""
371+
if (
372+
framework == "pytorch"
373+
and _get_instance_type_family(instance_type) == "p2"
374+
and version >= "1.13"
375+
):
376+
raise ValueError(
377+
"P2 instances have been deprecated for sagemaker jobs with PyTorch 1.13 and above. "
378+
"For information about supported instance types please refer to "
379+
"https://aws.amazon.com/sagemaker/pricing/"
380+
)
381+
382+
368383
def _validate_for_suppported_frameworks_and_instance_type(framework, instace_type):
369384
"""Validate if framework is supported for the instance_type"""
370385
if (

0 commit comments

Comments
 (0)