farizrahman4u / seq2seq

Sequence to Sequence Learning with Keras
GNU General Public License v2.0
3.17k stars 845 forks source link

AttributError about _preprocess_function #223

Closed dudgnskim closed 6 years ago

dudgnskim commented 6 years ago

I am trying to test out seq2seq package, and as I was trying out the test code provided, I encountered an error saying: 'AttributeError: 'RecurrentSequential' object has no attribute '_preprocess_function''

All the seq2seq functions raise the same error message, and I am not sure why it is throwing this error. Could you please help me find why this is happening, and how I can fix this error?

I am using Tensorflow as backend (if this information helps).

Thank you so much in advance!

P.S. below is the Traceback of the error message:

`--------------------------------------------------------------------------- AttributeError Traceback (most recent call last)

in () 10 model.compile(loss='mse', optimizer='sgd') 11 model.fit(x, y, nb_epoch=1) ---> 12 test_SimpleSeq2Seq() in test_SimpleSeq2Seq() 4 5 models = [] ----> 6 models += [SimpleSeq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim))] 7 models += [SimpleSeq2Seq(output_dim=output_dim, hidden_dim=hidden_dim, output_length=output_length, input_shape=(input_length, input_dim), depth=2)] 8 /usr/local/lib/python3.5/dist-packages/seq2seq/models.py in SimpleSeq2Seq(output_dim, output_length, hidden_dim, input_shape, batch_size, batch_input_shape, input_dim, input_length, depth, dropout, unroll, stateful) 78 79 _input = Input(batch_shape=shape) ---> 80 x = encoder(_input) 81 output = decoder(x) 82 return Model(_input, output) /usr/local/lib/python3.5/dist-packages/recurrentshop-1.0.0-py3.5.egg/recurrentshop/engine.py in __call__(self, inputs, initial_state, initial_readout, ground_truth, **kwargs) 494 kwargs['mask'] = previous_mask 495 input_shape = _collect_input_shape(inputs) --> 496 output = self.call(inputs, **kwargs) 497 output_mask = self.compute_mask(inputs[0], previous_mask) 498 output_shape = self.compute_output_shape(input_shape[0]) /usr/local/lib/python3.5/dist-packages/recurrentshop-1.0.0-py3.5.egg/recurrentshop/engine.py in call(self, inputs, initial_state, initial_readout, ground_truth, mask, training) 583 'the time dimension by passing a `shape` ' 584 'or `batch_shape` argument to your Input layer.') --> 585 preprocessed_input = self.preprocess_input(inputs, training=None) 586 constants = self.get_constants(inputs, training=None) 587 if self.decode: /usr/local/lib/python3.5/dist-packages/recurrentshop-1.0.0-py3.5.egg/recurrentshop/engine.py in preprocess_input(self, input, training) 657 658 def preprocess_input(self, input, training=None): --> 659 if self._preprocess_function is None: 660 return input 661 return self._preprocess_function(input) AttributeError: 'RecurrentSequential' object has no attribute '_preprocess_function'`