structure saas with tools
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Copyright 2021 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License 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 google.cloud.aiplatform.constants import base
|
||||
from google.cloud.aiplatform.constants import prediction
|
||||
|
||||
__all__ = ("base", "prediction")
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,143 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License 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 google.cloud.aiplatform import version as aiplatform_version
|
||||
|
||||
|
||||
DEFAULT_REGION = "us-central1"
|
||||
SUPPORTED_REGIONS = frozenset(
|
||||
{
|
||||
"africa-south1",
|
||||
"asia-east1",
|
||||
"asia-east2",
|
||||
"asia-northeast1",
|
||||
"asia-northeast2",
|
||||
"asia-northeast3",
|
||||
"asia-south1",
|
||||
"asia-southeast1",
|
||||
"asia-southeast2",
|
||||
"australia-southeast1",
|
||||
"australia-southeast2",
|
||||
"europe-central2",
|
||||
"europe-north1",
|
||||
"europe-southwest1",
|
||||
"europe-west1",
|
||||
"europe-west2",
|
||||
"europe-west3",
|
||||
"europe-west4",
|
||||
"europe-west6",
|
||||
"europe-west8",
|
||||
"europe-west9",
|
||||
"europe-west12",
|
||||
"global",
|
||||
"me-central1",
|
||||
"me-central2",
|
||||
"me-west1",
|
||||
"northamerica-northeast1",
|
||||
"northamerica-northeast2",
|
||||
"southamerica-east1",
|
||||
"southamerica-west1",
|
||||
"us-central1",
|
||||
"us-east1",
|
||||
"us-east4",
|
||||
"us-east5",
|
||||
"us-south1",
|
||||
"us-west1",
|
||||
"us-west2",
|
||||
"us-west3",
|
||||
"us-west4",
|
||||
}
|
||||
)
|
||||
|
||||
API_BASE_PATH = "aiplatform.googleapis.com"
|
||||
PREDICTION_API_BASE_PATH = API_BASE_PATH
|
||||
|
||||
# Batch Prediction
|
||||
BATCH_PREDICTION_INPUT_STORAGE_FORMATS = (
|
||||
"jsonl",
|
||||
"csv",
|
||||
"tf-record",
|
||||
"tf-record-gzip",
|
||||
"bigquery",
|
||||
"file-list",
|
||||
)
|
||||
BATCH_PREDICTION_OUTPUT_STORAGE_FORMATS = ("jsonl", "csv", "bigquery")
|
||||
|
||||
MOBILE_TF_MODEL_TYPES = {
|
||||
"MOBILE_TF_LOW_LATENCY_1",
|
||||
"MOBILE_TF_VERSATILE_1",
|
||||
"MOBILE_TF_HIGH_ACCURACY_1",
|
||||
}
|
||||
|
||||
MODEL_GARDEN_ICN_MODEL_TYPES = {
|
||||
"EFFICIENTNET",
|
||||
"MAXVIT",
|
||||
"VIT",
|
||||
"COCA",
|
||||
}
|
||||
|
||||
MODEL_GARDEN_IOD_MODEL_TYPES = {
|
||||
"SPINENET",
|
||||
"YOLO",
|
||||
}
|
||||
|
||||
# TODO(b/177079208): Use EPCL Enums for validating Model Types
|
||||
# Defined by gs://google-cloud-aiplatform/schema/trainingjob/definition/automl_image_*
|
||||
# Format: "prediction_type": set() of model_type's
|
||||
#
|
||||
# NOTE: When adding a new prediction_type's, ensure it fits the pattern
|
||||
# "automl_image_{prediction_type}_*" used by the YAML schemas on GCS
|
||||
AUTOML_IMAGE_PREDICTION_MODEL_TYPES = {
|
||||
"classification": {"CLOUD", "CLOUD_1"}
|
||||
| MOBILE_TF_MODEL_TYPES
|
||||
| MODEL_GARDEN_ICN_MODEL_TYPES,
|
||||
"object_detection": {"CLOUD_1", "CLOUD_HIGH_ACCURACY_1", "CLOUD_LOW_LATENCY_1"}
|
||||
| MOBILE_TF_MODEL_TYPES
|
||||
| MODEL_GARDEN_IOD_MODEL_TYPES,
|
||||
}
|
||||
|
||||
AUTOML_VIDEO_PREDICTION_MODEL_TYPES = {
|
||||
"classification": {"CLOUD"} | {"MOBILE_VERSATILE_1"},
|
||||
"action_recognition": {"CLOUD"} | {"MOBILE_VERSATILE_1"},
|
||||
"object_tracking": {"CLOUD"}
|
||||
| {
|
||||
"MOBILE_VERSATILE_1",
|
||||
"MOBILE_CORAL_VERSATILE_1",
|
||||
"MOBILE_CORAL_LOW_LATENCY_1",
|
||||
"MOBILE_JETSON_VERSATILE_1",
|
||||
"MOBILE_JETSON_LOW_LATENCY_1",
|
||||
},
|
||||
}
|
||||
|
||||
# Used in constructing the requests user_agent header for metrics reporting.
|
||||
USER_AGENT_PRODUCT = "model-builder"
|
||||
# This field is used to pass the name of the specific SDK method
|
||||
# that is being used for usage metrics tracking purposes.
|
||||
# For more details on go/oneplatform-api-analytics
|
||||
USER_AGENT_SDK_COMMAND = ""
|
||||
|
||||
# Needed for Endpoint.raw_predict
|
||||
DEFAULT_AUTHED_SCOPES = ["https://www.googleapis.com/auth/cloud-platform"]
|
||||
|
||||
# Used in CustomJob.from_local_script for experiments integration in training
|
||||
AIPLATFORM_DEPENDENCY_PATH = (
|
||||
f"google-cloud-aiplatform=={aiplatform_version.__version__}"
|
||||
)
|
||||
|
||||
AIPLATFORM_AUTOLOG_DEPENDENCY_PATH = (
|
||||
f"google-cloud-aiplatform[autologging]=={aiplatform_version.__version__}"
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License 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.
|
||||
#
|
||||
|
||||
import re
|
||||
|
||||
from google.cloud.aiplatform.compat.types import (
|
||||
pipeline_state as gca_pipeline_state,
|
||||
)
|
||||
|
||||
_PIPELINE_COMPLETE_STATES = set(
|
||||
[
|
||||
gca_pipeline_state.PipelineState.PIPELINE_STATE_SUCCEEDED,
|
||||
gca_pipeline_state.PipelineState.PIPELINE_STATE_FAILED,
|
||||
gca_pipeline_state.PipelineState.PIPELINE_STATE_CANCELLED,
|
||||
gca_pipeline_state.PipelineState.PIPELINE_STATE_PAUSED,
|
||||
]
|
||||
)
|
||||
|
||||
_PIPELINE_ERROR_STATES = set([gca_pipeline_state.PipelineState.PIPELINE_STATE_FAILED])
|
||||
|
||||
# Pattern for valid names used as a Vertex resource name.
|
||||
_VALID_NAME_PATTERN = re.compile("^[a-z][-a-z0-9]{0,127}$", re.IGNORECASE)
|
||||
|
||||
# Pattern for an Artifact Registry URL.
|
||||
_VALID_AR_URL = re.compile(r"^https:\/\/([\w-]+)-kfp\.pkg\.dev\/.*", re.IGNORECASE)
|
||||
|
||||
# Pattern for any JSON or YAML file over HTTPS.
|
||||
_VALID_HTTPS_URL = re.compile(r"^https:\/\/([\.\/\w-]+)\/.*(json|yaml|yml)$")
|
||||
|
||||
# Fields to include in returned PipelineJob when enable_simple_view=True in PipelineJob.list()
|
||||
_READ_MASK_FIELDS = [
|
||||
"name",
|
||||
"state",
|
||||
"display_name",
|
||||
"pipeline_spec.pipeline_info",
|
||||
"create_time",
|
||||
"start_time",
|
||||
"end_time",
|
||||
"update_time",
|
||||
"labels",
|
||||
"template_uri",
|
||||
"template_metadata.version",
|
||||
"job_detail.pipeline_run_context",
|
||||
"job_detail.pipeline_context",
|
||||
]
|
||||
@@ -0,0 +1,304 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License 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.
|
||||
|
||||
import re
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
# [region]-docker.pkg.dev/vertex-ai/prediction/[framework]-[accelerator].[version]:latest
|
||||
CONTAINER_URI_PATTERN = re.compile(
|
||||
r"(?P<region>[\w]+)\-docker\.pkg\.dev\/vertex\-ai\/prediction\/"
|
||||
r"(?P<framework>[\w]+)\-(?P<accelerator>[\w]+)\.(?P<version>[\d-]+):latest"
|
||||
)
|
||||
|
||||
CONTAINER_URI_REGEX = (
|
||||
r"^(us|europe|asia)-docker.pkg.dev/"
|
||||
r"vertex-ai/prediction/"
|
||||
r"(tf|sklearn|xgboost|pytorch).+$"
|
||||
)
|
||||
|
||||
SKLEARN = "sklearn"
|
||||
TF = "tf"
|
||||
TF2 = "tf2"
|
||||
XGBOOST = "xgboost"
|
||||
|
||||
XGBOOST_CONTAINER_URIS = [
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.2-1:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.2-1:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.2-1:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.2-0:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.2-0:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.2-0:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-7:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-7:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-7:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-6:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-6:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-6:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-5:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-5:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-5:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-4:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-4:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-4:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-3:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-3:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-3:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-2:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-2:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-2:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-1:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-1:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.1-1:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.0-90:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.0-90:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.0-90:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.0-82:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.0-82:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/xgboost-cpu.0-82:latest",
|
||||
]
|
||||
|
||||
SKLEARN_CONTAINER_URIS = [
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-5:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-5:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-5:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-4:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-4:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-4:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-3:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-3:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-3:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-2:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-2:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-2:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-0:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-0:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.1-0:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-24:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-24:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-24:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-23:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-23:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-23:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-22:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-22:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-22:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-20:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-20:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-20:latest",
|
||||
]
|
||||
|
||||
TF_CONTAINER_URIS = [
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-15:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-15:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-15:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-15:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-15:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-15:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-14:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-14:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-14:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-14:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-14:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-14:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-13:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-13:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-13:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-13:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-13:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-13:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-12:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-12:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-12:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-12:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-12:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-12:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-11:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-11:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-11:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-11:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-11:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-11:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-10:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-10:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-10:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-10:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-10:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-10:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-9:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-9:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-9:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-9:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-9:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-9:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-8:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-8:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-8:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-8:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-8:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-8:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-7:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-7:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-7:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-7:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-7:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-7:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-6:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-6:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-6:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-6:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-6:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-6:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-5:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-5:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-5:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-5:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-5:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-5:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-4:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-4:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-4:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-4:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-4:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-4:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-3:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-3:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-3:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-3:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-3:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-3:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-2:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-2:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-2:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-2:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-2:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-2:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-1:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-1:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-1:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-1:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-1:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf2-gpu.2-1:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf-cpu.1-15:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf-cpu.1-15:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf-cpu.1-15:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/tf-gpu.1-15:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/tf-gpu.1-15:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/tf-gpu.1-15:latest",
|
||||
]
|
||||
|
||||
PYTORCH_CONTAINER_URIS = [
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-4:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-4:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-4:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-4:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-4:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-4:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-3:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-3:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-3:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-3:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-3:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-3:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-2:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-2:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-2:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-2:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-2:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-2:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-1:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-1:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-1:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-1:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-1:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-1:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-0:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-0:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.2-0:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-0:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-0:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-0:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-13:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-13:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-13:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-13:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-13:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-13:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-12:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-12:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-12:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-12:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-12:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-12:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-11:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-11:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-cpu.1-11:latest",
|
||||
"us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-11:latest",
|
||||
"europe-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-11:latest",
|
||||
"asia-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.1-11:latest",
|
||||
]
|
||||
|
||||
SERVING_CONTAINER_URIS = (
|
||||
SKLEARN_CONTAINER_URIS
|
||||
+ TF_CONTAINER_URIS
|
||||
+ XGBOOST_CONTAINER_URIS
|
||||
+ PYTORCH_CONTAINER_URIS
|
||||
)
|
||||
|
||||
# Map of all first-party prediction containers
|
||||
d = defaultdict(lambda: defaultdict(lambda: defaultdict(lambda: defaultdict(str))))
|
||||
|
||||
for container_uri in SERVING_CONTAINER_URIS:
|
||||
m = CONTAINER_URI_PATTERN.match(container_uri)
|
||||
region, framework, accelerator, version = m[1], m[2], m[3], m[4]
|
||||
version = version.replace("-", ".")
|
||||
|
||||
if framework in (TF2, TF): # Store both `tf`, `tf2` as `tensorflow`
|
||||
framework = "tensorflow"
|
||||
|
||||
d[region][framework][accelerator][version] = container_uri
|
||||
|
||||
_SERVING_CONTAINER_URI_MAP = d
|
||||
|
||||
_SERVING_CONTAINER_DOCUMENTATION_URL = (
|
||||
"https://cloud.google.com/vertex-ai/docs/predictions/pre-built-containers"
|
||||
)
|
||||
|
||||
# Variables set by Vertex AI. For more details, please refer to
|
||||
# https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables
|
||||
DEFAULT_AIP_HTTP_PORT = 8080
|
||||
AIP_HTTP_PORT = "AIP_HTTP_PORT"
|
||||
AIP_HEALTH_ROUTE = "AIP_HEALTH_ROUTE"
|
||||
AIP_PREDICT_ROUTE = "AIP_PREDICT_ROUTE"
|
||||
AIP_STORAGE_URI = "AIP_STORAGE_URI"
|
||||
|
||||
# Default values for Prediction local experience.
|
||||
DEFAULT_LOCAL_PREDICT_ROUTE = "/predict"
|
||||
DEFAULT_LOCAL_HEALTH_ROUTE = "/health"
|
||||
DEFAULT_LOCAL_RUN_GPU_CAPABILITIES = [["utility", "compute"]]
|
||||
DEFAULT_LOCAL_RUN_GPU_COUNT = -1
|
||||
|
||||
CUSTOM_PREDICTION_ROUTINES = "custom-prediction-routines"
|
||||
CUSTOM_PREDICTION_ROUTINES_SERVER_ERROR_HEADER_KEY = "X-AIP-CPR-SYSTEM-ERROR"
|
||||
|
||||
# Headers' related constants for the handler usage.
|
||||
CONTENT_TYPE_HEADER_REGEX = re.compile("^[Cc]ontent-?[Tt]ype$")
|
||||
ACCEPT_HEADER_REGEX = re.compile("^[Aa]ccept$")
|
||||
ANY_ACCEPT_TYPE = "*/*"
|
||||
DEFAULT_ACCEPT_VALUE = "application/json"
|
||||
|
||||
# Model filenames.
|
||||
MODEL_FILENAME_BST = "model.bst"
|
||||
MODEL_FILENAME_JOBLIB = "model.joblib"
|
||||
MODEL_FILENAME_PKL = "model.pkl"
|
||||
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License 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 google.cloud.aiplatform.compat.types import (
|
||||
schedule as gca_schedule,
|
||||
)
|
||||
from google.cloud.aiplatform.constants import pipeline as pipeline_constants
|
||||
|
||||
_SCHEDULE_COMPLETE_STATES = set(
|
||||
[
|
||||
gca_schedule.Schedule.State.PAUSED,
|
||||
gca_schedule.Schedule.State.COMPLETED,
|
||||
]
|
||||
)
|
||||
|
||||
_SCHEDULE_ERROR_STATES = set(
|
||||
[
|
||||
gca_schedule.Schedule.State.STATE_UNSPECIFIED,
|
||||
]
|
||||
)
|
||||
|
||||
# Pattern for valid names used as a Vertex resource name.
|
||||
_VALID_NAME_PATTERN = pipeline_constants._VALID_NAME_PATTERN
|
||||
|
||||
# Pattern for an Artifact Registry URL.
|
||||
_VALID_AR_URL = pipeline_constants._VALID_AR_URL
|
||||
|
||||
# Pattern for any JSON or YAML file over HTTPS.
|
||||
_VALID_HTTPS_URL = pipeline_constants._VALID_HTTPS_URL
|
||||
Reference in New Issue
Block a user