Skip to content

Conversation

@ysjprojects
Copy link
Collaborator

@ysjprojects ysjprojects commented Dec 28, 2024

query_states = self.q_norm(self.q_proj(hidden_states))
key_states = self.k_norm(self.k_proj(hidden_states))
value_states = self.v_proj(hidden_states)

https://github.com/huggingface/transformers/blob/main/src/transformers/models/olmo2/modeling_olmo2.py

OLMo2 applies RMSNorm to the q and k matrices in its attention layer, something that is not yet supported by litgpt's architecture.

To support the addition of OLMo2, this PR adds an option to norm the q and k matrices via the config.norm_qk option which defaults to False.

Currently, the method for qk norm is assumed to follow the overall norm class.

@Andrei-Aksionov
Copy link
Contributor

Looks good now.
Thank you.

@Andrei-Aksionov Andrei-Aksionov merged commit 40c08dc into Lightning-AI:main Jan 2, 2025
8 of 9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants