Skip to content

Commit de2976b

Browse files
authored
Merge pull request #14 from sparklxb/master
golang client
2 parents a0af58b + ee33e88 commit de2976b

67 files changed

Lines changed: 4469 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
syntax = "proto3";
2+
3+
package tensorflow.serving;
4+
option cc_enable_arenas = true;
5+
6+
import "google/protobuf/wrappers.proto";
7+
8+
// Metadata for an inference request such as the model name and version.
9+
message ModelSpec {
10+
// Required servable name.
11+
string name = 1;
12+
13+
// Optional version. If unspecified, will use the latest (numerical) version.
14+
// Typically not needed unless coordinating across multiple models that were
15+
// co-trained and/or have inter-dependencies on the versions used at inference
16+
// time.
17+
google.protobuf.Int64Value version = 2;
18+
19+
// A named signature to evaluate. If unspecified, the default signature will
20+
// be used. Note that only MultiInference will initially support this.
21+
string signature_name = 3;
22+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
syntax = "proto3";
2+
3+
package tensorflow.serving;
4+
option cc_enable_arenas = true;
5+
6+
import "tensorflow/core/framework/tensor.proto";
7+
import "model.proto";
8+
9+
// PredictRequest specifies which TensorFlow model to run, as well as
10+
// how inputs are mapped to tensors and how outputs are filtered before
11+
// returning to user.
12+
message PredictRequest {
13+
// Model Specification.
14+
ModelSpec model_spec = 1;
15+
16+
// Input tensors.
17+
// Names of input tensor are alias names. The mapping from aliases to real
18+
// input tensor names is expected to be stored as named generic signature
19+
// under the key "inputs" in the model export.
20+
// Each alias listed in a generic signature named "inputs" should be provided
21+
// exactly once in order to run the prediction.
22+
map<string, TensorProto> inputs = 2;
23+
24+
// Output filter.
25+
// Names specified are alias names. The mapping from aliases to real output
26+
// tensor names is expected to be stored as named generic signature under
27+
// the key "outputs" in the model export.
28+
// Only tensors specified here will be run/fetched and returned, with the
29+
// exception that when none is specified, all tensors specified in the
30+
// named signature will be run/fetched and returned.
31+
repeated string output_filter = 3;
32+
}
33+
34+
// Response for PredictRequest on successful run.
35+
message PredictResponse {
36+
// Output tensors.
37+
map<string, TensorProto> outputs = 1;
38+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
syntax = "proto3";
2+
3+
package tensorflow.serving;
4+
option cc_enable_arenas = true;
5+
6+
import "predict.proto";
7+
8+
// PredictionService provides access to machine-learned models loaded by
9+
// model_servers.
10+
service PredictionService {
11+
// Predict -- provides access to loaded TensorFlow model.
12+
rpc Predict(PredictRequest) returns (PredictResponse);
13+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project.xcworkspace
2+
xcuserdata
3+
imagenet_comp_graph_label_strings.txt
4+
tensorflow_inception_graph.pb
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
gen/
2+
downloads/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tensorflow_inception_graph.pb
2+
imagenet_comp_graph_label_strings.txt
3+
tensorflow_inception_stripped.pb
4+
*/gen/
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
syntax = "proto3";
2+
3+
package tensorflow.serving;
4+
5+
// Signatures of model export.
6+
message Signatures {
7+
// Default signature of the graph.
8+
// WARNING(break-tutorial-inline-code): The following code snippet is
9+
// in-lined in tutorials, please update tutorial documents accordingly
10+
// whenever code changes.
11+
Signature default_signature = 1;
12+
13+
// Named signatures of the graph.
14+
map<string, Signature> named_signatures = 2;
15+
};
16+
17+
// A binding to a tensor including the name and, possibly in the future, type
18+
// or other metadata. For example, this may specify whether a tensor supports
19+
// batch vs single inference.
20+
message TensorBinding {
21+
// The name of the tensor to bind to.
22+
string tensor_name = 1;
23+
};
24+
25+
// An asset file or set of sharded files with the same name that will be bound
26+
// to a tensor at init / session_bundle load time.
27+
message AssetFile {
28+
// The tensor to bind the asset filename to.
29+
TensorBinding tensor_binding = 1;
30+
// The filename within the assets directory. Note: does not include the base
31+
// path or asset directory prefix. Base paths can and will change when models
32+
// are deployed for serving.
33+
string filename = 2;
34+
}
35+
36+
// A Signature specifies the inputs and outputs of commonly used graphs.
37+
message Signature {
38+
oneof type {
39+
RegressionSignature regression_signature = 1;
40+
ClassificationSignature classification_signature = 2;
41+
GenericSignature generic_signature = 3;
42+
}
43+
};
44+
45+
// RegressionSignature specifies a graph that takes an input and returns an
46+
// output.
47+
message RegressionSignature {
48+
TensorBinding input = 1;
49+
TensorBinding output = 2;
50+
};
51+
52+
// ClassificationSignature specifies a graph that takes an input and returns
53+
// classes and their scores.
54+
// WARNING(break-tutorial-inline-code): The following code snippet is
55+
// in-lined in tutorials, please update tutorial documents accordingly
56+
// whenever code changes.
57+
message ClassificationSignature {
58+
TensorBinding input = 1;
59+
TensorBinding classes = 2;
60+
TensorBinding scores = 3;
61+
};
62+
63+
// GenericSignature specifies a map from logical name to Tensor name.
64+
// Typical application of GenericSignature is to use a single GenericSignature
65+
// that includes all of the Tensor nodes and target names that may be useful at
66+
// serving, analysis or debugging time. The recommended name for this signature
67+
// in the ModelManifest is "generic_bindings".
68+
message GenericSignature {
69+
map<string, TensorBinding> map = 1;
70+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
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+
==============================================================================*/
15+
16+
syntax = "proto3";
17+
18+
package tensorflow;
19+
20+
message SpriteMetadata {
21+
string image_path = 1;
22+
// [width, height] of a single image in the sprite.
23+
repeated uint32 single_image_dim = 2;
24+
}
25+
26+
message EmbeddingInfo {
27+
string tensor_name = 1;
28+
string metadata_path = 2;
29+
string bookmarks_path = 3;
30+
// Shape of the 2D tensor [N x D]. If missing, it will be inferred from the
31+
// model checkpoint.
32+
repeated uint32 tensor_shape = 4;
33+
SpriteMetadata sprite = 5;
34+
// Path to the TSV file holding the tensor values. If missing, the tensor
35+
// is assumed to be stored in the model checkpoint.
36+
string tensor_path = 6;
37+
}
38+
39+
message ProjectorConfig {
40+
// Path to the checkpoint file. Use either this or model_checkpoint_dir.
41+
string model_checkpoint_path = 1;
42+
repeated EmbeddingInfo embeddings = 2;
43+
// Path to the checkpoint directory. The directory will be scanned for the
44+
// latest checkpoint file.
45+
string model_checkpoint_dir = 3;
46+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
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+
==============================================================================*/
15+
16+
syntax = "proto3";
17+
18+
package tensorflow;
19+
20+
import "tensorflow/core/util/event.proto";
21+
22+
// Reply message from EventListener to the client, i.e., to the source of the
23+
// Event protocal buffers, e.g., debug ops inserted by a debugged runtime to a
24+
// TensorFlow graph being executed.
25+
message EventReply {
26+
}
27+
28+
// EventListener: Receives Event protos, e.g., from debugged TensorFlow
29+
// runtime(s).
30+
service EventListener {
31+
// Client(s) can use this RPC method to send the EventListener Event protos.
32+
// The Event protos can hold information such as:
33+
// 1) intermediate tensors from a debugged graph being executed, which can
34+
// be sent from DebugIdentity ops configured with grpc URLs.
35+
// 2) GraphDefs of partition graphs, which can be sent from special debug
36+
// ops that get executed immediately after the beginning of the graph
37+
// execution.
38+
rpc SendEvents(stream Event) returns (stream EventReply);
39+
}

0 commit comments

Comments
 (0)