Skip to content

Commit 3e3d8b9

Browse files
authored
Merge branch 'zwei' into attach-log
2 parents 612ae57 + 2bb6713 commit 3e3d8b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2986
-811
lines changed

src/sagemaker/amazon/amazon_estimator.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@
2626
from sagemaker.inputs import FileSystemInput, TrainingInput
2727
from sagemaker.model import NEO_IMAGE_ACCOUNT
2828
from sagemaker.utils import sagemaker_timestamp, get_ecr_image_uri_prefix
29-
from sagemaker.xgboost.defaults import (
30-
XGBOOST_1P_VERSIONS,
31-
XGBOOST_LATEST_VERSION,
32-
XGBOOST_NAME,
33-
XGBOOST_SUPPORTED_VERSIONS,
34-
XGBOOST_VERSION_EQUIVALENTS,
35-
)
36-
from sagemaker.xgboost.estimator import get_xgboost_image_uri
3729

3830
logger = logging.getLogger(__name__)
3931

@@ -622,76 +614,5 @@ def get_image_uri(region_name, repo_name, repo_version=1):
622614
"in SageMaker Python SDK v2."
623615
)
624616

625-
repo_version = str(repo_version)
626-
627-
if repo_name == XGBOOST_NAME:
628-
629-
if repo_version in XGBOOST_1P_VERSIONS:
630-
_warn_newer_xgboost_image()
631-
return "{}/{}:{}".format(registry(region_name, repo_name), repo_name, repo_version)
632-
633-
if "-" not in repo_version:
634-
xgboost_version_matches = [
635-
version
636-
for version in XGBOOST_SUPPORTED_VERSIONS
637-
if repo_version == version.split("-")[0]
638-
]
639-
if xgboost_version_matches:
640-
# Assumes that XGBOOST_SUPPORTED_VERSION is sorted from oldest version to latest.
641-
# When SageMaker version is not specified, we use the oldest one that matches
642-
# XGBoost version for backward compatibility.
643-
repo_version = xgboost_version_matches[0]
644-
645-
supported_framework_versions = [
646-
version
647-
for version in XGBOOST_SUPPORTED_VERSIONS
648-
if repo_version in _generate_version_equivalents(version)
649-
]
650-
651-
if not supported_framework_versions:
652-
raise ValueError(
653-
"SageMaker XGBoost version {} is not supported. Supported versions: {}".format(
654-
repo_version, ", ".join(XGBOOST_SUPPORTED_VERSIONS)
655-
)
656-
)
657-
658-
if not _is_latest_xgboost_version(repo_version):
659-
_warn_newer_xgboost_image()
660-
661-
return get_xgboost_image_uri(region_name, supported_framework_versions[-1])
662-
663617
repo = "{}:{}".format(repo_name, repo_version)
664618
return "{}/{}".format(registry(region_name, repo_name), repo)
665-
666-
667-
def _warn_newer_xgboost_image():
668-
"""Print a warning when there is a newer XGBoost image"""
669-
logging.warning(
670-
"There is a more up to date SageMaker XGBoost image. "
671-
"To use the newer image, please set 'repo_version'="
672-
"'%s'. For example:\n"
673-
"\tget_image_uri(region, '%s', '%s').",
674-
XGBOOST_LATEST_VERSION,
675-
XGBOOST_NAME,
676-
XGBOOST_LATEST_VERSION,
677-
)
678-
679-
680-
def _is_latest_xgboost_version(repo_version):
681-
"""Compare xgboost image version with latest version
682-
683-
Args:
684-
repo_version:
685-
"""
686-
if repo_version in XGBOOST_1P_VERSIONS:
687-
return False
688-
return repo_version in _generate_version_equivalents(XGBOOST_LATEST_VERSION)
689-
690-
691-
def _generate_version_equivalents(version):
692-
"""Returns a list of version equivalents for XGBoost
693-
694-
Args:
695-
version:
696-
"""
697-
return [version + suffix for suffix in XGBOOST_VERSION_EQUIVALENTS] + [version]

