Skip to content

Commit 21e07d0

Browse files
committed
feature: Add image_uris.retrieve() support for AutoGluon
1 parent 50840db commit 21e07d0

File tree

3 files changed

+173
-0
lines changed

3 files changed

+173
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"training": {
3+
"processors": ["cpu", "gpu"],
4+
"versions": {
5+
"0.3.1": {
6+
"registries": {
7+
"af-south-1": "626614931356",
8+
"ap-east-1": "871362719292",
9+
"ap-northeast-1": "763104351884",
10+
"ap-northeast-2": "763104351884",
11+
"ap-northeast-3": "364406365360",
12+
"ap-south-1": "763104351884",
13+
"ap-southeast-1": "763104351884",
14+
"ap-southeast-2": "763104351884",
15+
"ca-central-1": "763104351884",
16+
"cn-north-1": "727897471807",
17+
"cn-northwest-1": "727897471807",
18+
"eu-central-1": "763104351884",
19+
"eu-north-1": "763104351884",
20+
"eu-west-1": "763104351884",
21+
"eu-west-2": "763104351884",
22+
"eu-west-3": "763104351884",
23+
"eu-south-1": "692866216735",
24+
"me-south-1": "217643126080",
25+
"sa-east-1": "763104351884",
26+
"us-east-1": "763104351884",
27+
"us-east-2": "763104351884",
28+
"us-gov-west-1": "442386744353",
29+
"us-iso-east-1": "886529160074",
30+
"us-west-1": "763104351884",
31+
"us-west-2": "763104351884"
32+
},
33+
"repository": "autogluon-training",
34+
"py_versions": ["py37"]
35+
}
36+
}
37+
},
38+
"inference": {
39+
"processors": ["cpu"],
40+
"versions": {
41+
"0.3.1": {
42+
"registries": {
43+
"af-south-1": "626614931356",
44+
"ap-east-1": "871362719292",
45+
"ap-northeast-1": "763104351884",
46+
"ap-northeast-2": "763104351884",
47+
"ap-northeast-3": "364406365360",
48+
"ap-south-1": "763104351884",
49+
"ap-southeast-1": "763104351884",
50+
"ap-southeast-2": "763104351884",
51+
"ca-central-1": "763104351884",
52+
"cn-north-1": "727897471807",
53+
"cn-northwest-1": "727897471807",
54+
"eu-central-1": "763104351884",
55+
"eu-north-1": "763104351884",
56+
"eu-west-1": "763104351884",
57+
"eu-west-2": "763104351884",
58+
"eu-west-3": "763104351884",
59+
"eu-south-1": "692866216735",
60+
"me-south-1": "217643126080",
61+
"sa-east-1": "763104351884",
62+
"us-east-1": "763104351884",
63+
"us-east-2": "763104351884",
64+
"us-gov-west-1": "442386744353",
65+
"us-iso-east-1": "886529160074",
66+
"us-west-1": "763104351884",
67+
"us-west-2": "763104351884"
68+
},
69+
"repository": "autogluon-inference",
70+
"py_versions": ["py37"]
71+
}
72+
}
73+
}
74+
}

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"xgboost",
6060
"spark",
6161
"huggingface",
62+
"autogluon",
6263
)
6364

6465

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
15+
import pytest
16+
17+
from sagemaker import image_uris
18+
from tests.unit.sagemaker.image_uris import expected_uris
19+
20+
ACCOUNTS = {
21+
"af-south-1": "626614931356",
22+
"ap-east-1": "871362719292",
23+
"ap-northeast-1": "763104351884",
24+
"ap-northeast-2": "763104351884",
25+
"ap-northeast-3": "364406365360",
26+
"ap-south-1": "763104351884",
27+
"ap-southeast-1": "763104351884",
28+
"ap-southeast-2": "763104351884",
29+
"ca-central-1": "763104351884",
30+
"cn-north-1": "727897471807",
31+
"cn-northwest-1": "727897471807",
32+
"eu-central-1": "763104351884",
33+
"eu-north-1": "763104351884",
34+
"eu-west-1": "763104351884",
35+
"eu-west-2": "763104351884",
36+
"eu-west-3": "763104351884",
37+
"eu-south-1": "692866216735",
38+
"me-south-1": "217643126080",
39+
"sa-east-1": "763104351884",
40+
"us-east-1": "763104351884",
41+
"us-east-2": "763104351884",
42+
"us-gov-west-1": "442386744353",
43+
"us-iso-east-1": "886529160074",
44+
"us-west-1": "763104351884",
45+
"us-west-2": "763104351884",
46+
}
47+
VERSIONS = ["0.3.1"]
48+
49+
50+
@pytest.mark.parametrize("version", VERSIONS)
51+
def test_valid_uris(version):
52+
for region in ACCOUNTS.keys():
53+
uri = image_uris.retrieve(
54+
"autogluon",
55+
region=region,
56+
version=version,
57+
py_version="py37",
58+
image_scope="training",
59+
instance_type="ml.c4.xlarge",
60+
)
61+
62+
expected = expected_uris.framework_uri(
63+
"autogluon-training",
64+
version,
65+
ACCOUNTS[region],
66+
py_version="py37",
67+
region=region,
68+
)
69+
assert uri == expected
70+
71+
72+
@pytest.mark.parametrize("version", VERSIONS)
73+
def test_py3_error(version):
74+
with pytest.raises(ValueError) as e:
75+
image_uris.retrieve(
76+
"autogluon",
77+
region="us-west-2",
78+
version=version,
79+
py_version="py3",
80+
image_scope="training",
81+
instance_type="ml.c4.xlarge",
82+
)
83+
84+
assert "Unsupported Python version: py3." in str(e.value)
85+
86+
87+
@pytest.mark.parametrize("version", VERSIONS)
88+
def test_gpu_error(version):
89+
with pytest.raises(ValueError) as e:
90+
image_uris.retrieve(
91+
"autogluon",
92+
region="us-west-2",
93+
version=version,
94+
image_scope="inference",
95+
instance_type="ml.p2.xlarge",
96+
)
97+
98+
assert "Unsupported processor: gpu." in str(e.value)

0 commit comments

Comments
 (0)