Skip to content

Commit 7e5c312

Browse files
authored
Merge branch 'master' into chainer
2 parents 92db04a + eacb833 commit 7e5c312

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ CHANGELOG
88
* feature: Add Chainer 4.1.0 support
99
* bug-fix: Use chainer_full_version fixture in Chainer integration tests
1010

11+
1.5.4
12+
=====
13+
14+
* feature: Added Docker Registry for all 1p algorithms in amazon_estimator.py
15+
* feature: Added get_image_uri method for 1p algorithms in amazon_estimator.py
16+
* Support SageMaker algorithms in FRA and SYD regions
17+
1118
1.5.3
1219
=====
1320

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ You can install from source by cloning this repository and issuing a pip install
5050

5151
git clone https://github.com/aws/sagemaker-python-sdk.git
5252
python setup.py sdist
53-
pip install dist/sagemaker-1.5.3.tar.gz
53+
pip install dist/sagemaker-1.5.4.tar.gz
5454

5555
Supported Python versions
5656
~~~~~~~~~~~~~~~~~~~~~~~~~

src/sagemaker/amazon/amazon_estimator.py

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ def __init__(self, role, train_instance_count, train_instance_type, data_locatio
4949
self.data_location = data_location
5050

5151
def train_image(self):
52-
repo = '{}:{}'.format(type(self).repo_name, type(self).repo_version)
53-
return '{}/{}'.format(registry(self.sagemaker_session.boto_region_name, type(self).repo_name), repo)
52+
return get_image_uri(
53+
self.sagemaker_session.boto_region_name,
54+
type(self).repo_name,
55+
type(self).repo_version)
5456

5557
def hyperparameters(self):
5658
return hp.serialize_all(self)
@@ -268,26 +270,65 @@ def upload_numpy_to_s3_shards(num_shards, s3, bucket, key_prefix, array, labels=
268270

269271

270272
def registry(region_name, algorithm=None):
271-
"""Return docker registry for the given AWS region"""
273+
"""Return docker registry for the given AWS region
274+
275+
Note: Not all the algorithms listed below have an Amazon Estimator implemented. For full list of
276+
pre-implemented Estimators, look at:
277+
278+
https://github.com/aws/sagemaker-python-sdk/tree/master/src/sagemaker/amazon
279+
"""
272280
if algorithm in [None, "pca", "kmeans", "linear-learner", "factorization-machines", "ntm",
273281
"randomcutforest"]:
274282
account_id = {
275283
"us-east-1": "382416733822",
276284
"us-east-2": "404615174143",
277285
"us-west-2": "174872318107",
278286
"eu-west-1": "438346466558",
287+
"eu-central-1": "664544806723",
279288
"ap-northeast-1": "351501993468",
280-
"ap-northeast-2": "835164637446"
289+
"ap-northeast-2": "835164637446",
290+
"ap-southeast-2": "712309505854"
281291
}[region_name]
282292
elif algorithm in ["lda"]:
283293
account_id = {
284294
"us-east-1": "766337827248",
285295
"us-east-2": "999911452149",
286296
"us-west-2": "266724342769",
287297
"eu-west-1": "999678624901",
298+
"eu-central-1": "353608530281",
288299
"ap-northeast-1": "258307448986",
289-
"ap-northeast-2": "293181348795"
300+
"ap-northeast-2": "293181348795",
301+
"ap-southeast-2": "297031611018"
302+
}[region_name]
303+
elif algorithm in ["forecasting-deepar"]:
304+
account_id = {
305+
"us-east-1": "522234722520",
306+
"us-east-2": "566113047672",
307+
"us-west-2": "156387875391",
308+
"eu-west-1": "224300973850",
309+
"eu-central-1": "495149712605",
310+
"ap-northeast-1": "633353088612",
311+
"ap-northeast-2": "204372634319",
312+
"ap-southeast-2": "514117268639"
313+
}[region_name]
314+
elif algorithm in ["xgboost", "seq2seq", "image-classification", "blazingtext",
315+
"object-detection"]:
316+
account_id = {
317+
"us-east-1": "811284229777",
318+
"us-east-2": "825641698319",
319+
"us-west-2": "433757028032",
320+
"eu-west-1": "685385470294",
321+
"eu-central-1": "813361260812",
322+
"ap-northeast-1": "501404015308",
323+
"ap-northeast-2": "306986355934",
324+
"ap-southeast-2": "544295431143"
290325
}[region_name]
291326
else:
292327
raise ValueError("Algorithm class:{} doesn't have mapping to account_id with images".format(algorithm))
293328
return "{}.dkr.ecr.{}.amazonaws.com".format(account_id, region_name)
329+
330+
331+
def get_image_uri(region_name, repo_name, repo_version=1):
332+
"""Return algorithm image URI for the given AWS region, repository name, and repository version"""
333+
repo = '{}:{}'.format(repo_name, repo_version)
334+
return '{}/{}'.format(registry(region_name, repo_name), repo)

0 commit comments

Comments
 (0)