src/sagemaker/chainer/estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def create_model(
214214
return ChainerModel(
215215
self.model_data,
216216
role or self.role,
217-
entry_point or self.entry_point,
217+
entry_point or self._model_entry_point(),
218218
source_dir=(source_dir or self._model_source_dir()),
219219
enable_cloudwatch_metrics=self.enable_cloudwatch_metrics,
220220
container_log_level=self.container_log_level,

src/sagemaker/estimator.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,17 +1744,28 @@ def _stage_user_code_in_s3(self):
17441744
)
17451745

17461746
def _model_source_dir(self):
1747-
"""Get the appropriate value to pass as source_dir to model constructor
1748-
on deploying
1747+
"""Get the appropriate value to pass as ``source_dir`` to a model constructor.
17491748
17501749
Returns:
1751-
str: Either a local or an S3 path pointing to the source_dir to be
1752-
used for code by the model to be deployed
1750+
str: Either a local or an S3 path pointing to the ``source_dir`` to be
1751+
used for code by the model to be deployed
17531752
"""
17541753
return (
17551754
self.source_dir if self.sagemaker_session.local_mode else self.uploaded_code.s3_prefix
17561755
)
17571756

1757+
def _model_entry_point(self):
1758+
"""Get the appropriate value to pass as ``entry_point`` to a model constructor.
1759+
1760+
Returns:
1761+
str: The path to the entry point script. This can be either an absolute path or
1762+
a path relative to ``self._model_source_dir()``.
1763+
"""
1764+
if self.sagemaker_session.local_mode or (self._model_source_dir() is None):
1765+
return self.entry_point
1766+
1767+
return self.uploaded_code.script_name
1768+
17581769
def hyperparameters(self):
17591770
"""Return the hyperparameters as a dictionary to use for training.
17601771

src/sagemaker/fw_utils.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@
6565
"framework_version is required for script mode estimator. "
6666
"Please add framework_version={} to your constructor to avoid this error."
6767
)
68-
UNSUPPORTED_FRAMEWORK_VERSION_ERROR = (
69-
"{} framework does not support version {}. Please use one of the following: {}."
70-
)
7168

