|
| 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.stabilityai import get_stabilityai_image_uri |
| 18 | +from tests.unit.sagemaker.image_uris import expected_uris |
| 19 | + |
| 20 | +ACCOUNTS = { |
| 21 | + "af-south-1": "626614931356", |
| 22 | + "il-central-1": "780543022126", |
| 23 | + "ap-east-1": "871362719292", |
| 24 | + "ap-northeast-1": "763104351884", |
| 25 | + "ap-northeast-2": "763104351884", |
| 26 | + "ap-northeast-3": "364406365360", |
| 27 | + "ap-south-1": "763104351884", |
| 28 | + "ap-southeast-1": "763104351884", |
| 29 | + "ap-southeast-2": "763104351884", |
| 30 | + "ap-southeast-3": "907027046896", |
| 31 | + "ca-central-1": "763104351884", |
| 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-west-1": "763104351884", |
| 43 | + "us-west-2": "763104351884", |
| 44 | +} |
| 45 | +SAI_VERSIONS = ["0.1.0"] |
| 46 | +SAI_VERSIONS_MAPPING = {"0.1.0": "2.0.1-sgm0.1.0-gpu-py310-cu118-ubuntu20.04-sagemaker"} |
| 47 | + |
| 48 | + |
| 49 | +@pytest.mark.parametrize("version", SAI_VERSIONS) |
| 50 | +def test_stabilityai_image_uris(version): |
| 51 | + for region in ACCOUNTS.keys(): |
| 52 | + result = get_stabilityai_image_uri(region=region, version=version) |
| 53 | + expected = expected_uris.stabilityai_framework_uri( |
| 54 | + "stabilityai-pytorch-inference", |
| 55 | + ACCOUNTS[region], |
| 56 | + SAI_VERSIONS_MAPPING[version], |
| 57 | + region=region, |
| 58 | + ) |
| 59 | + assert expected == result |
0 commit comments