-
Notifications
You must be signed in to change notification settings - Fork 446
Expand file tree
/
Copy pathbase.py
More file actions
146 lines (131 loc) · 3.92 KB
/
base.py
File metadata and controls
146 lines (131 loc) · 3.92 KB
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
136
137
138
139
140
141
142
143
144
145
146
# -*- 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"
DEFAULT_UNIVERSE_DOMAIN = "googleapis.com"
SUPPORTED_REGIONS = frozenset({
"africa-south1",
"asia-east1",
"asia-east2",
"asia-northeast1",
"asia-northeast2",
"asia-northeast3",
"asia-south1",
"asia-south2",
"asia-southeast1",
"asia-southeast2",
"australia-southeast1",
"australia-southeast2",
"europe-central2",
"europe-north1",
"europe-north2",
"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-east7",
"us-south1",
"us-west1",
"us-west2",
"us-west3",
"us-west4",
"us-west8",
})
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__}"
)