Closed NehaPathapati closed 6 years ago
The tensor2tensor trainer doesn't appear to package this feature as an argument or flag, nonetheless, it is possible using ash's answer from stack overflow:
`import tensorflow as tf from google.protobuf import text_format
with open('/tmp/myfile.pbtxt') as f: txt = f.read() gdef = text_format.Parse(txt, tf.GraphDef())
tf.train.write_graph(gdef, '/tmp', 'myfile.pb', as_text=False)`
Thanks @Littlenova
@Littlenova, I tried it and it says:
google.protobuf.text_format.ParseError: 1:1 : Message type "tensorflow.GraphDef" has no field named "saved_model_schema_version".
I tried it on the .pbtxt which was created using tensor2tensor.serving.export
Yes, I am facing the same issue too.
+1
google.protobuf.text_format.ParseError: 1:1 :
Message type "tensorflow.GraphDef" has no field named "saved_model_schema_version".
Actually the format is closer to MetaGraphDef
(but not exactly). Export file should be used with tensorflow-model-server
as described in https://github.com/tensorflow/tensor2tensor/tree/v1.9.0/tensor2tensor/serving
@marcbelmont Is it possible to freeze the savedmodel files (.pbtxt and variables) into .pb for mobile or embedded applications? I have got the same error in the process of doing that: google.protobuf.text_format.ParseError: 1:1 : Message type "tensorflow.GraphDef" has no field named "saved_model_schema_version".
@marcbelmont Is it possible to freeze the savedmodel files (.pbtxt and variables) into .pb for mobile or embedded applications? I have got the same error in the process of doing that: google.protobuf.text_format.ParseError: 1:1 : Message type "tensorflow.GraphDef" has no field named "saved_model_schema_version". I also encountered this problem. Have you solved it? ask for help. please my wechat rensheng_1994 mail:5625060@qq.com
Description
I would like to know how to export the tensor2tensor serving as a .pb file, rather than a .pbtxt file.
Alternately, how can I get the output node names from the checkpoints/.pbtxt file? ...
tensor2tensor==1.6.3 tensorflow==1.8.0
OS: CentOS
Python 2.7.5
For bugs: reproduction and error logs