File size: 5,240 Bytes
4021124 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | # Copyright 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.
"""This module stores constants related to SageMaker JumpStart."""
from __future__ import absolute_import
from typing import Set
import boto3
from sagemaker.jumpstart.enums import JumpStartScriptScope
from sagemaker.jumpstart.types import JumpStartLaunchedRegionInfo
JUMPSTART_LAUNCHED_REGIONS: Set[JumpStartLaunchedRegionInfo] = set(
[
JumpStartLaunchedRegionInfo(
region_name="us-west-2",
content_bucket="jumpstart-cache-prod-us-west-2",
),
JumpStartLaunchedRegionInfo(
region_name="us-east-1",
content_bucket="jumpstart-cache-prod-us-east-1",
),
JumpStartLaunchedRegionInfo(
region_name="us-east-2",
content_bucket="jumpstart-cache-prod-us-east-2",
),
JumpStartLaunchedRegionInfo(
region_name="eu-west-1",
content_bucket="jumpstart-cache-prod-eu-west-1",
),
JumpStartLaunchedRegionInfo(
region_name="eu-central-1",
content_bucket="jumpstart-cache-prod-eu-central-1",
),
JumpStartLaunchedRegionInfo(
region_name="eu-north-1",
content_bucket="jumpstart-cache-prod-eu-north-1",
),
JumpStartLaunchedRegionInfo(
region_name="me-south-1",
content_bucket="jumpstart-cache-prod-me-south-1",
),
JumpStartLaunchedRegionInfo(
region_name="ap-south-1",
content_bucket="jumpstart-cache-prod-ap-south-1",
),
JumpStartLaunchedRegionInfo(
region_name="eu-west-3",
content_bucket="jumpstart-cache-prod-eu-west-3",
),
JumpStartLaunchedRegionInfo(
region_name="af-south-1",
content_bucket="jumpstart-cache-prod-af-south-1",
),
JumpStartLaunchedRegionInfo(
region_name="sa-east-1",
content_bucket="jumpstart-cache-prod-sa-east-1",
),
JumpStartLaunchedRegionInfo(
region_name="ap-east-1",
content_bucket="jumpstart-cache-prod-ap-east-1",
),
JumpStartLaunchedRegionInfo(
region_name="ap-northeast-2",
content_bucket="jumpstart-cache-prod-ap-northeast-2",
),
JumpStartLaunchedRegionInfo(
region_name="eu-west-2",
content_bucket="jumpstart-cache-prod-eu-west-2",
),
JumpStartLaunchedRegionInfo(
region_name="eu-south-1",
content_bucket="jumpstart-cache-prod-eu-south-1",
),
JumpStartLaunchedRegionInfo(
region_name="ap-northeast-1",
content_bucket="jumpstart-cache-prod-ap-northeast-1",
),
JumpStartLaunchedRegionInfo(
region_name="us-west-1",
content_bucket="jumpstart-cache-prod-us-west-1",
),
JumpStartLaunchedRegionInfo(
region_name="ap-southeast-1",
content_bucket="jumpstart-cache-prod-ap-southeast-1",
),
JumpStartLaunchedRegionInfo(
region_name="ap-southeast-2",
content_bucket="jumpstart-cache-prod-ap-southeast-2",
),
JumpStartLaunchedRegionInfo(
region_name="ca-central-1",
content_bucket="jumpstart-cache-prod-ca-central-1",
),
JumpStartLaunchedRegionInfo(
region_name="cn-north-1",
content_bucket="jumpstart-cache-prod-cn-north-1",
),
]
)
JUMPSTART_REGION_NAME_TO_LAUNCHED_REGION_DICT = {
region.region_name: region for region in JUMPSTART_LAUNCHED_REGIONS
}
JUMPSTART_REGION_NAME_SET = {region.region_name for region in JUMPSTART_LAUNCHED_REGIONS}
JUMPSTART_BUCKET_NAME_SET = {region.content_bucket for region in JUMPSTART_LAUNCHED_REGIONS}
JUMPSTART_DEFAULT_REGION_NAME = boto3.session.Session().region_name or "us-west-2"
JUMPSTART_DEFAULT_MANIFEST_FILE_S3_KEY = "models_manifest.json"
INFERENCE_ENTRY_POINT_SCRIPT_NAME = "inference.py"
TRAINING_ENTRY_POINT_SCRIPT_NAME = "transfer_learning.py"
SUPPORTED_JUMPSTART_SCOPES = set(scope.value for scope in JumpStartScriptScope)
ENV_VARIABLE_JUMPSTART_CONTENT_BUCKET_OVERRIDE = "AWS_JUMPSTART_CONTENT_BUCKET_OVERRIDE"
ENV_VARIABLE_JUMPSTART_MODEL_ARTIFACT_BUCKET_OVERRIDE = "AWS_JUMPSTART_MODEL_BUCKET_OVERRIDE"
ENV_VARIABLE_JUMPSTART_SCRIPT_ARTIFACT_BUCKET_OVERRIDE = "AWS_JUMPSTART_SCRIPT_BUCKET_OVERRIDE"
ENV_VARIABLE_JUMPSTART_MANIFEST_LOCAL_ROOT_DIR_OVERRIDE = (
"AWS_JUMPSTART_MANIFEST_LOCAL_ROOT_DIR_OVERRIDE"
)
ENV_VARIABLE_JUMPSTART_SPECS_LOCAL_ROOT_DIR_OVERRIDE = "AWS_JUMPSTART_SPECS_LOCAL_ROOT_DIR_OVERRIDE"
JUMPSTART_RESOURCE_BASE_NAME = "sagemaker-jumpstart"
|