Skip to content

Commit f9c449a

Browse files
author
Shibo Xing
committed
feat: add p2 deprecation for retrieving pytorch img uri
1 parent 11ff7c0 commit f9c449a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/sagemaker/image_uris.py

Lines changed: 10 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,
@@ -364,6 +365,15 @@ def _config_for_framework_and_scope(framework, image_scope, accelerator_type=Non
364365
_validate_arg(image_scope, available_scopes, "image scope")
365366
return config if "scope" in config else config[image_scope]
366367

368+
def _validate_instance_deprecation(framework, instance_type, version):
369+
if framework == "pytorch" and \
370+
_get_instance_type_family(instance_type) == "p2" and \
371+
version >= "1.13":
372+
raise ValueError(
373+
"P2 instances have been deprecated for Sagemaker for PyTorch 1.13 and above. "
374+
"For information about supported instance types please refer to "
375+
"https://docs.aws.amazon.com/sagemaker/latest/dg/notebooks-available-instance-types.html"
376+
)
367377

368378
def _validate_for_suppported_frameworks_and_instance_type(framework, instace_type):
369379
"""Validate if framework is supported for the instance_type"""

0 commit comments

Comments
 (0)