Models: ptb_word_lm.py AttributeError: 'module' object has no attribute 'RNNParamsSaveable'

Created on 4 Nov 2017  Â·  16Comments  Â·  Source: tensorflow/models

when running ptb_word_lm.py with tf-nightly 1.5.0-dev20171103
I got this error

2017-11-04 16:48:59.759628: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] Creating     TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1)
2017-11-04 16:48:59.761131: E tensorflow/stream_executor/cuda/cuda_driver.cc:936] failed to allocate 221.62M (232390656 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY
WARNING:tensorflow:From /home/larry/workspace/tensorflow/models/tutorials/rnn/ptb/ptb_word_lm.py:165: get_or_create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.get_or_create_global_step
Traceback (most recent call last):
  File "/home/larry/workspace/tensorflow/models/tutorials/rnn/ptb/ptb_word_lm.py", line 527, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "/home/larry/workspace/tensorflow/models/tutorials/rnn/ptb/ptb_word_lm.py", line 502, in main
    model.import_ops()
  File "/home/larry/workspace/tensorflow/models/tutorials/rnn/ptb/ptb_word_lm.py", line 272, in import_ops
    params_saveable = tf.contrib.cudnn_rnn.RNNParamsSaveable(
AttributeError: 'module' object has no attribute 'RNNParamsSaveable'

It seems that there is no RNNParamsSaveable in cudnn_rnn
Any idea how to fix it?

Most helpful comment

did you add the --num_gpus=0
flag to the invocation?
you are getting the most recent version of PTB, thus you will also have to
do the edits to the code specified by withme6696 near the top of this bug
report to get it to run.
I did what he said and it works
and I suspect you need to be using TF R1.4 to have the new APIs that are
invoked

On Sat, Dec 9, 2017 at 1:04 AM, saurabhpanwar67412 <[email protected]

wrote:

i can't able to understand anything . whats going on . because i am new
here . let me tell you the complete process . i have downloaded and install
anaconda and the tensorflow packages to run the recurrent neural network
code given on the tensorflow website . and when i execute the code using
anaconda tensor flow enviornment and then the output what i got was above .
i will resolve it later . can you please execute the code for me . and tell
me the outcomes of recurrent neural network using tensorflow .. because i
have to submit it to the company where i applied for internship . please
help me if anyone could do it !

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/models/issues/2709#issuecomment-350434187,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIUuT7V41s5kV3mOwzpMcjSRb3Sb-Gbcks5s-k0xgaJpZM4QR8Kk
.

All 16 comments

Please provide details about what platform you are using (operating system, architecture). Also include your TensorFlow version. Also, did you compile from source or install a binary? Make sure you also include the exact command if possible to produce the output included in your test case. If you are unclear what to include see the issue template displayed in the Github new issue template.

We ask for this in the issue submission template, because it is really difficult to help without that information. Thanks!

Same problem here, (tensorflow 1.4.0 with python 3.6.3 with 1 GPU w2GB w CuDA8+CuDNN6.0,
Windows 7 Ultimate SP1)
$git clone https://github.com/tensorflow/models
$cd ~/models/tutorials/rnn/ptb
(download & unzip simple-samples.tar.gz)
$python ptb_word_lm.py --data_path=./simple-samples/data --model=small

Error messages as below:
Traceback (most recent call last):
File "ptb_word_lm.py", line 526, in
tf.app.run()
File "C:\Python36\lib\site-packagestensorflow\python\platformapp.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 502, in main
model.import_ops()
File "ptb_word_lm.py", line 272, in import_ops
params_saveable = tf.contrib.cudnn_rnn.RNNParamsSaveable(
AttributeError: module 'tensorflow.contrib.cudnn_rnn' has no attribute 'RNNParamsSaveable'

Same problem here, (tensorflow-gpu 1.4.0 with python 3.5.4 with 1 GPU w CuDA8+CUDNN6.0, Windows 10)

~/models/tutorials/rnn/ptb (master)
$ python ptb_word_lm.py --data_path=../../../simple-examples/data/ --model=small

Error messages as below:
WARNING:tensorflow:From ptb_word_lm.py:165: get_or_create_global_step (from tens orflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.get_or_create_global_step
Traceback (most recent call last):
File "ptb_word_lm.py", line 525, in
tf.app.run()
File "C:\Users\Enkimesh\Anaconda3envstensorflow-gpu\lib\site-packages\tensor flow\python\platformapp.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 501, in main
model.import_ops()
File "ptb_word_lm.py", line 271, in import_ops
params_saveable = tf.contrib.cudnn_rnn.RNNParamsSaveable(
AttributeError: module 'tensorflow.contrib.cudnn_rnn' has no attribute 'RNNParamsSaveable'

https://github.com/tensorflow/tensorflow/commit/b30ce471420384b931ba40fa21ba8838f12a79eb changed RNNParamsSaveable into multiple classes, and ptb_word_lm hasn't been updated yet. @ebrevdo, can you take a look?

can somebody offer a suggestion on how to change the following block from ptb_word_lm.py (or should this just be commented out). It would be interesting to compare the cuda9/cudnn7 r 1.4 build with the older R1.3 cuda8/cudnn6 buiild
rnn_params = tf.get_collection_ref("rnn_params")
if self._cell and rnn_params:
params_saveable = tf.contrib.cudnn_rnn.RNNParamsSaveable(
self._cell,
self._cell.params_to_canonical,
self._cell.canonical_to_params,
rnn_params,
base_variable_scope="Model/RNN")
tf.add_to_collection(tf.GraphKeys.SAVEABLE_OBJECTS, params_saveable)

commenting out the if block and the tf.add_to_collection line will get the code to run

I change the code as follows, then it works:
if self._cell and rnn_params:
params_saveable = tf.contrib.cudnn_rnn.CudnnLSTMSaveable(
rnn_params,
self._cell.num_layers,
self._cell.num_units,
self._cell.input_size,
self._cell.input_mode,
self._cell.direction,
scope="Model/RNN")
remove this line"tf.add_to_collection(tf.GraphKeys.SAVEABLE_OBJECTS, params_saveable)"

Traceback (most recent call last):
File "ptb_word_lm.py", line 527, in
tf.app.run()
File "C:\Users\saurabh\Anaconda2envstensorflow\lib\site-packagestensorflow\python\platformapp.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 454, in main
% (len(gpus), FLAGS.num_gpus))
ValueError: Your machine has only 0 gpus which is less than the requested --num_gpus=1.
please help me to solve this issue . its kinda urgent . i am trying implementing on cpu version . and here is the code link on tensorflow to which i am trying to execute . " https://www.tensorflow.org/tutorials/recurrent" .

This is a different issue.
I believe you have either built, installed a cuda build of TF. You need one
built for a CPU. Possibly with MKL.

On Fri, Dec 8, 2017 at 11:40 AM, saurabhpanwar67412 <
[email protected]> wrote:

Traceback (most recent call last):
File "ptb_word_lm.py", line 527, in
tf.app.run()
File "C:\Users\saurabh\Anaconda2envstensorflow\lib\site-
packagestensorflow\python\platformapp.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 454, in main
% (len(gpus), FLAGS.num_gpus))
ValueError: Your machine has only 0 gpus which is less than the requested
--num_gpus=1.
please help me to solve this issue . its kinda urgent . i am trying
implementing on cpu version . and here is the code link on tensorflow to
which i am trying to execute . " https://www.tensorflow.org/
tutorials/recurrent" . please anyone run the code and tell me the errors
to resolve it and send the the outcomes of this `tutorial on
saurabhpanwar67412@gmail,com or just tell me the error.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/models/issues/2709#issuecomment-350353413,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIUuT0CaqhPbWaqp3cfl4N_FCcwrJ3Khks5s-ZC6gaJpZM4QR8Kk
.

Or you just run with the extra command line argument

--num_gpus=0

?

On Fri, Dec 8, 2017 at 12:51 PM, David Levinthal Ph.D. <
[email protected]> wrote:

This is a different issue.
I believe you have either built, installed a cuda build of TF. You need one
built for a CPU. Possibly with MKL.

On Fri, Dec 8, 2017 at 11:40 AM, saurabhpanwar67412 <
[email protected]> wrote:

Traceback (most recent call last):
File "ptb_word_lm.py", line 527, in
tf.app.run()
File "C:\Users\saurabh\Anaconda2envstensorflow\lib\site-
packagestensorflow\python\platformapp.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 454, in main
% (len(gpus), FLAGS.num_gpus))
ValueError: Your machine has only 0 gpus which is less than the requested
--num_gpus=1.
please help me to solve this issue . its kinda urgent . i am trying
implementing on cpu version . and here is the code link on tensorflow to
which i am trying to execute . " https://www.tensorflow.org/
tutorials/recurrent" . please anyone run the code and tell me the errors
to resolve it and send the the outcomes of this `tutorial on
saurabhpanwar67412@gmail,com or just tell me the error.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/tensorflow/models/issues/2709#issuecomment-350353413
,
or mute the thread
auth/AIUuT0CaqhPbWaqp3cfl4N_FCcwrJ3Khks5s-ZC6gaJpZM4QR8Kk>

.

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

i can't able to understand anything . whats going on . because i am tried all possible way to resolve it . let me tell you the complete process . i have downloaded and install anaconda and the tensorflow packages to run the recurrent neural network code given on the tensorflow website . and when i execute the code using anaconda tensor flow environment and then the output what i got was above .

did you add the --num_gpus=0
flag to the invocation?
you are getting the most recent version of PTB, thus you will also have to
do the edits to the code specified by withme6696 near the top of this bug
report to get it to run.
I did what he said and it works
and I suspect you need to be using TF R1.4 to have the new APIs that are
invoked

On Sat, Dec 9, 2017 at 1:04 AM, saurabhpanwar67412 <[email protected]

wrote:

i can't able to understand anything . whats going on . because i am new
here . let me tell you the complete process . i have downloaded and install
anaconda and the tensorflow packages to run the recurrent neural network
code given on the tensorflow website . and when i execute the code using
anaconda tensor flow enviornment and then the output what i got was above .
i will resolve it later . can you please execute the code for me . and tell
me the outcomes of recurrent neural network using tensorflow .. because i
have to submit it to the company where i applied for internship . please
help me if anyone could do it !

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/models/issues/2709#issuecomment-350434187,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIUuT7V41s5kV3mOwzpMcjSRb3Sb-Gbcks5s-k0xgaJpZM4QR8Kk
.

you have to figure this out.

On Sat, Dec 9, 2017 at 10:36 AM, saurabhpanwar67412 <
[email protected]> wrote:

ok . Thank you so much ! but i can't able to still resolve it . i will
resolve it later . could you please execute the code for me . and tell me
the outcomes of recurrent neural network using tensorflow .. because i have
to submit it to the company where i applied for internship . please help me
if you could do it ! this internship really matters for me and last chance
to get internship for next 6 months . i need to submit the outcome only .
https://www.tensorflow.org/tutorials/recurrent
here is the link and we have to execute the command in "run the code"
section.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/models/issues/2709#issuecomment-350496687,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIUuT7qIwvKjZ2TUDZ7r_cAPXzXX3HAxks5s-tNHgaJpZM4QR8Kk
.

@withme6696 Hi, I follow you code. But what should I do with "params_saveable" next? Could you tell the details?

Hi There,
We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing.
If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

airmak picture airmak  Â·  3Comments

rakashi picture rakashi  Â·  3Comments

hanzy123 picture hanzy123  Â·  3Comments

jacknlliu picture jacknlliu  Â·  3Comments

frankkloster picture frankkloster  Â·  3Comments