Repository navigation
functional: rotary_frequencies, rotary_angles, apply_rotary, rotate_half; six models use them - #1456
Merged
bruAristimunha merged 3 commits intoOct 18, 2026
Conversation
… six models use them, EEGPT's unused RoPE removed
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1456 +/- ##
==========================================
- Coverage 91.04% 91.03% -0.01%
==========================================
Files 165 165
Lines 21653 21621 -32
==========================================
- Hits 19714 19683 -31
+ Misses 1939 1938 -1 🚀 New features to boost your workflow:
|
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.
Stacked on #1455 (its commit is included until it merges; this PR adds one commit).
Part of #1442, Tier 1 of the consolidation plan (dedupe the computation, keep every parameter where it is).
Eight models carried their own rotary embedding. The frequency table
1 / base ** (2i / d), the angle layout (interleaved pairs or two halves) and the rotationx * cos + rotate(x) * sinare now four public functions inbraindecode.functional, next to the existingrotate_pairs:rotary_frequencies(head_dim, base, device, dtype)rotary_angles(positions, inv_freq, interleaved)apply_rotary(x, cos, sin, interleaved)rotate_half(x)(the half-split layout, used by BaRISTA)BaRISTA, BrainOmni, DIVER-1, EpiNT, LUNA and TCFormer call them; their buffers and parameters (LUNA's persistent
freqs, BrainOmni'sfreqs/rotate) stay where they are, so released weights load unchanged. The arithmetic is the same op sequence as before. TCFormer keeps its reference quirk (half-split angles with pair rotation), commented. ZUNA's four-axis rotary is unchanged.EEGPT's
_rotate_half,_apply_rotary_embanduse_ropeplumbing were never enabled (use_rope=Falseat the only call site); removed, with their three tests.Characterization against master (same seed): BaRISTA, BrainOmni, DIVER-1, EpiNT, LUNA, TCFormer and EEGPT have identical
state_dictkeys and weights and bit-identical outputs. 477 model tests pass (test_model_exported[LUNA]fails the same way on master with local torch); 14 functional tests incl. TorchScript. The helpers avoid keyword-only arguments so TCFormer, which builds its table inforward, still scripts.