Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

GNMT inference dump error

khalique
Beginner
508 Views

I am using the following page to export an inference graph of GNMT from Tensorflow:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_GNMT_From_Tensorflow.html

 

I have already applied the patch to the commit hash provided in the tutorial. Once training the model, I ran inference with the recommended command:

python3 -m nmt.nmt \
    --src=de \
    --tgt=en \
    --ckpt=/tmp/nmt_out/translate.ckpt \
    --hparams_path=/home/khalique/tf_github/nmt/nmt/standard_hparams/wmt16_gnmt_4_layer.json \
    --vocab_prefix=/tmp/nmt_model/vocab.bpe.32000 \
    --out_dir="" \
    --dump_inference_model \
    --infer_mode beam_search \
    --path_to_dump /tmp/nmt_infer

and received the following error:

Dumping inference graph to /tmp/nmt_infer
Dumping done!
Freezing GNMT graph with output node index_to_string_Lookup...
WARNING:tensorflow:From /home/khalique/tf_github/nmt/nmt/inference.py:128: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants`
W1202 11:28:43.727387 139826626107136 deprecation.py:323] From /home/khalique/tf_github/nmt/nmt/inference.py:128: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants`
WARNING:tensorflow:From /home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/framework/graph_util_impl.py:270: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
W1202 11:28:43.727668 139826626107136 deprecation.py:323] From /home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/framework/graph_util_impl.py:270: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/khalique/tf_github/nmt/nmt/nmt.py", line 732, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/home/khalique/.local/lib/python3.5/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/khalique/.local/lib/python3.5/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "/home/khalique/tf_github/nmt/nmt/nmt.py", line 725, in main
    run_main(FLAGS, default_hparams, train_fn, inference_fn, inference_dump)
  File "/home/khalique/tf_github/nmt/nmt/nmt.py", line 684, in run_main
    inference_dump(ckpt, path_to_dump, hparams)
  File "/home/khalique/tf_github/nmt/nmt/inference.py", line 128, in inference_dump_graph
    [output_node_name])
  File "/home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "/home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/framework/graph_util_impl.py", line 270, in convert_variables_to_constants
    inference_graph = extract_sub_graph(input_graph_def, output_node_names)
  File "/home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "/home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/framework/graph_util_impl.py", line 182, in extract_sub_graph
    _assert_nodes_are_present(name_to_node, dest_nodes)
  File "/home/khalique/.local/lib/python3.5/site-packages/tensorflow/python/framework/graph_util_impl.py", line 137, in _assert_nodes_are_present
    assert d in name_to_node, "%s is not in graph" % d
AssertionError: index_to_string_Lookup is not in graph

 

I am using tensorflow version 1.14 with python3.5. Does the tutorial still work with this configuration? 

0 Kudos
0 Replies
Reply