martin-gorner / tensorflow-rnn-shakespeare

Code from the "Tensorflow and deep learning - without a PhD, Part 2" session on Recurrent Neural Networks.
Apache License 2.0
533 stars 249 forks source link

export to a SavedModel #24

Open mapmeld opened 6 years ago

mapmeld commented 6 years ago

Following up on our Twitter chat: I want to save a trained model from my text as a TensorFlow SavedModel. It'd be especially cool if that SavedModel can be accepted by tfjs-converter and run in the browser.

How I tried to export the model:

builder = tf.saved_model.builder.SavedModelBuilder('./sample')
with tf.Session() as sess:
   # current code
   ...
   ...
   builder.add_meta_graph_and_variables(sess, [tf.saved_model.tag_constants.TRAINING])
   builder.save()

I was able to see and export one tag-set (train) but it came with no SignatureDefs / MetaGraphDef tags, which is what I'm supposed to select in this process: https://github.com/tensorflow/tfjs-converter

martin-gorner commented 6 years ago

thanks for reporting this. I am looking into it.