What is difference between saving a model by
eg:
from tensorflow.contrib.session_bundle import exporter
#from tensorflow_serving.session_bundle import exporter
saver = tf.train.Saver(sharded=True)
model_exporter = exporter.Exporter(saver)
model_exporter.init(
sess.graph.as_graph_def(),
named_graph_signatures={
'inputs': exporter.generic_signature({'images': x}),
'outputs': exporter.generic_signature({'scores': y})})
model_exporter.export(export_path, tf.constant(FLAGS.export_version), sess)
eg:
with sess.graph.as_default():
saver = tf.train.Saver()
saver.save(sess, path, meta_graph_suffix='meta', write_meta_graph=True)
Question is in continuation of TensorFlow saving into/loading a graph from a file
Given the Exporter is now officially deprecated, the new protocol for saving graph and data is to use Saver. Here is an excellent blog with sample code: https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With