@@ -49,8 +49,10 @@ def __init__(self, role, train_instance_count, train_instance_type, data_locatio
49
49
self .data_location = data_location
50
50
51
51
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 )
54
56
55
57
def hyperparameters (self ):
56
58
return hp .serialize_all (self )
@@ -268,26 +270,65 @@ def upload_numpy_to_s3_shards(num_shards, s3, bucket, key_prefix, array, labels=
268
270
269
271
270
272
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
+ """
272
280
if algorithm in [None , "pca" , "kmeans" , "linear-learner" , "factorization-machines" , "ntm" ,
273
281
"randomcutforest" ]:
274
282
account_id = {
275
283
"us-east-1" : "382416733822" ,
276
284
"us-east-2" : "404615174143" ,
277
285
"us-west-2" : "174872318107" ,
278
286
"eu-west-1" : "438346466558" ,
287
+ "eu-central-1" : "664544806723" ,
279
288
"ap-northeast-1" : "351501993468" ,
280
- "ap-northeast-2" : "835164637446"
289
+ "ap-northeast-2" : "835164637446" ,
290
+ "ap-southeast-2" : "712309505854"
281
291
}[region_name ]
282
292
elif algorithm in ["lda" ]:
283
293
account_id = {
284
294
"us-east-1" : "766337827248" ,
285
295
"us-east-2" : "999911452149" ,
286
296
"us-west-2" : "266724342769" ,
287
297
"eu-west-1" : "999678624901" ,
298
+ "eu-central-1" : "353608530281" ,
288
299
"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"
290
325
}[region_name ]
291
326
else :
292
327
raise ValueError ("Algorithm class:{} doesn't have mapping to account_id with images" .format (algorithm ))
293
328
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