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

Critical bug in the implementation of the PositionalEncoding class #20

Open
Shahdsaf opened this issue Oct 18, 2024 · 0 comments
Open

Comments

@Shahdsaf
Copy link

Shahdsaf commented Oct 18, 2024

Hi,

many thanks for your amazing work and open-sourcing the code. While using and experimenting with the codebase, I found a critical bug in the PositionalEncoding class implementation ([here])(https://github.com/DiffPoseTalk/DiffPoseTalk/blob/main/models/common.py#L22).

The bugged line is:
x = x + self.pe[:, x.shape[1], :]

and the corrected version is:
x = x + (self.pe[:, :x.shape[1], :]).requires_grad(False)

As you can see, the bug happens when adding the encodings of the first x.shape[1] elements but for that to happen we need the slicing which was missing, leading to adding only one PE to all the input sequence elements which corresponds to position x.shape[1].

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