3

次のスニペットを使用して、以前にトレーニングされたモデル (pb) をサービスに使用するためにエクスポートしようとしています

from tensorflow_serving.session_bundle import exporter
def create_graph():
        """Creates a graph from saved GraphDef file and returns a saver."""
        # Creates graph from saved graph_def.pb.
        with tf.gfile.FastGFile(modelFullPath, 'rb') as f:
            graph_def = tf.GraphDef()
            graph_def.ParseFromString(f.read())
            _ = tf.import_graph_def(graph_def, name='')

def export():
        print 'Exporting trained model to', export_path
        saver = tf.train.Saver(sharded=True)
        model_exporter = exporter.Exporter(saver)
        signature = exporter.classification_signature(input_tensor=x, scores_tensor=y)
        model_exporter.init(sess.graph.as_graph_def(),default_graph_signature=signature) 
        model_exporter.export(export_path, tf.constant(FLAGS.export_version), sess)
        print 'Done exporting!'

ただし、exporter.py の manifest_pb2 が見つかりません。このアプローチで何か基本的なことが欠けていますか?

4

1 に答える 1