tensorflow / models

Models and examples built with TensorFlow
Other
77.16k stars 45.75k forks source link

Receive 'module' object has no attribute 'rnn_cell' when running translate model #919

Closed aronayne closed 7 years ago

aronayne commented 7 years ago

tensorflow version 0.12.head Python version : 2.7.6 :

Attempting to run https://github.com/tensorflow/models/tree/master/tutorials/rnn/translate I receive :

File "/notebooks/models/tutorials/rnn/translate/seq2seq_model.py", line 117, in init single_cell = tf.nn.rnn_cell.GRUCell(size) AttributeError: 'module' object has no attribute 'rnn_cell'

Received this while running translate model : https://github.com/tensorflow/models/tree/master/tutorials/rnn/translate

This also recreates the error :

import tensorflow as tf print(tf.nn.rnn_cell.BasicRNNCell) returns :

import tensorflow as tf I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcudnn.so.5 locally I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcurand.so.8.0 locally print(tf.nn.rnn_cell.BasicRNNCell) Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'rnn_cell'

This issue appears related to https://github.com/zsdonghao/tensorlayer/issues/48 Suggested fix is to update to latest tensorflow version. I receive this error on head : 0.12.head

This issue has not been resolved ?

asimshankar commented 7 years ago

The tutorial is setup to work with the latest release (0.12.1) and not necessarily the head of the source tree (0.12.head).

We're currently making some API changes in preparation for a 1.0 release, after which the API should be much more stable. For example, GRUCell is in tf.contrib.rnn.GRUCell.

@nealwu @lukaszkaiser @xiejw : Is this tutorial supposed to be updated?

xiejw commented 7 years ago

@ebrevdo +ebrevdo here.

ebrevdo commented 7 years ago

What asim said 😊

asimshankar commented 7 years ago

Closing this out since the model is working with the latest stable release.

Graystripe17 commented 7 years ago

@asimshankar I have tensorflow 1.0.0 and this error shows up.

ebrevdo commented 7 years ago

The RNNCells have been temporarily moved to tf.contrib.rnn (tf.contrib.rnn.BasicRNNCell). They will hopefully be moved back out of contrib starting in TensorFlow 1.1.

On Fri, Feb 17, 2017 at 9:14 PM, Script Kitty notifications@github.com wrote:

@asimshankar https://github.com/asimshankar I have tensorflow 1.0.0 and this error shows up.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/919#issuecomment-280822882, or mute the thread https://github.com/notifications/unsubscribe-auth/ABtim3JZmRV5QHF_Y5XzB825ZgyfUKbpks5rdn5IgaJpZM4Lmv6Y .

ackdav commented 7 years ago

tf.contrib.rnn.BasicRNNCell is reachable but tf.contrib.rnn.NASCell throws the 'module' object has no attribute 'NASCell' error... where is NASCell? :)

nealwu commented 7 years ago

@derdav3 It looks like NASCell is only available starting in TensorFlow 1.1. You should install TensorFlow from source.

ebrevdo commented 7 years ago

You can also download a TensorFlow nightly:

https://github.com/tensorflow/tensorflow#installation

On Mon, Mar 27, 2017 at 2:31 PM, Neal Wu notifications@github.com wrote:

@derdav3 https://github.com/derdav3 It looks like NASCell https://www.tensorflow.org/versions/r1.1/api_docs/python/tf/contrib/rnn/NASCell is only available starting in TensorFlow 1.1. You should install TensorFlow from source https://www.tensorflow.org/install/install_sources.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/919#issuecomment-289592290, or mute the thread https://github.com/notifications/unsubscribe-auth/ABtim6DHg63n3AB7tkV-bCAiYYg49wlGks5rqCqogaJpZM4Lmv6Y .

batlogs commented 7 years ago

I have the below setup on macOS Sierra: Python 2.7.13 (default, Mar 28 2017, 18:03:28) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf tf.version '1.1.0-rc0'

But still I am getting
single_cell = tf.nn.rnn_cell.GRUCell(size) AttributeError: 'module' object has no attribute 'rnn_cell'

nealwu commented 7 years ago

@batlogs You want tf.contrib.rnn.GRUCell. In the future you can also just search the TensorFlow documentation to see if it solves your issue.