Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keras 2.2.0 compatability with Tensorflow 1.3.0 #10440

Closed
jayavardhanr opened this Issue Jun 14, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@jayavardhanr
Copy link

jayavardhanr commented Jun 14, 2018

Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or join the Keras Slack channel and ask there instead of filing a GitHub issue.

Thank you!

  • [ x] Check that you are up-to-date with the master branch of Keras. You can update with:
    pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps

  • [x ] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.

  • [x ] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
    pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps

  • [ x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).

import tensorflow as tf
import keras
print(tf.__version__) #1.3.0
print(keras.__version__) #2.2.0
from keras.layers import Input, LSTM, RepeatVector

dropout=0.6
inputs = Input(shape=(60, 7,))
encoded = LSTM(200,name='encoder', recurrent_dropout=dropout, dropout=dropout)(inputs)
decoded = RepeatVector(60)(encoded)
decoded = LSTM(7, return_sequences=True, name='decoder', recurrent_dropout=dropout, dropout=dropout)(decoded)
autoencoder = Model(inputs, decoded)
autoencoder.compile(optimizer='adam', loss='mse')

Error:

TypeErrorTraceback (most recent call last)
<ipython-input-10-42ad0225d0f5> in <module>()
      7 dropout=0.6
      8 inputs = Input(shape=(60, 7,))
----> 9 encoded = LSTM(200,name='encoder',recurrent_dropout=dropout,dropout=dropout)(inputs)
     10 decoded = RepeatVector(60)(encoded)
     11 decoded = LSTM(7, return_sequences=True,name='decoder',recurrent_dropout=dropout,dropout=dropout)(decoded)

/opt/miniconda/envs/py2/lib/python2.7/site-packages/keras/layers/recurrent.pyc in __call__(self, inputs, initial_state, constants, **kwargs)
    498 
    499         if initial_state is None and constants is None:
--> 500             return super(RNN, self).__call__(inputs, **kwargs)
    501 
    502         # If any of `initial_state` or `constants` are specified and are Keras

/opt/miniconda/envs/py2/lib/python2.7/site-packages/keras/engine/base_layer.pyc in __call__(self, inputs, **kwargs)
    458             # Actually call the layer,
    459             # collecting output(s), mask(s), and shape(s).
--> 460             output = self.call(inputs, **kwargs)
    461             output_mask = self.compute_mask(inputs, previous_mask)
    462 

/opt/miniconda/envs/py2/lib/python2.7/site-packages/keras/layers/recurrent.pyc in call(self, inputs, mask, training, initial_state)
   2110                                       mask=mask,
   2111                                       training=training,
-> 2112                                       initial_state=initial_state)
   2113 
   2114     @property

/opt/miniconda/envs/py2/lib/python2.7/site-packages/keras/layers/recurrent.pyc in call(self, inputs, mask, training, initial_state, constants)
    607                                              mask=mask,
    608                                              unroll=self.unroll,
--> 609                                              input_length=timesteps)
    610         if self.stateful:
    611             updates = []

/opt/miniconda/envs/py2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.pyc in rnn(step_function, inputs, initial_states, go_backwards, mask, constants, unroll, input_length)
   2955             parallel_iterations=32,
   2956             swap_memory=True,
-> 2957             maximum_iterations=input_length)
   2958         last_time = final_outputs[0]
   2959         output_ta = final_outputs[1]

TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

The same code works fine with Tensor flow 1.3.0 and Keras 2.1.2.

@fchollet

This comment has been minimized.

Copy link
Collaborator

fchollet commented Jun 14, 2018

As a general rule, the latest release of Keras is compatible with the latest release of TensorFlow as well as the previous release of TensorFlow (in most cases, it is actually compatible with several prior TF releases, but that is not guaranteed).

TF 1.3 is now 5 releases behind (soon to be 6, since 1.9rc is already out), so you should either use a prior version of Keras or use an updated version of TensorFlow.

@sssdjj

This comment has been minimized.

Copy link

sssdjj commented Nov 12, 2018

File "chinese_binary.py", line 49, in
model = utils.build_netword(catalogue=utils.BINARY_FLAG, dict=dict, embedding_size=embedding_size, max_sequence_length=max_sequence_length)
File "/data/home/rc/sunyongsong/keras_lstm/utils.py", line 85, in build_netword
model.add(krs.layers.wrappers.Bidirectional(krs.layers.LSTM(32, dropout=0.2, recurrent_dropout=0.2),merge_mode='concat'))
File "/data/sysdir/anaconda3/lib/python3.5/site-packages/keras/engine/sequential.py", line 181, in add
output_tensor = layer(self.outputs[0])
File "/data/sysdir/anaconda3/lib/python3.5/site-packages/keras/layers/wrappers.py", line 427, in call
return super(Bidirectional, self).call(inputs, **kwargs)
File "/data/sysdir/anaconda3/lib/python3.5/site-packages/keras/engine/base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "/data/sysdir/anaconda3/lib/python3.5/site-packages/keras/layers/wrappers.py", line 522, in call
y = self.forward_layer.call(inputs, **kwargs)
File "/data/sysdir/anaconda3/lib/python3.5/site-packages/keras/layers/recurrent.py", line 2194, in call
initial_state=initial_state)
File "/data/sysdir/anaconda3/lib/python3.5/site-packages/keras/layers/recurrent.py", line 649, in call
input_length=timesteps)
File "/data/sysdir/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 3011, in rnn
maximum_iterations=input_length)
TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

@sssdjj

This comment has been minimized.

Copy link

sssdjj commented Nov 12, 2018

python 3.5
keras '2.2.4'
tensorflow '1.0.1'

rgtjf added a commit to NTMC-Community/MatchZoo that referenced this issue Dec 17, 2018

feature: in requirements, update tensorflow version from >=1.1.0 to 1…
….8.0

When using RNN, it raises TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'. Reference keras-team/keras#10440 for more details
@franknerd

This comment has been minimized.

Copy link

franknerd commented Dec 21, 2018

I encountered the same problem. Error is totally the same.

python 3.6.7
keras '2.2.4'
tensorflow '1.0.1'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.