I have a sequence to sequence model for text summarization like this:

model = Model([encoder_inputs, decoder_inputs], decoder_dense)

I fit it accordingly:

history = model.fit([x_tr, y_tr],y_tr.reshape(y_tr.shape[0], y_tr.shape[1], 1), epochs= ..)

The model fits successfully, but how do I use model.predict() ? If I only pass x_test like model.predict(x_test), it says 2 inputs expected. However, if I do model.predict([x_test, y_test]), I get the predictions.

It feels wrong to have y_test in model.predict(). What is happening here? How do I use model.predict() in such a seq2seq model ?

From this keras tutorials, I see that you should not directly invoke model.predict() but create a inference model but I want to understand what is going on in the case I mentioned above and why does model.predict() only works if I provide y_test?

Thank you!



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.