xref: /aosp_15_r20/external/googleapis/google/cloud/aiplatform/v1/nas_job.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.aiplatform.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/aiplatform/v1/custom_job.proto";
22import "google/cloud/aiplatform/v1/encryption_spec.proto";
23import "google/cloud/aiplatform/v1/job_state.proto";
24import "google/cloud/aiplatform/v1/study.proto";
25import "google/protobuf/timestamp.proto";
26import "google/rpc/status.proto";
27
28option csharp_namespace = "Google.Cloud.AIPlatform.V1";
29option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb";
30option java_multiple_files = true;
31option java_outer_classname = "NasJobProto";
32option java_package = "com.google.cloud.aiplatform.v1";
33option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
34option ruby_package = "Google::Cloud::AIPlatform::V1";
35
36// Represents a Neural Architecture Search (NAS) job.
37message NasJob {
38  option (google.api.resource) = {
39    type: "aiplatform.googleapis.com/NasJob"
40    pattern: "projects/{project}/locations/{location}/nasJobs/{nas_job}"
41  };
42
43  // Output only. Resource name of the NasJob.
44  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
45
46  // Required. The display name of the NasJob.
47  // The name can be up to 128 characters long and can consist of any UTF-8
48  // characters.
49  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
50
51  // Required. The specification of a NasJob.
52  NasJobSpec nas_job_spec = 4 [(google.api.field_behavior) = REQUIRED];
53
54  // Output only. Output of the NasJob.
55  NasJobOutput nas_job_output = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
56
57  // Output only. The detailed state of the job.
58  JobState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
59
60  // Output only. Time when the NasJob was created.
61  google.protobuf.Timestamp create_time = 7
62      [(google.api.field_behavior) = OUTPUT_ONLY];
63
64  // Output only. Time when the NasJob for the first time entered the
65  // `JOB_STATE_RUNNING` state.
66  google.protobuf.Timestamp start_time = 8
67      [(google.api.field_behavior) = OUTPUT_ONLY];
68
69  // Output only. Time when the NasJob entered any of the following states:
70  // `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`.
71  google.protobuf.Timestamp end_time = 9
72      [(google.api.field_behavior) = OUTPUT_ONLY];
73
74  // Output only. Time when the NasJob was most recently updated.
75  google.protobuf.Timestamp update_time = 10
76      [(google.api.field_behavior) = OUTPUT_ONLY];
77
78  // Output only. Only populated when job's state is JOB_STATE_FAILED or
79  // JOB_STATE_CANCELLED.
80  google.rpc.Status error = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
81
82  // The labels with user-defined metadata to organize NasJobs.
83  //
84  // Label keys and values can be no longer than 64 characters
85  // (Unicode codepoints), can only contain lowercase letters, numeric
86  // characters, underscores and dashes. International characters are allowed.
87  //
88  // See https://goo.gl/xmQnxf for more information and examples of labels.
89  map<string, string> labels = 12;
90
91  // Customer-managed encryption key options for a NasJob.
92  // If this is set, then all resources created by the NasJob
93  // will be encrypted with the provided encryption key.
94  EncryptionSpec encryption_spec = 13;
95
96  // Optional. Enable a separation of Custom model training
97  // and restricted image training for tenant project.
98  bool enable_restricted_image_training = 14
99      [deprecated = true, (google.api.field_behavior) = OPTIONAL];
100}
101
102// Represents a NasTrial details along with its parameters. If there is a
103// corresponding train NasTrial, the train NasTrial is also returned.
104message NasTrialDetail {
105  option (google.api.resource) = {
106    type: "aiplatform.googleapis.com/NasTrialDetail"
107    pattern: "projects/{project}/locations/{location}/nasJobs/{nas_job}/nasTrialDetails/{nas_trial_detail}"
108  };
109
110  // Output only. Resource name of the NasTrialDetail.
111  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
112
113  // The parameters for the NasJob NasTrial.
114  string parameters = 2;
115
116  // The requested search NasTrial.
117  NasTrial search_trial = 3;
118
119  // The train NasTrial corresponding to
120  // [search_trial][google.cloud.aiplatform.v1.NasTrialDetail.search_trial].
121  // Only populated if
122  // [search_trial][google.cloud.aiplatform.v1.NasTrialDetail.search_trial] is
123  // used for training.
124  NasTrial train_trial = 4;
125}
126
127// Represents the spec of a NasJob.
128message NasJobSpec {
129  // The spec of multi-trial Neural Architecture Search (NAS).
130  message MultiTrialAlgorithmSpec {
131    // Represents a metric to optimize.
132    message MetricSpec {
133      // The available types of optimization goals.
134      enum GoalType {
135        // Goal Type will default to maximize.
136        GOAL_TYPE_UNSPECIFIED = 0;
137
138        // Maximize the goal metric.
139        MAXIMIZE = 1;
140
141        // Minimize the goal metric.
142        MINIMIZE = 2;
143      }
144
145      // Required. The ID of the metric. Must not contain whitespaces.
146      string metric_id = 1 [(google.api.field_behavior) = REQUIRED];
147
148      // Required. The optimization goal of the metric.
149      GoalType goal = 2 [(google.api.field_behavior) = REQUIRED];
150    }
151
152    // Represent spec for search trials.
153    message SearchTrialSpec {
154      // Required. The spec of a search trial job. The same spec applies to
155      // all search trials.
156      CustomJobSpec search_trial_job_spec = 1
157          [(google.api.field_behavior) = REQUIRED];
158
159      // Required. The maximum number of Neural Architecture Search (NAS) trials
160      // to run.
161      int32 max_trial_count = 2 [(google.api.field_behavior) = REQUIRED];
162
163      // Required. The maximum number of trials to run in parallel.
164      int32 max_parallel_trial_count = 3
165          [(google.api.field_behavior) = REQUIRED];
166
167      // The number of failed trials that need to be seen before failing
168      // the NasJob.
169      //
170      // If set to 0, Vertex AI decides how many trials must fail
171      // before the whole job fails.
172      int32 max_failed_trial_count = 4;
173    }
174
175    // Represent spec for train trials.
176    message TrainTrialSpec {
177      // Required. The spec of a train trial job. The same spec applies to
178      // all train trials.
179      CustomJobSpec train_trial_job_spec = 1
180          [(google.api.field_behavior) = REQUIRED];
181
182      // Required. The maximum number of trials to run in parallel.
183      int32 max_parallel_trial_count = 2
184          [(google.api.field_behavior) = REQUIRED];
185
186      // Required. Frequency of search trials to start train stage. Top N
187      // [TrainTrialSpec.max_parallel_trial_count]
188      // search trials will be trained for every M
189      // [TrainTrialSpec.frequency] trials searched.
190      int32 frequency = 3 [(google.api.field_behavior) = REQUIRED];
191    }
192
193    // The available types of multi-trial algorithms.
194    enum MultiTrialAlgorithm {
195      // Defaults to `REINFORCEMENT_LEARNING`.
196      MULTI_TRIAL_ALGORITHM_UNSPECIFIED = 0;
197
198      // The Reinforcement Learning Algorithm for Multi-trial Neural
199      // Architecture Search (NAS).
200      REINFORCEMENT_LEARNING = 1;
201
202      // The Grid Search Algorithm for Multi-trial Neural
203      // Architecture Search (NAS).
204      GRID_SEARCH = 2;
205    }
206
207    // The multi-trial Neural Architecture Search (NAS) algorithm
208    // type. Defaults to `REINFORCEMENT_LEARNING`.
209    MultiTrialAlgorithm multi_trial_algorithm = 1;
210
211    // Metric specs for the NAS job.
212    // Validation for this field is done at `multi_trial_algorithm_spec` field.
213    MetricSpec metric = 2;
214
215    // Required. Spec for search trials.
216    SearchTrialSpec search_trial_spec = 3
217        [(google.api.field_behavior) = REQUIRED];
218
219    // Spec for train trials. Top N [TrainTrialSpec.max_parallel_trial_count]
220    // search trials will be trained for every M
221    // [TrainTrialSpec.frequency] trials searched.
222    TrainTrialSpec train_trial_spec = 4;
223  }
224
225  // The Neural Architecture Search (NAS) algorithm specification.
226  oneof nas_algorithm_spec {
227    // The spec of multi-trial algorithms.
228    MultiTrialAlgorithmSpec multi_trial_algorithm_spec = 2;
229  }
230
231  // The ID of the existing NasJob in the same Project and Location
232  // which will be used to resume search. search_space_spec and
233  // nas_algorithm_spec are obtained from previous NasJob hence should not
234  // provide them again for this NasJob.
235  string resume_nas_job_id = 3;
236
237  // It defines the search space for Neural Architecture Search (NAS).
238  string search_space_spec = 1;
239}
240
241// Represents a uCAIP NasJob output.
242message NasJobOutput {
243  // The output of a multi-trial Neural Architecture Search (NAS) jobs.
244  message MultiTrialJobOutput {
245    // Output only. List of NasTrials that were started as part of search stage.
246    repeated NasTrial search_trials = 1
247        [(google.api.field_behavior) = OUTPUT_ONLY];
248
249    // Output only. List of NasTrials that were started as part of train stage.
250    repeated NasTrial train_trials = 2
251        [(google.api.field_behavior) = OUTPUT_ONLY];
252  }
253
254  // The output of this Neural Architecture Search (NAS) job.
255  oneof output {
256    // Output only. The output of this multi-trial Neural Architecture Search
257    // (NAS) job.
258    MultiTrialJobOutput multi_trial_job_output = 1
259        [(google.api.field_behavior) = OUTPUT_ONLY];
260  }
261}
262
263// Represents a uCAIP NasJob trial.
264message NasTrial {
265  // Describes a NasTrial state.
266  enum State {
267    // The NasTrial state is unspecified.
268    STATE_UNSPECIFIED = 0;
269
270    // Indicates that a specific NasTrial has been requested, but it has not yet
271    // been suggested by the service.
272    REQUESTED = 1;
273
274    // Indicates that the NasTrial has been suggested.
275    ACTIVE = 2;
276
277    // Indicates that the NasTrial should stop according to the service.
278    STOPPING = 3;
279
280    // Indicates that the NasTrial is completed successfully.
281    SUCCEEDED = 4;
282
283    // Indicates that the NasTrial should not be attempted again.
284    // The service will set a NasTrial to INFEASIBLE when it's done but missing
285    // the final_measurement.
286    INFEASIBLE = 5;
287  }
288
289  // Output only. The identifier of the NasTrial assigned by the service.
290  string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
291
292  // Output only. The detailed state of the NasTrial.
293  State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
294
295  // Output only. The final measurement containing the objective value.
296  Measurement final_measurement = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
297
298  // Output only. Time when the NasTrial was started.
299  google.protobuf.Timestamp start_time = 4
300      [(google.api.field_behavior) = OUTPUT_ONLY];
301
302  // Output only. Time when the NasTrial's status changed to `SUCCEEDED` or
303  // `INFEASIBLE`.
304  google.protobuf.Timestamp end_time = 5
305      [(google.api.field_behavior) = OUTPUT_ONLY];
306}
307