nmt icon indicating copy to clipboard operation
nmt copied to clipboard

error when training the GNMT

Open ghost opened this issue 7 years ago • 6 comments

Hello, I want to train the GNMT for English-Chinese translation. I follow the example command for training the GNMT WMT German-English model, but there is an error:

Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/ec2-user/neural_machine_translation/nmt/nmt.py", line 28, in from . import inference File "nmt/inference.py", line 25, in from . import attention_model File "nmt/attention_model.py", line 22, in from . import model File "nmt/model.py", line 27, in from . import model_helper File "nmt/model_helper.py", line 9, in from tensorflow.python.ops import lookup_ops ImportError: cannot import name lookup_ops

I am running Tensorflow 1.1.0 with GPU support on Linux and it has been working fine for long.

ghost avatar Sep 15 '17 11:09 ghost

I guess the NMT model needs Tensorflow 1.2+.

chaoyu0804 avatar Sep 21 '17 08:09 chaoyu0804

I have tensorflow 1.6 installed. Still, I get a similar error. Here is a screenshot. Can you help me out?

tensor

Vab-jain avatar Mar 11 '18 12:03 Vab-jain

I have the same problem, hope someone help us , maybe it is related to tensorflow version?

MingLunHan avatar Mar 18 '18 02:03 MingLunHan

@Vab-jain Does remove the import and replace lookup_ops.index_to_string_table_from_file with tf.contrib.lookup.index_to_string_table_from_file works for you in tf 1.6?

oahziur avatar Mar 20 '18 00:03 oahziur

@oahziur is right and you may need to do following replacement too: tf.nn.rnn_ce.MultiRNNCell -> tf.contrib.rnn.MultiRNNCell ...

However, tf.data.TextLineDataset() is a new function from tf 1.4, so it seems impossible to use tf 1.1 to run this project.

knightmarehs avatar May 07 '18 07:05 knightmarehs

which lines should be replace

arunvarma99910 avatar Jul 11 '20 05:07 arunvarma99910