tensorflow / nmt

TensorFlow Neural Machine Translation Tutorial
Apache License 2.0
6.39k stars 1.96k forks source link

module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell #466

Open nashid opened 4 years ago

nashid commented 4 years ago

Code does not work with the latest Tensorflow library:

Traceback (most recent call last):
  File "/Users/XXXXX/opt/anaconda2/envs/XXXXXX/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/XXXXX/opt/anaconda2/envs/XXXXXX/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/XXXXX/Model/nmt/nmt.py", line 28, in <module>
    from . import inference
  File "/Users/XXXXX/Model/nmt/inference.py", line 25, in <module>
    from . import gnmt_model
  File "/Users/XXXXX/Model/nmt/gnmt_model.py", line 216, in <module>
    class GNMTAttentionMultiCell(tf.nn.rnn_cell.MultiRNNCell):
AttributeError: module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell'
bjjoy commented 4 years ago

Code does not work with the latest Tensorflow library:

Traceback (most recent call last):
  File "/Users/XXXXX/opt/anaconda2/envs/XXXXXX/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/XXXXX/opt/anaconda2/envs/XXXXXX/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/XXXXX/Model/nmt/nmt.py", line 28, in <module>
    from . import inference
  File "/Users/XXXXX/Model/nmt/inference.py", line 25, in <module>
    from . import gnmt_model
  File "/Users/XXXXX/Model/nmt/gnmt_model.py", line 216, in <module>
    class GNMTAttentionMultiCell(tf.nn.rnn_cell.MultiRNNCell):
AttributeError: module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell'

I have the same problem in tf 2.2.0. I change tf version to 1.14,problem has been solved

nashid commented 4 years ago

@bjjoy so you have to install tensorflow 1.14?

I tried with tensorflow 1.5 which worked fine as well.

parikshit-ai commented 4 years ago

Its not working with 2.1.x, I am using rasa which requires >=2.1 & <2.2 so can anyone tell me what is the concrete solution??

nashid commented 4 years ago

@parikshit-ai I presume you meant its not working with 2.1.x?

If you found a solution, do keep us posted.

bjjoy commented 4 years ago

@bjjoy so you have to install tensorflow 1.14?

I tried with tensorflow 1.5 which worked fine as well.

It should be 1.14==1.4. pip list to show tf version 1.14

luozhouyang commented 4 years ago

This code is not for tensorflow 2.x. tensorflow 2.x has many break changes.

ArashHosseini commented 2 years ago

@nashid you can use it with nvidia tf. i am using without any problem.