From 057361c84c0f76ece45fdaea28f12de92b7cd7e5 Mon Sep 17 00:00:00 2001 From: Lauren Yu <6631887+laurenyu@users.noreply.github.com> Date: Wed, 15 Jul 2020 15:59:33 -0700 Subject: [PATCH] change: add remaining Amazon algorithms for image_uris.retrieve() --- .../image_uri_config/blazingtext.json | 32 +++++ .../image_uri_config/forecasting-deepar.json | 32 +++++ .../image-classification-neo.json | 31 +++++ .../image-classification.json | 32 +++++ .../image_uri_config/ipinsights.json | 32 +++++ src/sagemaker/image_uri_config/kmeans.json | 32 +++++ src/sagemaker/image_uri_config/knn.json | 32 +++++ src/sagemaker/image_uri_config/lda.json | 25 ++++ .../image_uri_config/linear-learner.json | 32 +++++ src/sagemaker/image_uri_config/ntm.json | 32 +++++ .../image_uri_config/object-detection.json | 32 +++++ .../image_uri_config/object2vec.json | 32 +++++ src/sagemaker/image_uri_config/pca.json | 32 +++++ .../image_uri_config/randomcutforest.json | 32 +++++ .../semantic-segmentation.json | 32 +++++ src/sagemaker/image_uri_config/seq2seq.json | 32 +++++ .../image_uri_config/xgboost-neo.json | 31 +++++ tests/unit/sagemaker/image_uris/test_algos.py | 118 +++++++++++++++++- tests/unit/sagemaker/image_uris/test_neo.py | 60 +++++++++ 19 files changed, 711 insertions(+), 2 deletions(-) create mode 100644 src/sagemaker/image_uri_config/blazingtext.json create mode 100644 src/sagemaker/image_uri_config/forecasting-deepar.json create mode 100644 src/sagemaker/image_uri_config/image-classification-neo.json create mode 100644 src/sagemaker/image_uri_config/image-classification.json create mode 100644 src/sagemaker/image_uri_config/ipinsights.json create mode 100644 src/sagemaker/image_uri_config/kmeans.json create mode 100644 src/sagemaker/image_uri_config/knn.json create mode 100644 src/sagemaker/image_uri_config/lda.json create mode 100644 src/sagemaker/image_uri_config/linear-learner.json create mode 100644 src/sagemaker/image_uri_config/ntm.json create mode 100644 src/sagemaker/image_uri_config/object-detection.json create mode 100644 src/sagemaker/image_uri_config/object2vec.json create mode 100644 src/sagemaker/image_uri_config/pca.json create mode 100644 src/sagemaker/image_uri_config/randomcutforest.json create mode 100644 src/sagemaker/image_uri_config/semantic-segmentation.json create mode 100644 src/sagemaker/image_uri_config/seq2seq.json create mode 100644 src/sagemaker/image_uri_config/xgboost-neo.json create mode 100644 tests/unit/sagemaker/image_uris/test_neo.py diff --git a/src/sagemaker/image_uri_config/blazingtext.json b/src/sagemaker/image_uri_config/blazingtext.json new file mode 100644 index 0000000000..c94c9cf214 --- /dev/null +++ b/src/sagemaker/image_uri_config/blazingtext.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "501404015308", + "ap-northeast-2": "306986355934", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "544295431143", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "813361260812", + "eu-north-1": "669576153137", + "eu-west-1": "685385470294", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "811284229777", + "us-east-2": "825641698319", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "433757028032" + }, + "repository": "blazingtext" + } + } +} diff --git a/src/sagemaker/image_uri_config/forecasting-deepar.json b/src/sagemaker/image_uri_config/forecasting-deepar.json new file mode 100644 index 0000000000..dae3a2b2c3 --- /dev/null +++ b/src/sagemaker/image_uri_config/forecasting-deepar.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "633353088612", + "ap-northeast-2": "204372634319", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "514117268639", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "495149712605", + "eu-north-1": "669576153137", + "eu-west-1": "224300973850", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "522234722520", + "us-east-2": "566113047672", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "156387875391" + }, + "repository": "forecasting-deepar" + } + } +} diff --git a/src/sagemaker/image_uri_config/image-classification-neo.json b/src/sagemaker/image_uri_config/image-classification-neo.json new file mode 100644 index 0000000000..7ac5ee5858 --- /dev/null +++ b/src/sagemaker/image_uri_config/image-classification-neo.json @@ -0,0 +1,31 @@ +{ + "scope": ["inference", "training"], + "versions": { + "latest": { + "registries": { + "ap-east-1": "110948597952", + "ap-northeast-1": "941853720454", + "ap-northeast-2": "151534178276", + "ap-south-1": "763008648453", + "ap-southeast-1": "324986816169", + "ap-southeast-2": "355873309152", + "ca-central-1": "464438896020", + "cn-north-1": "472730292857", + "cn-northwest-1": "474822919863", + "eu-central-1": "746233611703", + "eu-north-1": "601324751636", + "eu-west-1": "802834080501", + "eu-west-2": "205493899709", + "eu-west-3": "254080097072", + "me-south-1": "836785723513", + "sa-east-1": "756306329178", + "us-east-1": "785573368785", + "us-east-2": "007439368137", + "us-gov-west-1": "263933020539", + "us-west-1": "710691900526", + "us-west-2": "301217895009" + }, + "repository": "image-classification-neo" + } + } +} diff --git a/src/sagemaker/image_uri_config/image-classification.json b/src/sagemaker/image_uri_config/image-classification.json new file mode 100644 index 0000000000..b5b9591965 --- /dev/null +++ b/src/sagemaker/image_uri_config/image-classification.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "501404015308", + "ap-northeast-2": "306986355934", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "544295431143", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "813361260812", + "eu-north-1": "669576153137", + "eu-west-1": "685385470294", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "811284229777", + "us-east-2": "825641698319", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "433757028032" + }, + "repository": "image-classification" + } + } +} diff --git a/src/sagemaker/image_uri_config/ipinsights.json b/src/sagemaker/image_uri_config/ipinsights.json new file mode 100644 index 0000000000..c1638a0277 --- /dev/null +++ b/src/sagemaker/image_uri_config/ipinsights.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "ipinsights" + } + } +} diff --git a/src/sagemaker/image_uri_config/kmeans.json b/src/sagemaker/image_uri_config/kmeans.json new file mode 100644 index 0000000000..457936d91b --- /dev/null +++ b/src/sagemaker/image_uri_config/kmeans.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "kmeans" + } + } +} diff --git a/src/sagemaker/image_uri_config/knn.json b/src/sagemaker/image_uri_config/knn.json new file mode 100644 index 0000000000..d8596f1a52 --- /dev/null +++ b/src/sagemaker/image_uri_config/knn.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "knn" + } + } +} diff --git a/src/sagemaker/image_uri_config/lda.json b/src/sagemaker/image_uri_config/lda.json new file mode 100644 index 0000000000..1a0501e814 --- /dev/null +++ b/src/sagemaker/image_uri_config/lda.json @@ -0,0 +1,25 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-northeast-1": "258307448986", + "ap-northeast-2": "293181348795", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "297031611018", + "ca-central-1": "469771592824", + "eu-central-1": "353608530281", + "eu-west-1": "999678624901", + "eu-west-2": "644912444149", + "us-east-1": "766337827248", + "us-east-2": "999911452149", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "266724342769" + }, + "repository": "lda" + } + } +} diff --git a/src/sagemaker/image_uri_config/linear-learner.json b/src/sagemaker/image_uri_config/linear-learner.json new file mode 100644 index 0000000000..ec0ae2ca10 --- /dev/null +++ b/src/sagemaker/image_uri_config/linear-learner.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "linear-learner" + } + } +} diff --git a/src/sagemaker/image_uri_config/ntm.json b/src/sagemaker/image_uri_config/ntm.json new file mode 100644 index 0000000000..78fcbdf2fc --- /dev/null +++ b/src/sagemaker/image_uri_config/ntm.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "ntm" + } + } +} diff --git a/src/sagemaker/image_uri_config/object-detection.json b/src/sagemaker/image_uri_config/object-detection.json new file mode 100644 index 0000000000..a439f1043b --- /dev/null +++ b/src/sagemaker/image_uri_config/object-detection.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "501404015308", + "ap-northeast-2": "306986355934", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "544295431143", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "813361260812", + "eu-north-1": "669576153137", + "eu-west-1": "685385470294", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "811284229777", + "us-east-2": "825641698319", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "433757028032" + }, + "repository": "object-detection" + } + } +} diff --git a/src/sagemaker/image_uri_config/object2vec.json b/src/sagemaker/image_uri_config/object2vec.json new file mode 100644 index 0000000000..2052db7cc5 --- /dev/null +++ b/src/sagemaker/image_uri_config/object2vec.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "object2vec" + } + } +} diff --git a/src/sagemaker/image_uri_config/pca.json b/src/sagemaker/image_uri_config/pca.json new file mode 100644 index 0000000000..652a0ae99d --- /dev/null +++ b/src/sagemaker/image_uri_config/pca.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "pca" + } + } +} diff --git a/src/sagemaker/image_uri_config/randomcutforest.json b/src/sagemaker/image_uri_config/randomcutforest.json new file mode 100644 index 0000000000..05fadc0188 --- /dev/null +++ b/src/sagemaker/image_uri_config/randomcutforest.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "351501993468", + "ap-northeast-2": "835164637446", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "712309505854", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "664544806723", + "eu-north-1": "669576153137", + "eu-west-1": "438346466558", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "382416733822", + "us-east-2": "404615174143", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "174872318107" + }, + "repository": "randomcutforest" + } + } +} diff --git a/src/sagemaker/image_uri_config/semantic-segmentation.json b/src/sagemaker/image_uri_config/semantic-segmentation.json new file mode 100644 index 0000000000..d0dc33df6d --- /dev/null +++ b/src/sagemaker/image_uri_config/semantic-segmentation.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "501404015308", + "ap-northeast-2": "306986355934", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "544295431143", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "813361260812", + "eu-north-1": "669576153137", + "eu-west-1": "685385470294", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "811284229777", + "us-east-2": "825641698319", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "433757028032" + }, + "repository": "semantic-segmentation" + } + } +} diff --git a/src/sagemaker/image_uri_config/seq2seq.json b/src/sagemaker/image_uri_config/seq2seq.json new file mode 100644 index 0000000000..73f4c2dcd6 --- /dev/null +++ b/src/sagemaker/image_uri_config/seq2seq.json @@ -0,0 +1,32 @@ +{ + "scope": ["inference", "training"], + "versions": { + "1": { + "registries": { + "ap-east-1": "286214385809", + "ap-northeast-1": "501404015308", + "ap-northeast-2": "306986355934", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "544295431143", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "813361260812", + "eu-north-1": "669576153137", + "eu-west-1": "685385470294", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "811284229777", + "us-east-2": "825641698319", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "433757028032" + }, + "repository": "seq2seq" + } + } +} diff --git a/src/sagemaker/image_uri_config/xgboost-neo.json b/src/sagemaker/image_uri_config/xgboost-neo.json new file mode 100644 index 0000000000..fcffed90f1 --- /dev/null +++ b/src/sagemaker/image_uri_config/xgboost-neo.json @@ -0,0 +1,31 @@ +{ + "scope": ["inference", "training"], + "versions": { + "latest": { + "registries": { + "ap-east-1": "110948597952", + "ap-northeast-1": "941853720454", + "ap-northeast-2": "151534178276", + "ap-south-1": "763008648453", + "ap-southeast-1": "324986816169", + "ap-southeast-2": "355873309152", + "ca-central-1": "464438896020", + "cn-north-1": "472730292857", + "cn-northwest-1": "474822919863", + "eu-central-1": "746233611703", + "eu-north-1": "601324751636", + "eu-west-1": "802834080501", + "eu-west-2": "205493899709", + "eu-west-3": "254080097072", + "me-south-1": "836785723513", + "sa-east-1": "756306329178", + "us-east-1": "785573368785", + "us-east-2": "007439368137", + "us-gov-west-1": "263933020539", + "us-west-1": "710691900526", + "us-west-2": "301217895009" + }, + "repository": "xgboost-neo" + } + } +} diff --git a/tests/unit/sagemaker/image_uris/test_algos.py b/tests/unit/sagemaker/image_uris/test_algos.py index a38551f27a..c2f1b0fb4c 100644 --- a/tests/unit/sagemaker/image_uris/test_algos.py +++ b/tests/unit/sagemaker/image_uris/test_algos.py @@ -12,9 +12,28 @@ # language governing permissions and limitations under the License. from __future__ import absolute_import +import pytest + from sagemaker import image_uris from tests.unit.sagemaker.image_uris import expected_uris, regions +ALGO_NAMES = ( + "blazingtext", + "factorization-machines", + "forecasting-deepar", + "image-classification", + "ipinsights", + "kmeans", + "knn", + "linear-learner", + "ntm", + "object-detection", + "object2vec", + "pca", + "randomcutforest", + "semantic-segmentation", + "seq2seq", +) ALGO_REGIONS_AND_ACCOUNTS = ( { "algorithms": ( @@ -53,6 +72,86 @@ "us-west-2": "174872318107", }, }, + { + "algorithms": ("lda",), + "accounts": { + "ap-northeast-1": "258307448986", + "ap-northeast-2": "293181348795", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "297031611018", + "ca-central-1": "469771592824", + "eu-central-1": "353608530281", + "eu-west-1": "999678624901", + "eu-west-2": "644912444149", + "us-east-1": "766337827248", + "us-east-2": "999911452149", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "266724342769", + }, + }, + { + "algorithms": ("forecasting-deepar",), + "accounts": { + "ap-east-1": "286214385809", + "ap-northeast-1": "633353088612", + "ap-northeast-2": "204372634319", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "514117268639", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "495149712605", + "eu-north-1": "669576153137", + "eu-west-1": "224300973850", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "522234722520", + "us-east-2": "566113047672", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "156387875391", + }, + }, + { + "algorithms": ( + "seq2seq", + "image-classification", + "blazingtext", + "object-detection", + "semantic-segmentation", + ), + "accounts": { + "ap-east-1": "286214385809", + "ap-northeast-1": "501404015308", + "ap-northeast-2": "306986355934", + "ap-south-1": "991648021394", + "ap-southeast-1": "475088953585", + "ap-southeast-2": "544295431143", + "ca-central-1": "469771592824", + "cn-north-1": "390948362332", + "cn-northwest-1": "387376663083", + "eu-central-1": "813361260812", + "eu-north-1": "669576153137", + "eu-west-1": "685385470294", + "eu-west-2": "644912444149", + "eu-west-3": "749696950732", + "me-south-1": "249704162688", + "sa-east-1": "855470959533", + "us-east-1": "811284229777", + "us-east-2": "825641698319", + "us-gov-west-1": "226302683700", + "us-iso-east-1": "490574956308", + "us-west-1": "632365934929", + "us-west-2": "433757028032", + }, + }, ) IMAGE_URI_FORMAT = "{}.dkr.ecr.{}.{}/{}:1" @@ -66,11 +165,26 @@ def _accounts_for_algo(algo): return {} -def test_factorization_machines(): - algo = "factorization-machines" +@pytest.mark.parametrize("algo", ALGO_NAMES) +def test_algo_uris(algo): accounts = _accounts_for_algo(algo) for region in regions.regions(): for scope in ("training", "inference"): uri = image_uris.retrieve(algo, region, image_scope=scope) assert expected_uris.algo_uri(algo, accounts[region], region) == uri + + +def test_lda(): + algo = "lda" + accounts = _accounts_for_algo(algo) + + for region in regions.regions(): + for scope in ("training", "inference"): + if region in accounts: + uri = image_uris.retrieve(algo, region, image_scope=scope) + assert expected_uris.algo_uri(algo, accounts[region], region) == uri + else: + with pytest.raises(ValueError) as e: + image_uris.retrieve(algo, region, image_scope=scope) + assert "Unsupported region: {}.".format(region) in str(e.value) diff --git a/tests/unit/sagemaker/image_uris/test_neo.py b/tests/unit/sagemaker/image_uris/test_neo.py new file mode 100644 index 0000000000..a15d5551b8 --- /dev/null +++ b/tests/unit/sagemaker/image_uris/test_neo.py @@ -0,0 +1,60 @@ +# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +from __future__ import absolute_import + +import pytest + +from sagemaker import image_uris +from tests.unit import NEO_REGION_LIST +from tests.unit.sagemaker.image_uris import expected_uris, regions + + +ALGO_NAMES = ("image-classification-neo", "xgboost-neo") + +ACCOUNTS = { + "ap-east-1": "110948597952", + "ap-northeast-1": "941853720454", + "ap-northeast-2": "151534178276", + "ap-south-1": "763008648453", + "ap-southeast-1": "324986816169", + "ap-southeast-2": "355873309152", + "ca-central-1": "464438896020", + "cn-north-1": "472730292857", + "cn-northwest-1": "474822919863", + "eu-central-1": "746233611703", + "eu-north-1": "601324751636", + "eu-west-1": "802834080501", + "eu-west-2": "205493899709", + "eu-west-3": "254080097072", + "me-south-1": "836785723513", + "sa-east-1": "756306329178", + "us-east-1": "785573368785", + "us-east-2": "007439368137", + "us-gov-west-1": "263933020539", + "us-west-1": "710691900526", + "us-west-2": "301217895009", +} + + +@pytest.mark.parametrize("algo", ALGO_NAMES) +def test_algo_uris(algo): + for region in regions.regions(): + for scope in ("training", "inference"): + if region in NEO_REGION_LIST: + uri = image_uris.retrieve(algo, region, image_scope=scope) + expected = expected_uris.algo_uri(algo, ACCOUNTS[region], region, version="latest") + assert expected == uri + else: + with pytest.raises(ValueError) as e: + image_uris.retrieve(algo, region, image_scope=scope) + assert "Unsupported region: {}.".format(region) in str(e.value)