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

Code issues in CausalSelfAttention module #30

Open
suryadheeshjith opened this issue Mar 21, 2024 · 0 comments
Open

Code issues in CausalSelfAttention module #30

suryadheeshjith opened this issue Mar 21, 2024 · 0 comments

Comments

@suryadheeshjith
Copy link

I have a few queries regarding the CausalSelfAttention module in the codebase.

  1. In lines https://github.com/songweige/TATS/blob/main/tats/modules/gpt.py#L100C13-L102C86,
mask[:, :config.n_unmasked+1] = 1
mask[:, -config.n_unmasked+1:] = 1
mask[-config.n_unmasked+1:, config.n_unmasked+1:-config.n_unmasked+1] = 0

The masking seems to be incorrect. I believe the corrected code should be -

mask[:, :config.n_unmasked+1] = 1
mask[:, -(config.n_unmasked+1):] = 1
mask[-(config.n_unmasked+1):, config.n_unmasked+1:-(config.n_unmasked+1)] = 0
  1. In lines https://github.com/songweige/TATS/blob/main/tats/modules/gpt.py#L122C9-L123C76,
if layer_past is None:
    att = att.masked_fill(self.mask[:,:,:T,:T] == 0, float('-inf'))

We are only masking when layer_past is None. But when it is not, no masking is applied which would imply we are not performing causal attention anymore. Why is that the case?

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