nmt icon indicating copy to clipboard operation
nmt copied to clipboard

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

Open nashid opened this issue 5 years ago • 7 comments

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'

nashid avatar Apr 03 '20 07:04 nashid

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

bjjoy avatar May 19 '20 11:05 bjjoy

@bjjoy so you have to install tensorflow 1.14?

I tried with tensorflow 1.5 which worked fine as well.

nashid avatar May 19 '20 22:05 nashid

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??

parikshit-ai avatar May 25 '20 09:05 parikshit-ai

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

If you found a solution, do keep us posted.

nashid avatar May 25 '20 17:05 nashid

@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

bjjoy avatar May 26 '20 04:05 bjjoy

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

luozhouyang avatar Jun 06 '20 03:06 luozhouyang

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

ArashHosseini avatar May 30 '22 19:05 ArashHosseini