Skip to content

Add modules.PreNormTransformerBlock / PostNormTransformerBlock; EEGConformer, MIRepNet, CTNet, MSCFormer use them - #1466

Merged
bruAristimunha merged 1 commit into
braindecode:masterfrom
bruAristimunha:cleanup/t27-encoder-blocks
Oct 18, 2026
Merged

bruAristimunha merged 1 commit into
braindecode:masterfrom
bruAristimunha:cleanup/t27-encoder-blocks

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

Part of #1442. Stacked on #1463 (chain #1455 → #1463); the commit of this PR is the last one.

Four models carried a _TransformerEncoderBlock + _TransformerEncoder pair (eight private classes) that differed only in argument names:

  • EEGConformer and MIRepNet: pre-norm Residual(LayerNorm → MHA → Dropout), Residual(LayerNorm → FFN → Dropout) → modules.PreNormTransformerBlock(dim, attn, ffn, drop_prob), an nn.Sequential so the indexed keys (transformer.0.0.fn.1.keys.weight) stay as released (MIRepNet's hub weights load).
  • CTNet and MSCFormer: PostNormResidual(MHA), PostNormResidual(FFN) → modules.PostNormTransformerBlock(dim, attn, ffn, drop_prob) with the attention/feed_forward names. The _TransformerEncoder wrapper becomes nn.Sequential(OrderedDict(layers=...)), which keeps the trans.layers.N keys of saved checkpoints; CTNet keeps the extra Sequential around its sub-layers for the same reason.

Characterization vs master: EEGConformer, MIRepNet, CTNet, MSCFormer (and STEEGFormer, untouched): identical state_dict keys and weights, bit-identical outputs; MIRepNet.from_pretrained('braindecode/mirepnet-pretrained') loads. 170 related tests pass. −8 private classes (growth-stop list updated).

Copilot AI balanced review requested due to automatic review settings October 18, 2026 00:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.00%. Comparing base (bc0fdff) to head (1eaa722).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1466      +/-   ##
==========================================
- Coverage   91.03%   91.00%   -0.04%     
==========================================
  Files         167      167              
  Lines       21601    21516      -85     
==========================================
- Hits        19665    19580      -85     
  Misses       1936     1936              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 11:16
@bruAristimunha
bruAristimunha force-pushed the cleanup/t27-encoder-blocks branch from 3e3be5c to 7bf0ffa Compare October 18, 2026 11:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 12:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 17:31
@bruAristimunha
bruAristimunha force-pushed the cleanup/t27-encoder-blocks branch from 2f2a7ca to d8a5c88 Compare October 18, 2026 17:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…nformer, MIRepNet, CTNet, MSCFormer use them (same keys, same outputs)
@bruAristimunha
bruAristimunha force-pushed the cleanup/t27-encoder-blocks branch from d8a5c88 to 1eaa722 Compare October 18, 2026 18:23
@bruAristimunha
bruAristimunha merged commit 5f721b0 into braindecode:master Oct 18, 2026
10 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