This is related to #775 and #676.
With new iterator functionality, we can do something like
batched_iter = batched_dataset.make_initializable_iterator()
(src_ids, src_seq_len) = batched_iter.get_next()
initializer=batched_iter.initializer
This works when I run the code normally
src_placeholder = infer_model.graph.get_tensor_by_name("Placeholder:0")
batch_size_placeholder = infer_model.graph.get_tensor_by_name("Placeholder_1:0")
MakeIterator = infer_model.graph.get_operation_by_name('MakeIterator')
sess.run(MakeIterator, feed_dict={src_placeholder: input_0, batch_size_placeholder: input_1})
But for serving, I tried to create a single op as stated in #775 and #676 by using grouping or using control dependencies for the iterator initialisers and supplying that as the legacy_init_op to the SavedModel builder.
MakeIterator = graph.get_operation_by_name('MakeIterator')
builder = tf.saved_model.builder.SavedModelBuilder(export_path)
legacy_init_op = tf.group( tf.tables_initializer(), MakeIterator, name='legacy_init_op')
But when I try to start the port I get the following error
Loading servable: {name: "name"} failed: Invalid argument: You must feed a value for placeholder tensor "Placeholder" with dtype "dtype" and shape "shape"
Please provide a recommended method to serving dataset/iterator based model
Please go to Stack Overflow for help and support:
https://stackoverflow.com/questions/tagged/tensorflow-serving
If you open a GitHub issue, it must be a bug, a feature request, or a
significant problem with documentation (for small docs fixes please send
a PR instead).
Thanks!
so, how exactly can we sole the problem, no good solutions has found
Most helpful comment
so, how exactly can we sole the problem, no good solutions has found