model_service.proto 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. // Copyright 2016 Google Inc.
  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. syntax = "proto3";
  15. package google.cloud.ml.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/longrunning/operations.proto";
  18. import "google/protobuf/empty.proto";
  19. import "google/protobuf/timestamp.proto";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "ModelServiceProto";
  22. option java_package = "com.google.cloud.ml.api.v1beta1";
  23. // Copyright 2016 Google Inc. All Rights Reserved.
  24. //
  25. // Proto file for the Machine Learning Service
  26. // Describes the 'models service' to work with the 'model' and 'version'
  27. // resources.
  28. // Allows managing the set of machine learning models and model versions
  29. // in the project.
  30. service ModelService {
  31. // Create a model which will later contain a set of model versions.
  32. rpc CreateModel(CreateModelRequest) returns (Model) {
  33. option (google.api.http) = { post: "/v1beta1/{parent=projects/*}/models" body: "model" };
  34. }
  35. // List models in the project.
  36. rpc ListModels(ListModelsRequest) returns (ListModelsResponse) {
  37. option (google.api.http) = { get: "/v1beta1/{parent=projects/*}/models" };
  38. }
  39. // Describe a model and versions in it.
  40. rpc GetModel(GetModelRequest) returns (Model) {
  41. option (google.api.http) = { get: "/v1beta1/{name=projects/*/models/*}" };
  42. }
  43. // Delete the model and all versions in it.
  44. rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) {
  45. option (google.api.http) = { delete: "/v1beta1/{name=projects/*/models/*}" };
  46. }
  47. // Upload a trained TensorFlow model version. The result of the operation
  48. // is a Version.
  49. rpc CreateVersion(CreateVersionRequest) returns (google.longrunning.Operation) {
  50. option (google.api.http) = { post: "/v1beta1/{parent=projects/*/models/*}/versions" body: "version" };
  51. }
  52. // List versions in the model.
  53. rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) {
  54. option (google.api.http) = { get: "/v1beta1/{parent=projects/*/models/*}/versions" };
  55. }
  56. // Get version metadata.
  57. rpc GetVersion(GetVersionRequest) returns (Version) {
  58. option (google.api.http) = { get: "/v1beta1/{name=projects/*/models/*/versions/*}" };
  59. }
  60. // Delete a version.
  61. rpc DeleteVersion(DeleteVersionRequest) returns (google.longrunning.Operation) {
  62. option (google.api.http) = { delete: "/v1beta1/{name=projects/*/models/*/versions/*}" };
  63. }
  64. // Mark the version as default within the model.
  65. rpc SetDefaultVersion(SetDefaultVersionRequest) returns (Version) {
  66. option (google.api.http) = { post: "/v1beta1/{name=projects/*/models/*/versions/*}:setDefault" body: "*" };
  67. }
  68. }
  69. // Represents a machine learning model resource that can be used to perform
  70. // prediction.
  71. message Model {
  72. // Required. The user-specified name of the model.
  73. string name = 1;
  74. // Optional. The description of the model.
  75. string description = 2;
  76. // Output only. The default version of the model.
  77. Version default_version = 3;
  78. }
  79. // Represents a version of the model.
  80. message Version {
  81. // Required.The user-specified name of the model version.
  82. string name = 1;
  83. // Optional. The description of the model version.
  84. string description = 2;
  85. // Output only. Whether the version is default within the model.
  86. bool is_default = 3;
  87. // Required. Google Cloud Storage object containing the model graph, weights
  88. // and additional metadata at the moment when the version is created.
  89. string deployment_uri = 4;
  90. // Output only. The creation time of the version.
  91. google.protobuf.Timestamp create_time = 5;
  92. // Output only. The last usage time of the version.
  93. google.protobuf.Timestamp last_use_time = 6;
  94. }
  95. // Request message for the CreateModel method.
  96. message CreateModelRequest {
  97. // Required. The project name.
  98. // Authorization: requires `Editor` role on the specified project.
  99. string parent = 1;
  100. // Required. The model to create.
  101. Model model = 2;
  102. }
  103. // Request message for the ListModels method.
  104. message ListModelsRequest {
  105. // Required. The name of the project whose models are to be listed.
  106. // Authorization: requires `Viewer` role on the specified project.
  107. string parent = 1;
  108. // Optional. Specifies the subset of models to retrieve.
  109. string filter = 2;
  110. // Optional. Specifies the ordering of the models.
  111. string order_by = 3;
  112. // Optional. A token for for continuing the enumeration.
  113. string page_token = 4;
  114. // Optional. The page size.
  115. int32 page_size = 5;
  116. }
  117. // Response message for the ListModels method.
  118. message ListModelsResponse {
  119. // The list of models.
  120. repeated Model models = 1;
  121. // Optional pagination token to use for retrieving the next page of results.
  122. string next_page_token = 2;
  123. }
  124. // Request message for the GetModel method.
  125. message GetModelRequest {
  126. // Required. The name of the model.
  127. // Authorization: requires `Viewer` role on the parent project.
  128. string name = 1;
  129. }
  130. // Request message for the DeleteModel method.
  131. message DeleteModelRequest {
  132. // Required. The name of the model.
  133. // Authorization: requires `Editor` role on the parent project.
  134. string name = 1;
  135. }
  136. // Uploads the provided trained model version to Cloud Machine Learning.
  137. message CreateVersionRequest {
  138. // Required. The name of the model.
  139. // Authorization: requires `Editor` role on the parent project.
  140. string parent = 1;
  141. // Required. The version details.
  142. Version version = 2;
  143. }
  144. // Request message for the ListVersions method.
  145. message ListVersionsRequest {
  146. // Required. The name of the model whose versions are to be listed.
  147. // Authorization: requires `Viewer` role on the parent project.
  148. string parent = 1;
  149. // Optional. Specifies the subset of versions to retrieve.
  150. string filter = 2;
  151. // Optional. Specifies the ordering of the versions.
  152. string order_by = 3;
  153. // Optional. A token for continuing the enumeration.
  154. string page_token = 4;
  155. // Optional. The page size.
  156. int32 page_size = 5;
  157. }
  158. // Response message for the ListVersions method.
  159. message ListVersionsResponse {
  160. // The list of versions.
  161. repeated Version versions = 1;
  162. // Optional pagination token to use for retrieving the next page of results.
  163. string next_page_token = 2;
  164. }
  165. // Request message for the GetVersion method.
  166. message GetVersionRequest {
  167. // Required. The name of the version.
  168. // Authorization: requires `Viewer` role on the parent project.
  169. string name = 1;
  170. }
  171. // Request message for the DeleteVersion method.
  172. message DeleteVersionRequest {
  173. // Required. The name of the version.
  174. string name = 1;
  175. }
  176. // Request message for the SetDefaultVersion request.
  177. message SetDefaultVersionRequest {
  178. // Required. The version name which is being made default within the model.
  179. // Authorization: requires `Editor` role on the parent project.
  180. string name = 1;
  181. }