Skip to content
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

Inconsistency in model.decode() and forward method of Decode class #27

Open
SwastikGorai opened this issue Jul 12, 2024 · 0 comments
Open

Comments

@SwastikGorai
Copy link

In train.py, we do:

decoder_output = model.decode(encoder_output, encoder_mask, decoder_input, decoder_mask) # (B, seq_len, d_model)

encoder_output: (b, seq_len, d_model)
encoder_mask: (B, 1, 1, seq_len)
decoder_input: (b, seq_len)
decoder_mask: (B,1, seq_len, seq_len)

This calls the decode function in model.py in Transformer class, which takes args in the following order:
encoder_output, src_mask(or encoder_mask), decoder_input, tgt_mask(or decoder_mask)

Till here, i could follow.
But after this, the forward method of the Decoder class is called which takes input in the following way:
X(the decoder_input), encoder_output, encoder_mask, decoder_mask

Is this an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant