Repository navigation
CSBrain: add head_drop_prob; document checkpoint key names - #1247
Merged
bruAristimunha merged 2 commits intoOct 7, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1247 +/- ##
=======================================
Coverage 88.62% 88.62%
=======================================
Files 159 159
Lines 19547 19547
=======================================
Hits 17324 17324
Misses 2223 2223 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The constructor breaks existing positional calls, and the regression test can miss incorrectly configured dropout layers.
2 open findings
What changed in this PR
Extends CSBrain’s fine-tuning support with independent task-head dropout and checkpoint-loading guidance.
Changes:
- Adds
head_drop_prob, defaulting todrop_prob. - Documents checkpoint key remapping and replacing
proj_out. - Adds a dropout regression test and release note.
| File | Description |
|---|---|
| test/unit_tests/models/test_models.py | Tests separate head and backbone dropout settings. |
| docs/whats_new.rst | Announces the option and checkpoint documentation. |
| braindecode/models/csbrain.py | Implements head dropout control and documents loading guidance. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| emb_dim: int = 200, | ||
| temporal_kernel_sizes: Sequence[int] = (1, 3, 5), | ||
| drop_prob: float = 0.1, | ||
| head_drop_prob: float | None = None, |
Comment on lines
+5142
to
+5147
| ps = { | ||
| name.startswith("final_layer"): m.p | ||
| for name, m in model.named_modules() | ||
| if isinstance(m, nn.Dropout) | ||
| } | ||
| assert ps == {False: 0.1, True: 0.3} |
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Oct 8, 2026
…nto fix/model-dtypes
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.

Follow-up to #1196 and #1240.
head_drop_prob(defaultNone=drop_prob): dropout of the task head only. The reference fine-tuning model for BCIC-IV-2a (models/model_for_bciciv2a.py) uses 0.1 in the backbone and--dropout 0.3in the head; this is nowCSBrain(drop_prob=0.1, head_drop_prob=0.3). The docstring note about a subclass workaround is removed.proj_out→nn.Identity()(also in that recipe) is documented asmodel.proj_out = nn.Identity()after loading the weights; no new argument.Notes: the key renames needed to load the released checkpoints (encoder.layers.→encoder.,TemEmbedEEGLayer.→temporal_embed.,BrainEmbedEEGLayer.→region_embed.,linear1/linear2→ff_block.0/ff_block.3,strict=False), as asked in Add CSBrain cross-scale spatiotemporal brain foundation model #1196.Parity vs master
f8699847, default arguments,torch.manual_seed(42), CPU fp32, 3 configs (22-ch 2a layout 12 layers; 4 ch no names 2 layers; 5 chdrop_prob=0.32 layers):Tests (
-k "csbrain and not compiled"): test_models 27 passed, 1 skipped; test_integration 10 passed, 1 skipped; test_return_features 2 passed. New:test_csbrain_head_drop_prob_sets_only_the_head. pre-commit rc=0 twice.