7269
VALID_PY_VERSIONS = ["py2", "py3", "py37"]
7370
VALID_EIA_FRAMEWORKS = [
@@ -447,7 +444,7 @@ def tar_and_upload_dir(
447444
script name.
448445
"""
449446
if directory and directory.lower().startswith("s3://"):
450-
return UploadedCode(s3_prefix=directory, script_name=os.path.basename(script))
447+
return UploadedCode(s3_prefix=directory, script_name=script)
451448

452449
script_name = script if directory else os.path.basename(script)
453450
dependencies = dependencies or []
@@ -637,25 +634,6 @@ def warn_if_parameter_server_with_multi_gpu(training_instance_type, distribution
637634
logger.warning(PARAMETER_SERVER_MULTI_GPU_WARNING)
638635

639636

640-
def get_unsupported_framework_version_error(
641-
framework_name, unsupported_version, supported_versions
642-
):
643-
"""Return error message for unsupported framework version.
644-
645-
This should also return the supported versions for customers.
646-
647-
:param framework_name:
648-
:param unsupported_version:
649-
:param supported_versions:
650-
:return:
651-
"""
652-
return UNSUPPORTED_FRAMEWORK_VERSION_ERROR.format(
653-
framework_name,
654-
unsupported_version,
655-
", ".join('"{}"'.format(version) for version in supported_versions),
656-
)
657-
658-
659637
def python_deprecation_warning(framework, latest_supported_version):
660638
"""
661639
Args:
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"scope": ["inference", "training"],
3+
"versions": {
4+
"1": {
5+
"registries": {
6+
"ap-east-1": "286214385809",
7+
"ap-northeast-1": "501404015308",
8+
"ap-northeast-2": "306986355934",
9+
"ap-south-1": "991648021394",
10+
"ap-southeast-1": "475088953585",
11+
"ap-southeast-2": "544295431143",
12+
"ca-central-1": "469771592824",
13+
"cn-north-1": "390948362332",
14+
"cn-northwest-1": "387376663083",
15+
"eu-central-1": "813361260812",
16+
"eu-north-1": "669576153137",
17+
"eu-west-1": "685385470294",
18+
"eu-west-2": "644912444149",
19+
"eu-west-3": "749696950732",
20+
"me-south-1": "249704162688",
21+
"sa-east-1": "855470959533",
22+
"us-east-1": "811284229777",
23+
"us-east-2": "825641698319",
24+
"us-gov-west-1": "226302683700",
25+
"us-iso-east-1": "490574956308",
26+
"us-west-1": "632365934929",
27+
"us-west-2": "433757028032"
28+
},
29+
"repository": "blazingtext"
30+
}
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"scope": ["inference", "training"],
3+
"versions": {
4+
"1": {
5+
"registries": {
6+
"ap-east-1": "286214385809",
7+
"ap-northeast-1": "633353088612",
8+
"ap-northeast-2": "204372634319",
9+
"ap-south-1": "991648021394",
10+
"ap-southeast-1": "475088953585",
11+
"ap-southeast-2": "514117268639",
12+
"ca-central-1": "469771592824",
13+
"cn-north-1": "390948362332",
14+
"cn-northwest-1": "387376663083",
15+
"eu-central-1": "495149712605",
16+
"eu-north-1": "669576153137",
17+
"eu-west-1": "224300973850",
18+
"eu-west-2": "644912444149",
19+
"eu-west-3": "749696950732",
20+
"me-south-1": "249704162688",
21+
"sa-east-1": "855470959533",
22+
"us-east-1": "522234722520",
23+
"us-east-2": "566113047672",
24+
"us-gov-west-1": "226302683700",
25+
"us-iso-east-1": "490574956308",
26+
"us-west-1": "632365934929",
27+
"us-west-2": "156387875391"
28+
},
29+
"repository": "forecasting-deepar"
30+
}
31+
}
32+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"scope": ["inference"],
3+
"versions": {
4+
"latest": {
5+
"registries": {
6+
"ap-east-1": "110948597952",
7+
"ap-northeast-1": "941853720454",
8+
"ap-northeast-2": "151534178276",
9+
"ap-south-1": "763008648453",
10+
"ap-southeast-1": "324986816169",
11+
"ap-southeast-2": "355873309152",
12+
"ca-central-1": "464438896020",
13+
"cn-north-1": "472730292857",
14+
"cn-northwest-1": "474822919863",
15+
"eu-central-1": "746233611703",
16+
"eu-north-1": "601324751636",
17+
"eu-west-1": "802834080501",
18+
"eu-west-2": "205493899709",
19+
"eu-west-3": "254080097072",
20+
"me-south-1": "836785723513",
21+
"sa-east-1": "756306329178",
22+
"us-east-1": "785573368785",
23+
"us-east-2": "007439368137",
24+
"us-gov-west-1": "263933020539",
25+
"us-west-1": "710691900526",
26+
"us-west-2": "301217895009"
27+
},
28+
"repository": "image-classification-neo"
29+
}
30+
}
31+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"scope": ["inference", "training"],
3+
"versions": {
4+
"1": {
5+
"registries": {
6+
"ap-east-1": "286214385809",
7+
"ap-northeast-1": "501404015308",
8+
"ap-northeast-2": "306986355934",
9+
"ap-south-1": "991648021394",
10+
"ap-southeast-1": "475088953585",
11+
"ap-southeast-2": "544295431143",
12+
"ca-central-1": "469771592824",
13+
"cn-north-1": "390948362332",
14+
"cn-northwest-1": "387376663083",
15+
"eu-central-1": "813361260812",
16+
"eu-north-1": "669576153137",
17+
"eu-west-1": "685385470294",
18+
"eu-west-2": "644912444149",
19+
"eu-west-3": "749696950732",
20+
"me-south-1": "249704162688",
21+
"sa-east-1": "855470959533",
22+
"us-east-1": "811284229777",
23+
"us-east-2": "825641698319",
24+
"us-gov-west-1": "226302683700",
25+
"us-iso-east-1": "490574956308",
26+
"us-west-1": "632365934929",
27+
"us-west-2": "433757028032"
28+
},
29+
"repository": "image-classification"
30+
}
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"scope": ["inference", "training"],
3+
"versions": {
4+
"1": {
5+
"registries": {
6+
"ap-east-1": "286214385809",
7+
"ap-northeast-1": "351501993468",
8+
"ap-northeast-2": "835164637446",
9+
"ap-south-1": "991648021394",
10+
"ap-southeast-1": "475088953585",
11+
"ap-southeast-2": "712309505854",
12+
"ca-central-1": "469771592824",
13+
"cn-north-1": "390948362332",
14+
"cn-northwest-1": "387376663083",
15+
"eu-central-1": "664544806723",
16+
"eu-north-1": "669576153137",
17+
"eu-west-1": "438346466558",
18+
"eu-west-2": "644912444149",
19+
"eu-west-3": "749696950732",
20+
"me-south-1": "249704162688",
21+
"sa-east-1": "855470959533",
22+
"us-east-1": "382416733822",
23+
"us-east-2": "404615174143",
24+
"us-gov-west-1": "226302683700",
25+
"us-iso-east-1": "490574956308",
26+
"us-west-1": "632365934929",
27+
"us-west-2": "174872318107"
28+
},
29+
"repository": "ipinsights"
30+
}
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"scope": ["inference", "training"],
3+
"versions": {
4+
"1": {
5+
"registries": {
6+
"ap-east-1": "286214385809",
7+
"ap-northeast-1": "351501993468",
8+
"ap-northeast-2": "835164637446",
9+
"ap-south-1": "991648021394",
10+
"ap-southeast-1": "475088953585",
11+
"ap-southeast-2": "712309505854",
12+
"ca-central-1": "469771592824",
13+
"cn-north-1": "390948362332",
14+
"cn-northwest-1": "387376663083",
15+
"eu-central-1": "664544806723",
16+
"eu-north-1": "669576153137",
17+
"eu-west-1": "438346466558",
18+
"eu-west-2": "644912444149",
19+
"eu-west-3": "749696950732",
20+
"me-south-1": "249704162688",
21+
"sa-east-1": "855470959533",
22+
"us-east-1": "382416733822",
23+
"us-east-2": "404615174143",
24+
"us-gov-west-1": "226302683700",
25+
"us-iso-east-1": "490574956308",
26+
"us-west-1": "632365934929",
27+
"us-west-2": "174872318107"
28+
},
29+
"repository": "kmeans"
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)