Open nabihach opened 8 years ago
I have the same problem. The initial states of the LSTMDecoder are not set properly, but I can't find out where this happens, and therefore I don't know why. Did you resolve the issue?
No I wasn't able to resolve the issue. I remember trying a bunch of different things but nothing worked. I also thought for a while that the initial states weren't set properly, but I couldn't find a fix.
I removed parts until the error doesn't present itself and this is the minimum I reached. The following fails:
class S2s(Sequential):
def __init__(self, output_dim, hidden_dim, output_length, depth=1, broadcast_state=True, inner_broadcast_state=True, peek=False, dropout=0.1, **kwargs):
super(S2s, self).__init__()
depth = (depth, depth)
shape = kwargs['batch_input_shape']
del kwargs['batch_input_shape']
self.add(LSTMEncoder(batch_input_shape=shape, output_dim=hidden_dim, state_input=False, return_sequences=depth[0] > 1, **kwargs))
self.add(LSTMDecoder2(hidden_dim=hidden_dim, output_length=output_length, state_input=broadcast_state, **kwargs))
self.layers[0].broadcast_state(self.layers[1])
[self.encoder,self.decoder] = self.layers
but it succeeds, if you comment out broadcast_state().
Hopefully that's helpful.
Thanks, I'll try this out. I really don't want to comment out broadcast_state() though, it is critical for most models (at least the ones I'm using!).
Oh, no I don't suggest commenting it out! I just haven't figured out what about broadcast state is causing the problem and thought it would be helpful to see my partial results anyway. I'll keep working on it, too.
On Thu, Sep 15, 2016, 20:53 Nabiha Asghar notifications@github.com wrote:
Thanks, I'll try this out. I really don't want to comment out broadcast_state() though, it is critical for most models (at least the ones I'm using!).
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/farizrahman4u/seq2seq/issues/90#issuecomment-247493979, or mute the thread https://github.com/notifications/unsubscribe-auth/ADf-0tced05NyaLA4fzoAuA3apo58bWYks5qqeijgaJpZM4Jjvjn .
Thanks! It definitely is helpful :) Keep us posted! I'll try playing around with it too.
@nabihach Have you tried altering the source code to add the embedding layer right into the Seq2seq
class?
No I never tried that, but that's a good idea. I'll try that and post the results here.
Hi @farizrahman4u
In the debug_seq2seq example by @nicolas-ivanov , I want to add a keras embeddings layer before the seq2seq layer, which i want to initialize with the word2vec vectors. But I get a weird error related to out-of-range indices.
My model is:
But when I run this, I get the following error:
What exactly is wrong with my embedding layer? Please help