We train lots of variations of our model with different configuration and requiring different preprocessing of inputs (where the preprocessing is done outside of TensorFlow). I would like to export our models as SavedModels, and I am thinking that we will have an API server that will provide access to the models and handle preprocessing and talking to the TensorFlow server using config that it will retrieve from the model metadata via the TensorFlow server. The model metatdata might be a structured as a JSON, or possibly it could use a protocol buffer. I am unclear what best practices are around this. In particular, the MetaInfoDef protocol buffer has three different fields that seem designed to hold metadata (meta_graph_version
, any_info
, and tags
). But I couldn't find any examples in the wild of the use of any but the tags
field.
// User specified Version string. Can be the name of the model and revision,
// steps this model has been trained to, etc.
string meta_graph_version = 1;
[...]
// A serialized protobuf. Can be the time this meta graph is created, or
// modified, or name of the model.
google.protobuf.Any any_info = 3;
// User supplied tag(s) on the meta_graph and included graph_def.
//
// MetaGraphDefs should be tagged with their capabilities or use-cases.
// Examples: "train", "serve", "gpu", "tpu", etc.
// These tags enable loaders to access the MetaGraph(s) appropriate for a
// specific use-case or runtime environment.
repeated string tags = 4;
(although I am not sure that these three fields can all be retrieved in the same way using the client API to TensorFlow serving?)
signature_def_utils.build_signature_def
documentation shows options for onlyinput
,output
andmethod
. That said, it looks like one does not have to use theinput
options for input. It seems that anything could be stored there, as any actual key-value pair must be individually extracted for inferencing. This suggests that metadata could potentially be stored and read, without being used for inferencing. – Silkstocking