Skip to content

add p2 deprecation for PT>=1.13 #3567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ disable=
useless-object-inheritance, # TODO: Enable this check and fix code once Python 2 is no longer supported.
super-with-arguments,
raise-missing-from,
E1136,

[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs
Expand Down
16 changes: 16 additions & 0 deletions src/sagemaker/image_uris.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import re
from typing import Optional
from packaging.version import Version

from sagemaker import utils
from sagemaker.jumpstart.utils import is_jumpstart_model_input
Expand Down Expand Up @@ -232,6 +233,7 @@ def retrieve(

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

tag = _get_image_tag(
container_version,
Expand Down Expand Up @@ -365,6 +367,20 @@ def _config_for_framework_and_scope(framework, image_scope, accelerator_type=Non
return config if "scope" in config else config[image_scope]


def _validate_instance_deprecation(framework, instance_type, version):
"""Check if instance type is deprecated for a certain framework with a certain version"""
if (
framework == "pytorch"
and _get_instance_type_family(instance_type) == "p2"
and Version(version) >= Version("1.13")
):
raise ValueError(
"P2 instances have been deprecated for sagemaker jobs with PyTorch 1.13 and above. "
"For information about supported instance types please refer to "
"https://aws.amazon.com/sagemaker/pricing/"
)


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