Open
Conversation
NANWOOD
reviewed
Jul 25, 2024
| """ | ||
| # Perform RMSNorm normalization. | ||
| output = self._norm(x.float()).type_as(x) | ||
| # Multiply the result by the learned scaling factor to complete the RMSNorm. |
NANWOOD
reviewed
Jul 25, 2024
| # This converts each grouped 2D tensor d = [d1, d2]^T into a complex number d1 + i d2. | ||
| # Use complex multiplication with the corresponding complex frequency e^{iθ}, then convert back | ||
| # to real numbers, | ||
| # achieving R(θ)d, which rotates each grouped 2D tensor by the corresponding angle, thereby implementing |
Member
There was a problem hiding this comment.
Check the usage of "achieving".
NANWOOD
reviewed
Jul 25, 2024
|
|
||
| def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor: | ||
| """torch.repeat_interleave(x, dim=2, repeats=n_rep).""" | ||
| """在 n_kv_heads 维度上重复扩展 key 或 query 张量. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist
Changes