-
Notifications
You must be signed in to change notification settings - Fork 845
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
Adding a Dropout to Seq2Seq gives a MissingInputError #118
Comments
This is a bug in theano. |
Thanks for the quick reply. This seems to solve the issue, at least temporarily until the bug is fixed in Theano. |
Why my fit function give this error when set dropout > 0. ? |
Same problem here when I use the fit function and dropout > 0. |
This problem is triggered by keras.callbacks.EarlyStopping because of the model evaluations of the validation split. This script crashes for me with theano.gof.fg.MissingInputError as above import seq2seq
import numpy as np
from keras.callbacks import EarlyStopping
x_Train = np.random.random((200,8,2))
y_Train = np.random.random((200,8,2))
model = seq2seq.Seq2Seq(input_dim=2,
input_length=8,
output_dim=2,
output_length=8,
hidden_dim=128,
dropout=0.2,
depth=1)
model.compile('adam', 'mse', metrics=['accuracy'])
early_stopping = EarlyStopping(monitor='val_loss', patience=5, verbose=1, mode='auto')
history = model.fit(x_Train,
y_Train,
shuffle=True,
batch_size=32,
nb_epoch=2,
verbose=1,
validation_split=0.1,
callbacks=[early_stopping])
and this runs without error import seq2seq
import numpy as np
from keras.callbacks import EarlyStopping
x_Train = np.random.random((200,8,2))
y_Train = np.random.random((200,8,2))
model = seq2seq.Seq2Seq(input_dim=2,
input_length=8,
output_dim=2,
output_length=8,
hidden_dim=128,
dropout=0.2,
peek=False,
depth=1)
model.compile('adam', 'mse', metrics=['accuracy'])
history = model.fit(x_Train,
y_Train,
shuffle=True,
batch_size=32,
nb_epoch=2,
verbose=1)
so avoid using EarlyStopping unless this bug is fixed und try to find nb_epochs by hyper parameter tuning |
@bityangke, you can use something like this after training and before evaluating weights = model.get_weights()
model_temp.set_weights(weights)
del model
model = model_temp |
@Depulsor Thanks! |
Running a Seq2Seq model without any dropout (setting the parameter dropout=0.0) works fine in both training and prediction. However, setting it to anything other than 0.0 results in an error during prediction (training works fine). Below is a code snippet that generates the error:
And below is the output with the error produced (training works but prediction fails):
The environment is Python 3.5, running on Keras 1.1.0 and Theano 0.9.0.dev3.
The text was updated successfully, but these errors were encountered: