From 662185f3f17b53c014192a1d5094b65e1d00ec3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20=C4=86urkovi=C4=87?= Date: Wed, 29 Jan 2025 09:42:53 +0100 Subject: [PATCH 1/2] feat: add prediction_log.proto --- proto/tensorflow_serving/apis/logging.proto | 17 +++++++ .../apis/prediction_log.proto | 49 +++++++++++++++++++ update.sh | 1 + 3 files changed, 67 insertions(+) create mode 100644 proto/tensorflow_serving/apis/logging.proto create mode 100644 proto/tensorflow_serving/apis/prediction_log.proto diff --git a/proto/tensorflow_serving/apis/logging.proto b/proto/tensorflow_serving/apis/logging.proto new file mode 100644 index 0000000..6298bb4 --- /dev/null +++ b/proto/tensorflow_serving/apis/logging.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package tensorflow.serving; + +import "tensorflow_serving/apis/model.proto"; +import "tensorflow_serving/config/logging_config.proto"; + +option cc_enable_arenas = true; + +// Metadata logged along with the request logs. +message LogMetadata { + ModelSpec model_spec = 1; + SamplingConfig sampling_config = 2; + // List of tags used to load the relevant MetaGraphDef from SavedModel. + repeated string saved_model_tags = 3; + // TODO(b/33279154): Add more metadata as mentioned in the bug. +} diff --git a/proto/tensorflow_serving/apis/prediction_log.proto b/proto/tensorflow_serving/apis/prediction_log.proto new file mode 100644 index 0000000..c75b68a --- /dev/null +++ b/proto/tensorflow_serving/apis/prediction_log.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; + +package tensorflow.serving; + +import "tensorflow_serving/apis/classification.proto"; +import "tensorflow_serving/apis/inference.proto"; +import "tensorflow_serving/apis/logging.proto"; +import "tensorflow_serving/apis/predict.proto"; +import "tensorflow_serving/apis/regression.proto"; +import "tensorflow_serving/apis/session_service.proto"; + +option cc_enable_arenas = true; + +message ClassifyLog { + ClassificationRequest request = 1; + ClassificationResponse response = 2; +} + +message RegressLog { + RegressionRequest request = 1; + RegressionResponse response = 2; +} + +message PredictLog { + PredictRequest request = 1; + PredictResponse response = 2; +} + +message MultiInferenceLog { + MultiInferenceRequest request = 1; + MultiInferenceResponse response = 2; +} + +message SessionRunLog { + SessionRunRequest request = 1; + SessionRunResponse response = 2; +} + +// Logged model inference request. +message PredictionLog { + LogMetadata log_metadata = 1; + oneof log_type { + ClassifyLog classify_log = 2; + RegressLog regress_log = 3; + PredictLog predict_log = 6; + MultiInferenceLog multi_inference_log = 4; + SessionRunLog session_run_log = 5; + } +} diff --git a/update.sh b/update.sh index 3939581..1e9f094 100755 --- a/update.sh +++ b/update.sh @@ -43,3 +43,4 @@ function importProto {( set -e for i in ${repo}/${apis}/*_service.proto; do importProto ${i#${repo}/} done +importProto ${apis}/prediction_log.proto From 3890e2432d2f076e1e2ae62fc03e4d211073eb2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20=C4=86urkovi=C4=87?= Date: Wed, 29 Jan 2025 09:48:34 +0100 Subject: [PATCH 2/2] chore: update to 2.18.0 --- VERSION | 2 +- proto/tensorflow/core/example/example.proto | 9 +- .../core/framework/attr_value.proto | 2 +- .../tensorflow/core/framework/full_type.proto | 166 ++++++++++-- proto/tensorflow/core/framework/graph.proto | 4 + .../core/framework/graph_debug_info.proto | 61 +++++ .../tensorflow/core/framework/node_def.proto | 7 + .../core/framework/resource_handle.proto | 2 + proto/tensorflow/core/framework/tensor.proto | 5 + proto/tensorflow/core/framework/types.proto | 29 +- proto/tensorflow/core/protobuf/cluster.proto | 3 + proto/tensorflow/core/protobuf/config.proto | 256 ++++++++++++------ .../core/protobuf/error_codes.proto | 155 +---------- .../tensorflow/core/protobuf/meta_graph.proto | 74 +---- .../core/protobuf/rewriter_config.proto | 30 +- .../core/protobuf/rpc_options.proto | 7 + .../core/protobuf/saved_object_graph.proto | 42 ++- proto/tensorflow/core/protobuf/struct.proto | 9 +- .../protobuf/trackable_object_graph.proto | 28 +- .../apis/classification.proto | 4 +- proto/tensorflow_serving/apis/logging.proto | 5 +- proto/tensorflow_serving/apis/model.proto | 9 +- .../apis/model_management.proto | 9 + proto/tensorflow_serving/apis/predict.proto | 145 +++++++++- .../apis/prediction_log.proto | 6 + .../tensorflow_serving/apis/regression.proto | 4 +- .../file_system_storage_path_source.proto | 11 +- .../config/logging_config.proto | 17 +- 28 files changed, 744 insertions(+), 357 deletions(-) create mode 100644 proto/tensorflow/core/framework/graph_debug_info.proto create mode 100644 proto/tensorflow/core/protobuf/rpc_options.proto diff --git a/VERSION b/VERSION index e70b452..cf86907 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.0 +2.18.0 diff --git a/proto/tensorflow/core/example/example.proto b/proto/tensorflow/core/example/example.proto index 0b49514..59e5428 100644 --- a/proto/tensorflow/core/example/example.proto +++ b/proto/tensorflow/core/example/example.proto @@ -12,7 +12,6 @@ option java_multiple_files = true; option java_package = "org.tensorflow.example"; option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example"; -// LINT.IfChange // An Example is a mostly-normalized data format for storing data for // training and inference. It contains a key-value store (features); where // each key (string) maps to a Feature message (which is oneof packed BytesList, @@ -22,10 +21,8 @@ option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example // read and write this format. That is, the Example is mostly *not* a // self-describing format. In TensorFlow, Examples are read in row-major // format, so any configuration that describes data with rank-2 or above -// should keep this in mind. For example, to store an M x N matrix of Bytes, -// the BytesList must contain M*N bytes, with M rows of N contiguous values -// each. That is, the BytesList value must store the matrix as: -// .... row 0 .... .... row 1 .... // ........... // ... row M-1 .... +// should keep this in mind. If you flatten a matrix into a FloatList it should +// be stored as [ row 0 ... row 1 ... row M-1 ] // // An Example for a movie recommendation application: // features { @@ -302,5 +299,3 @@ message SequenceExample { Features context = 1; FeatureLists feature_lists = 2; } -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/python/training/training.py) diff --git a/proto/tensorflow/core/framework/attr_value.proto b/proto/tensorflow/core/framework/attr_value.proto index 3ca031b..06024cc 100644 --- a/proto/tensorflow/core/framework/attr_value.proto +++ b/proto/tensorflow/core/framework/attr_value.proto @@ -27,7 +27,7 @@ message AttrValue { repeated TensorProto tensor = 8; // "list(tensor)" repeated NameAttrList func = 9; // "list(attr)" } - // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) + // LINT.ThenChange(//tensorflow/c/c_api.cc) oneof value { bytes s = 2; // "string" diff --git a/proto/tensorflow/core/framework/full_type.proto b/proto/tensorflow/core/framework/full_type.proto index 34e432a..0022abf 100644 --- a/proto/tensorflow/core/framework/full_type.proto +++ b/proto/tensorflow/core/framework/full_type.proto @@ -8,6 +8,7 @@ option java_multiple_files = true; option java_package = "org.tensorflow.framework"; option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework"; +// LINT.IfChange // Experimental. Represents the complete type information of a TensorFlow value. enum FullTypeId { // The default represents an uninitialized values. @@ -25,7 +26,7 @@ enum FullTypeId { // TFT_TENSOR[TFT_VAR["T"]], TFT_TENSOR[TFT_VAR["T"]] are two tensors of // identical element types. // TFT_TENSOR[TFT_VAR["P"]], TFT_TENSOR[TFT_VAR["Q"]] are two tensors of - // potentially different element types. + // independent element types. // TFT_VAR = 1; @@ -45,14 +46,53 @@ enum FullTypeId { // TFT_PRODUCT = 3; + // Represents a named field, with the name stored in the attribute. + // + // Parametrization: + // TFT_NAMED[]{} + // * is the type of the field + // * is the field name, as string (thpugh can theoretically be an int + // as well) + // + // Example: + // TFT_RECORD[ + // TFT_NAMED[TFT_TENSOR[TFT_INT32]]{'foo'}, + // TFT_NAMED[TFT_TENSOR[TFT_FLOAT32]]{'bar'}, + // ] + // is a structure with two fields, an int tensor "foo" and a float tensor + // "bar". + TFT_NAMED = 4; + + // Template definition. Expands the variables by repeating a template as + // arguments of container. + // + // Parametrization: + // TFT_FOR_EACH[,