Repository navigation
FIX from_pretrained with explicit None geometry; LaBraM decoder honours on_non_divisible - #1250
Merged
bruAristimunha merged 6 commits intoOct 8, 2026
Merged
Conversation
…rs on_non_divisible - from_pretrained(d, chs_info=None) / (d, n_chans=None) load the saved geometry again: the pinning checks the value, not the key (braindecode#1232). - Labram(neural_tokenizer=False) pads / crops / raises on a window not divisible by patch_size, like the tokenizer mode (braindecode#1226). - PatchTokenizer.prepare_input is public (_prepare_input kept as alias); LaBraM and LUNA call it.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Explicit null values still suppress matching saved geometry fields, leaving some checkpoints without usable geometry.
1 open finding
What changed in this PR
Fixes geometry restoration during pretrained loading and applies LaBraM’s non-divisible-window policy in decoder mode.
Changes:
- Refines pretrained geometry handling for explicit
Nonevalues. - Exposes and reuses
PatchTokenizer.prepare_input. - Adds LaBraM decoder regression coverage and release notes.
| File | Description |
|---|---|
braindecode/models/base.py |
Adjusts pretrained geometry selection. |
braindecode/modules/blocks.py |
Makes tokenizer input preparation public. |
braindecode/models/labram.py |
Adds decoder padding/cropping/error handling. |
braindecode/models/luna.py |
Uses the public tokenizer method. |
test/unit_tests/models/test_eegdino.py |
Tests explicit-null geometry loading. |
test/unit_tests/models/test_foundation_models.py |
Covers LaBraM decoder padding. |
docs/whats_new.rst |
Documents both fixes. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1250 +/- ##
=======================================
Coverage 89.05% 89.05%
=======================================
Files 157 157
Lines 19654 19660 +6
=======================================
+ Hits 17503 17509 +6
Misses 2151 2151 🚀 New features to boost your workflow:
|
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Oct 8, 2026
…aindecode#1250, braindecode#1252) into fix/hpu-models
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.

Fixes the loading/patching findings reported in #1232 and #1226.
EEGModuleMixin.from_pretrained: an explicitchs_info=None/n_chans=None(e.g. forwarded by a wrapper) no longer pins the other geometry argument toNone; the saved geometry loads again. Pinning now checks the value, not the key.Labram(neural_tokenizer=False):_PatchEmbedpads / crops / raises on a window not divisible bypatch_size, followingon_non_divisiblelike the tokenizer mode (it no longer adds parameters).PatchTokenizer.prepare_inputis public; LaBraM and LUNA call it.Checks
test_eegdino::test_from_pretrained_takes_geometry_from_the_caller_not_the_config,test_non_divisible_window_padded_by_default[Labram-kwargs1-200]) and pass on this branch.test_models,test_integration,test_return_features,test_eegdino,test_foundation_models,test/unit_tests/modulesfiltered on these models/tokenizer: 154 passed, 15 skipped.