From 0617088d3377112fd1802ae97b8cb44b69e249d2 Mon Sep 17 00:00:00 2001 From: ericdnielsen Date: Tue, 11 Feb 2020 11:48:21 -0500 Subject: [PATCH 1/5] Update export/write services to add needed fields & calls for eventual tensor storage --- .../uploader/proto/export_service.proto | 32 +++++++++++--- .../uploader/proto/write_service.proto | 43 ++++++++++++++++++- 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/tensorboard/uploader/proto/export_service.proto b/tensorboard/uploader/proto/export_service.proto index a8dba432dc..4912687ce6 100644 --- a/tensorboard/uploader/proto/export_service.proto +++ b/tensorboard/uploader/proto/export_service.proto @@ -4,6 +4,7 @@ package tensorboard.service; import "google/protobuf/timestamp.proto"; import "tensorboard/compat/proto/summary.proto"; +import "tensorboard/compat/proto/tensor.proto"; // Service for exporting data from TensorBoard.dev. service TensorBoardExporterService { @@ -87,6 +88,9 @@ message Experiment { // The number of distinct tag names in this experiment. A tag name that // appears in multiple runs will be counted only once. int64 num_tags = 6; + // The number of bytes used for storage of tensors in this experiment, + // across all time series, including estimated overhead. + int64 total_tensor_bytes = 7; } // Field mask for `Experiment`. The `experiment_id` field is always implicitly @@ -101,6 +105,7 @@ message ExperimentMask { bool num_scalars = 4; bool num_runs = 5; bool num_tags = 6; + bool total_tensor_bytes = 7; } // Request to stream scalars from all the runs and tags in an experiment. @@ -114,15 +119,15 @@ message StreamExperimentDataRequest { google.protobuf.Timestamp read_timestamp = 2; } -// Streams scalars from all the runs and tags in an experiment. Each stream +// Streams data from all the runs and tags in an experiment. Each stream // result only contains data for a single tag from a single run. For example if // there are five runs and each run had two tags, the RPC will return a stream // of at least ten `StreamExperimentDataResponse`s, each one having the -// scalars for one tag. The values from a single tag may be split among multiple -// responses. Users need to aggregate information from entire stream to get -// data for the entire experiment. Empty experiments will have zero stream -// results. Empty runs that doesn't have any tags need not be supported by a -// hosted service. +// either scalars or tensors for one tag. The values from a single tag may be +// split among multiple responses. Users need to aggregate information from +// entire stream to get data for the entire experiment. Empty experiments will +// have zero stream results. Empty runs that doesn't have any tags need not +// be supported by a hosted service. message StreamExperimentDataResponse { // Name of the tag whose data is contained in this response. string tag_name = 1; @@ -132,6 +137,8 @@ message StreamExperimentDataResponse { .tensorboard.SummaryMetadata tag_metadata = 3; // Data to store for the tag `tag_name. ScalarPoints points = 4; + // Tensor data to store. + TensorPoints tensors = 5; // Data for the scalars are stored in a columnar fashion to optimize it for // exporting the data into textual formats like JSON. @@ -145,4 +152,17 @@ message StreamExperimentDataResponse { // Value of the point at this step / timestamp. repeated double values = 3; } + + // Data for the Tensors are stored in a columnar fashion to optimize it for + // exporting the data into textual formats like JSON. + // The data for the ith scalar is { steps[i], wall_times[i], values[i] }. + // The data here is sorted by step values in ascending order. + message TensorPoints { + // Step index within the run. + repeated int64 steps = 1; + // Timestamp of the creation of this point. + repeated google.protobuf.Timestamp wall_times = 2; + // Value of the point at this step / timestamp. + repeated .tensorboard.Tensor values = 3; + } } diff --git a/tensorboard/uploader/proto/write_service.proto b/tensorboard/uploader/proto/write_service.proto index 4d63f22f69..3fffe7135a 100644 --- a/tensorboard/uploader/proto/write_service.proto +++ b/tensorboard/uploader/proto/write_service.proto @@ -18,8 +18,10 @@ service TensorBoardWriterService { // Request that unreachable data be purged. Used only for testing; // disabled in production. rpc PurgeData(PurgeDataRequest) returns (PurgeDataResponse) {} - // Request additional data be stored in TensorBoard.dev. + // Request additional scalar data be stored in TensorBoard.dev. rpc WriteScalar(WriteScalarRequest) returns (WriteScalarResponse) {} + // Request additional tensor data be stored in TensorBoard.dev. + rpc WriteScalar(WriteTensorRequest) returns (WriteScalarResponse) {} // Request that the calling user and all their data be permanently deleted. // Used for testing purposes. rpc DeleteOwnUser(DeleteOwnUserRequest) returns (DeleteOwnUserResponse) {} @@ -119,6 +121,45 @@ message WriteScalarResponse { // This is empty on purpose. } +// Carries all that is needed to add tensor data to the hosted service. +message WriteTensorRequest { + // All the data to store for one Run. This data will be stored under the + // corresponding run in the hosted storage. WriteTensorRequest is merged into + // the data store for the keyed run. The tags and included tensors will be + // the union of the data sent across all WriteTensorRequests. Metadata by + // default uses a 'first write wins' approach. + message Run { + // The name of this run. For example "/some/path/mnist_experiments/run1/" + string name = 1; + // Data to store for this Run/Tag combination. + repeated Tag tags = 2; + } + + // All the data to store for one Tag of one Run. This data will be stored + // under the corresponding run/tag in the hosted storage. A tag corresponds to + // a single time series. + message Tag { + // The name of this tag. For example "loss" + string name = 1; + // Data to store for this Run/Tag combination. + repeated TensorPoint points = 2; + // The metadata of this tag. + .tensorboard.SummaryMetadata metadata = 3; + } + + // Which experiment to write to - corresponding to one hosted TensorBoard URL. + // The requester must have authorization to write to this location. + string experiment_id = 1; + // Data to append to the existing storage at the experiment_id. + repeated Run runs = 2; +} + +// Everything the caller needs to know about how the writing went. +// (Currently empty) +message WriteScalarResponse { + // This is empty on purpose. +} + // Requests that the calling user and all their data be permanently deleted. message DeleteOwnUserRequest { // This is empty on purpose. From 5261f31b3975d99af0134b11553ee1ca29e9cbdc Mon Sep 17 00:00:00 2001 From: ericdnielsen Date: Tue, 11 Feb 2020 12:50:44 -0500 Subject: [PATCH 2/5] added tensor.proto --- tensorboard/uploader/proto/BUILD | 1 + tensorboard/uploader/proto/tensor.proto | 29 +++++++++++++++++++ .../uploader/proto/write_service.proto | 1 + 3 files changed, 31 insertions(+) create mode 100644 tensorboard/uploader/proto/tensor.proto diff --git a/tensorboard/uploader/proto/BUILD b/tensorboard/uploader/proto/BUILD index bb702af388..fd602ec3a3 100644 --- a/tensorboard/uploader/proto/BUILD +++ b/tensorboard/uploader/proto/BUILD @@ -13,6 +13,7 @@ tb_proto_library( "export_service.proto", "scalar.proto", "server_info.proto", + "tensor.ptoto", "write_service.proto", ], has_services = True, diff --git a/tensorboard/uploader/proto/tensor.proto b/tensorboard/uploader/proto/tensor.proto new file mode 100644 index 0000000000..6403fb9dd2 --- /dev/null +++ b/tensorboard/uploader/proto/tensor.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package tensorboard.service; + +import "google/protobuf/timestamp.proto"; +import "tensorboard/compat/proto/summary.proto"; +import "tensorboard/compat/proto/tensor.proto"; + +// One point viewable on a tensor metric plot. +message TensorPoint { + // Step index within the run. + int64 step = 1; + // Timestamp of the creation of this point. + google.protobuf.Timestamp wall_time = 2; + // Value of the point at this step / timestamp. + .tensorboard.Tensor value = 3; +} + +// Metadata for the TensorPoints stored for one (Experiment, Run, Tag). +message TensorPointMetadata { + // Maximum step recorded for the tag. + int64 max_step = 1; + // Timestamp corresponding to the max step. + google.protobuf.Timestamp max_wall_time = 2; + // Information about the plugin which created this tensor data. + // Note: The period is required part of the type here due to the + // package name resolution logic. + .tensorboard.SummaryMetadata summary_metadata = 3; +} diff --git a/tensorboard/uploader/proto/write_service.proto b/tensorboard/uploader/proto/write_service.proto index 3fffe7135a..c512e0e272 100644 --- a/tensorboard/uploader/proto/write_service.proto +++ b/tensorboard/uploader/proto/write_service.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package tensorboard.service; import "tensorboard/uploader/proto/scalar.proto"; +import "tensorboard/uploader/proto/tensor.proto"; import "tensorboard/compat/proto/summary.proto"; // Service for writing data to TensorBoard.dev. From 67ea8bfc3f01d49cb47a7955598ebb9126bd3245 Mon Sep 17 00:00:00 2001 From: ericdnielsen Date: Tue, 11 Feb 2020 13:16:10 -0500 Subject: [PATCH 3/5] typo --- tensorboard/uploader/proto/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorboard/uploader/proto/BUILD b/tensorboard/uploader/proto/BUILD index fd602ec3a3..f96ce1264a 100644 --- a/tensorboard/uploader/proto/BUILD +++ b/tensorboard/uploader/proto/BUILD @@ -13,7 +13,7 @@ tb_proto_library( "export_service.proto", "scalar.proto", "server_info.proto", - "tensor.ptoto", + "tensor.proto", "write_service.proto", ], has_services = True, From ba3a484a30eb311baf6b208d073f3314a6d3f404 Mon Sep 17 00:00:00 2001 From: ericdnielsen Date: Tue, 11 Feb 2020 15:30:04 -0500 Subject: [PATCH 4/5] resolving more path/typo/naming issues --- tensorboard/uploader/proto/export_service.proto | 2 +- tensorboard/uploader/proto/tensor.proto | 2 +- tensorboard/uploader/proto/write_service.proto | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tensorboard/uploader/proto/export_service.proto b/tensorboard/uploader/proto/export_service.proto index 4912687ce6..aa3e829e4e 100644 --- a/tensorboard/uploader/proto/export_service.proto +++ b/tensorboard/uploader/proto/export_service.proto @@ -163,6 +163,6 @@ message StreamExperimentDataResponse { // Timestamp of the creation of this point. repeated google.protobuf.Timestamp wall_times = 2; // Value of the point at this step / timestamp. - repeated .tensorboard.Tensor values = 3; + repeated .tensorboard.TensorProto values = 3; } } diff --git a/tensorboard/uploader/proto/tensor.proto b/tensorboard/uploader/proto/tensor.proto index 6403fb9dd2..7dee592640 100644 --- a/tensorboard/uploader/proto/tensor.proto +++ b/tensorboard/uploader/proto/tensor.proto @@ -13,7 +13,7 @@ message TensorPoint { // Timestamp of the creation of this point. google.protobuf.Timestamp wall_time = 2; // Value of the point at this step / timestamp. - .tensorboard.Tensor value = 3; + .tensorboard.TensorProto value = 3; } // Metadata for the TensorPoints stored for one (Experiment, Run, Tag). diff --git a/tensorboard/uploader/proto/write_service.proto b/tensorboard/uploader/proto/write_service.proto index c512e0e272..296f6bef1d 100644 --- a/tensorboard/uploader/proto/write_service.proto +++ b/tensorboard/uploader/proto/write_service.proto @@ -22,7 +22,7 @@ service TensorBoardWriterService { // Request additional scalar data be stored in TensorBoard.dev. rpc WriteScalar(WriteScalarRequest) returns (WriteScalarResponse) {} // Request additional tensor data be stored in TensorBoard.dev. - rpc WriteScalar(WriteTensorRequest) returns (WriteScalarResponse) {} + rpc WriteTensor(WriteTensorRequest) returns (WriteTensorResponse) {} // Request that the calling user and all their data be permanently deleted. // Used for testing purposes. rpc DeleteOwnUser(DeleteOwnUserRequest) returns (DeleteOwnUserResponse) {} @@ -157,7 +157,7 @@ message WriteTensorRequest { // Everything the caller needs to know about how the writing went. // (Currently empty) -message WriteScalarResponse { +message WriteTensorResponse { // This is empty on purpose. } From e6318dc12e8be8abfef2e9ea767cf344f4feab87 Mon Sep 17 00:00:00 2001 From: ericdnielsen Date: Wed, 12 Feb 2020 16:22:46 -0500 Subject: [PATCH 5/5] One missed scalar->tensor reference --- tensorboard/uploader/proto/export_service.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorboard/uploader/proto/export_service.proto b/tensorboard/uploader/proto/export_service.proto index cff63032b4..22d5660908 100644 --- a/tensorboard/uploader/proto/export_service.proto +++ b/tensorboard/uploader/proto/export_service.proto @@ -164,7 +164,7 @@ message StreamExperimentDataResponse { // Data for the Tensors are stored in a columnar fashion to optimize it for // exporting the data into textual formats like JSON. - // The data for the ith scalar is { steps[i], wall_times[i], values[i] }. + // The data for the ith tensor is { steps[i], wall_times[i], values[i] }. // The data here is sorted by step values in ascending order. message TensorPoints { // Step index within the run.