farizrahman4u / seq2seq

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

Adding Dropout to Seq2Seq model leads to error #139

Closed TillBeemelmanns closed 7 years ago

TillBeemelmanns commented 7 years ago

Hi Guys, first of all. Thank you for you awesome work here. But I got a problem with the Seq2Seq model. As soon as I add dropout to the Seq2Seq Model, I receive the following error. When dropout=0.0 everything works fine. Keras, Recurrentshop and Seq2Seq are up-to-date.

model = Seq2Seq(input_dim=2,
                    input_length=8,
                    output_dim=2,
                    output_length=8,
                    hidden_dim=128,
                    dropout=0.1,
                    depth=1)

history = model.fit(trainObservation,
                        trainPrediction,
                        shuffle=True,
                        nb_epoch=50,
                        verbose=1,
                        validation_split=0.1,
                        callbacks=[early_stopping])

Traceback (most recent call last):
  File "main.py", line 43, in <module>
    run_prediction.runTrajectoryPredictionByConfig(trajectories=trajectories, config=config, save_dir=save_dir)
  File "/rwthfs/rz/cluster/home/tb376085/ba/git/TrajectoryPrediction/run_prediction.py", line 73, in runTrajectoryPredictionByConfig
    verbose=config.getint('general', 'verbose'))
  File "/rwthfs/rz/cluster/home/tb376085/ba/git/TrajectoryPrediction/run_prediction.py", line 133, in runTrajectoryPrediction
    callbacks=[early_stopping])
  File "/home/tb376085/.local/lib/python2.7/site-packages/keras/engine/training.py", line 1067, in fit
    self._make_test_function()
  File "/home/tb376085/.local/lib/python2.7/site-packages/keras/engine/training.py", line 718, in _make_test_function
    **self._function_kwargs)
  File "/home/tb376085/.local/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 821, in function
    return Function(inputs, outputs, updates=updates, **kwargs)
  File "/home/tb376085/.local/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 807, in __init__
    **kwargs)
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/compile/function.py", line 320, in function
    output_keys=output_keys)
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 479, in pfunc
    output_keys=output_keys)
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/compile/function_module.py", line 1776, in orig_function
    output_keys=output_keys).create(
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/compile/function_module.py", line 1428, in __init__
    accept_inplace)
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/compile/function_module.py", line 177, in std_fgraph
    update_mapping=update_mapping)
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/gof/fg.py", line 171, in __init__
    self.__import_r__(output, reason="init")
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/gof/fg.py", line 360, in __import_r__
    self.__import__(variable.owner, reason=reason)
  File "/home/tb376085/.local/lib/python2.7/site-packages/theano/gof/fg.py", line 474, in __import__
    r)

theano.gof.fg.MissingInputError: ("An input of the graph, used to compute Elemwise{add,no_inplace}(<TensorType(float32, matrix)>, 
<TensorType(float32, matrix)>), was not provided and not given a value.
Use the Theano flag exception_verbosity='high',for more information on this error.", <TensorType(float32, matrix)>)```

What exactly causes this error ?
Thank you for any help! 
farizrahman4u commented 7 years ago

Already answered here : #118