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

Question about Rotary Embedding Sequence in Model Code vs. Diagrams #74

Open
littlepsilon opened this issue Nov 9, 2024 · 0 comments
Open

Comments

@littlepsilon
Copy link

littlepsilon commented Nov 9, 2024

Hello,

I have been studying the Gemma-Pytorch implementation and noticed a potential discrepancy in the code related to the application of rotary embeddings in the attention mechanism.

Specifically, the rotary embeddings are applied before calculating the attention scores in the code between lines 213 and 331, which seems to contradict several diagrams that depict these embeddings being applied after the attention calculation.
code: https://github.com/google/gemma_pytorch/blob/main/gemma/model.py#L213
diagram: https://developers.googleblog.com/en/gemma-explained-new-in-gemma-2/

Could you please clarify whether the embeddings should indeed be applied before the attention scores are calculated, or if the diagrams might have represented this differently?

Thank you!

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