Repository navigation
Add modules.PreNormBlock; EEGPT, EEGDINO, LUNA, NeuroRVQ use it (same keys, same outputs) - #1462
Merged
bruAristimunha merged 1 commit intoOct 18, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1462 +/- ##
==========================================
- Coverage 91.03% 91.02% -0.02%
==========================================
Files 167 167
Lines 21601 21565 -36
==========================================
- Hits 19665 19629 -36
Misses 1936 1936 🚀 New features to boost your workflow:
|
bruAristimunha
force-pushed
the
cleanup/t25-prenorm-block
branch
from
October 18, 2026 11:16
65e9bd3 to
702b6a0
Compare
…use it (same keys, same outputs)
bruAristimunha
force-pushed
the
cleanup/t25-prenorm-block
branch
from
October 18, 2026 17:31
9f3f1c0 to
f50cf20
Compare
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.
Part of #1442, Tier 2. Stacked on #1460 (and so on #1455–#1457); the commit of this PR is the last one.
Four private pre-norm transformer blocks with the same parameter layout (
norm1,attn,norm2,mlp, plusgamma_1/gamma_2layer scale in NeuroRVQ) becomebraindecode.modules.PreNormBlock(dim, attn, mlp, norm_layer, drop_path, layer_scale): it takes the attention and MLP modules, so each model keeps its own where it differs (LUNA's rotary attention, LaBraM's attention in NeuroRVQ, EEGDINO's MLP without mid dropout)._Block→PreNormBlock(TimmAttention, TimmMlp);return_attention_layeris now handled in_EEGTransformer.forward(blk.attn(blk.norm1(x), need_weights=True)), same result._TransformerEncoderLayer, LUNA_RotaryTransformerBlock(its twoDropPathmodules had no parameters; one draws the same values), NeuroRVQ_Block→ a small_block()factory shared with NeuroRVQTokenizer (its two tests use it).Characterization vs master: EEGPT, EEGDINO, LUNA, NeuroRVQ, NeuroRVQTokenizer: identical state_dict keys and weights, bit-identical outputs. 326 related tests pass (
test_model_exported[LUNA]fails the same way on master with local torch). TorchScript covered (assert isinstancenarrows LaBraM's Union return).Not moved: TCFormer's block (its attention takes
cos, sinper call; TorchScript forbids*args, so it stays its own 29 lines).