Repository navigation
TST: pretrained-compat contract covers every model with released weights - #1252
Merged
bruAristimunha merged 3 commits intoOct 8, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified in the test changes or documentation corrections.
0 open findings
What changed in this PR
Expands pretrained-model compatibility tests while leaving model execution unchanged.
Changes:
- Adds seven model classes and a coverage-completeness check.
- Runs REVE cases offline and tightens expected errors and warning filters.
- Corrects patch-count documentation for padded inputs.
| File | Description |
|---|---|
| test/unit_tests/models/test_pretrained_compat.py | Expands coverage, adds completeness checks, and enables offline REVE tests. |
| docs/whats_new.rst | Records compatibility-test improvements. |
| braindecode/models/luna.py | Corrects the documented padded patch count. |
| braindecode/models/labram.py | Clarifies documented patch shapes and counts. |
🧠 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1252 +/- ##
==========================================
+ Coverage 88.71% 89.05% +0.33%
==========================================
Files 157 157
Lines 19654 19654
==========================================
+ Hits 17437 17503 +66
+ Misses 2217 2151 -66 🚀 New features to boost your workflow:
|
lindicaphxag-tech
added a commit
to lindicaphxag-tech/braindecode
that referenced
this pull request
Oct 8, 2026
…erving EEG-CLIP entry
lindicaphxag-tech
added a commit
to lindicaphxag-tech/braindecode
that referenced
this pull request
Oct 8, 2026
…ouching pretrained contracts
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Oct 8, 2026
…nto fix/model-dtypes
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Oct 8, 2026
…aindecode#1250, braindecode#1252) into fix/hpu-models
bruAristimunha
added a commit
to lindicaphxag-tech/braindecode
that referenced
this pull request
Oct 8, 2026
bfloat16 and HPU inputs now get their spectrogram in float32 on the CPU. The model ships released weights, so the braindecode#1252 coverage test needs a COMPAT entry (channel-agnostic, 200 Hz).
bruAristimunha
added a commit
that referenced
this pull request
Oct 9, 2026
* ENH add TFMTokenizer * DOC license TFMTokenizer per NOTICE.txt convention (MIT link, no bundled text) * TST fold TFMTokenizer tests into shared test_models.py suite * MAINT apply pre-commit formatting for TFMTokenizer * Sync TFMTokenizer registry with current upstream master * Sync TFMTokenizer registry with current upstream master * Sync TFMTokenizer registry with current upstream master * Sync TFMTokenizer registry with current upstream master * Sync TFMTokenizer docs with current upstream master * Sync TFMTokenizer documentation with current upstream master * Sync TFMTokenizer documentation with current upstream master * Sync TFMTokenizer focused tests with current upstream master * Sync TFMTokenizer integration skip with current upstream master * docs: align TFMTokenizer parity claims with audited evidence * docs: align TFMTokenizer parity claims with audited evidence * MAINT TFMTokenizer: cut redundant checks, paper prose and generic tests; add pretrained box; outputs unchanged * TST TFMTokenizer: list as a non-classification model in the integration suite * MAINT TFMTokenizer: apply ruff-format and blacken-docs * MAINT TFMTokenizer: reuse modules.quantization.EMACodebook The private _EMAVectorQuantizer duplicated EMACodebook. With epsilon=1e-5, no dead-code expiry and no k-means init, EMACodebook is the reference EMA update; the uniform init is kept. Never-selected codes now follow the reference update again. Buffers are renamed (embed, embed_avg, inited); the loading snippet maps the released keys. EMACodebook skips the inited host read when k-means init is off. * FIX TFMTokenizer: STFT through spectral_input; pretrained-compat entry bfloat16 and HPU inputs now get their spectrogram in float32 on the CPU. The model ships released weights, so the #1252 coverage test needs a COMPAT entry (channel-agnostic, 200 Hz). * MAINT TFMTokenizer: one loss term, drop no-op flatten, fix stale Notes --------- Co-authored-by: Bruno Aristimunha <[email protected]>
bruAristimunha
added a commit
that referenced
this pull request
Oct 9, 2026
* ENH add EEG-CLIP dual encoder * FIX match released EEG-CLIP logit-scale semantics * STY apply current Ruff formatting to EEGCLIP * test(models): cover EEGCLIP validation branches * Sync EEG-CLIP registry with current upstream master * Sync EEG-CLIP summary row with current upstream master * Sync EEG-CLIP model contract with current upstream master * Sync EEG-CLIP API docs with current upstream master * Sync EEG-CLIP categorization with current upstream master * Sync EEG-CLIP reference with current upstream master * Sync EEG-CLIP docs with current upstream master * Sync EEG-CLIP docs with current upstream master * Sync EEG-CLIP docs with current upstream master * Test remaining EEG-CLIP mapping and Hub serialization paths * test: cover EEGCLIP projection and temporal-width edge cases * Keep EEG-CLIP registry delta minimal on current master * Keep EEG-CLIP summary delta minimal on current master * Keep EEG-CLIP model contract delta minimal on current master * Keep EEG-CLIP API delta minimal on current master * Keep EEG-CLIP categorization delta minimal on current master * Keep EEG-CLIP reference delta minimal on current master * Keep EEG-CLIP changelog delta minimal on current master * Keep upstream #1252 pretrained-compat changelog while preserving EEG-CLIP entry * Keep optional HF text examples outside EEGCLIP pretrained-weights compatibility scan * MAINT EEGCLIP: drop alias, guards and bespoke test file; fold tests into test_models.py - encode_eeg was an alias of forward: removed (unreleased model). - Shape/value guards that torch already raises on are removed; one forward path (2-D encoder output = one time step). - Text outputs: tensor, or first element of a tuple / HF ModelOutput. - reset_head: one loop over both heads, keeps device/dtype/train mode, validation via _set_n_outputs. - Projection head as a module-level helper, same layer order/keys. - explicit license kwarg, figure and versionadded in the docstring. - test_eeg_clip.py (492 lines) -> two tests in test_models.py, one of them against the authors' ProjectionHead/ClipLoss computation. * FIX EEGCLIP: default Deep4Net encoder ends with a log-softmax, as in the authors' code The authors' Deep4Net (braindecode <= 0.8, add_log_softmax=True) feeds log-probabilities over its 128 outputs to the EEG projection. Without it the port scored 0.789 vs 0.816 (authors' code 0.830) on TUAB LogReg pathological in the replication runs. * DOC EEGCLIP: note on license and the authors' projection head * MAINT EEGCLIP: drop duplicated zero-shot note; whats_new entry names only what the class provides --------- Co-authored-by: Bruno Aristimunha <[email protected]>
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.
test_pretrained_compat.pyis meant to cover every model class with released weights. On master it covers 21 classes and misses 7: NeuroRVQ, MAPA, BrainOmni, BrainTokenizer, SignalJEPA_Contextual, SignalJEPA_PostLocal, SignalJEPA_PreLocal. Nothing checked that the list was complete.Changes, all in
test/unit_tests/models/test_pretrained_compat.pyunless noted:contact_labelsstrategy: a name without a trailing contact number (Fz) raises.test_compat_covers_every_pretrained_model: every class inmodels_dictwhose source mentionshf_hub_download,from_pretrained(,huggingface.co/orHugging Face Hubmust be in COMPAT or inEXCLUDED(NeuroPose and VEMG2Pose, sEMG). Appended to the master version of this file, it fails and lists the 7 classes above.--run-network, becausetest/conftest.pymarks the literal param"REVE"as network. The entry is now keyedREVE-local-bank, and an autouse fixture writesreve_positions.json(10-05 positions plus E1..E128) and pointsREVE_POSITIONS_PATHat it. The 9 REVE cases now run in default CI. The released bank (543 names) contains all names used by the grid; the master REVE cases also pass against it with--run-network(9 passed).match=(e.g.n_times|window,n_channel_embeddings,locations|positions,channel name,divisible,trailing number) instead of accepting anyValueError/RuntimeError.warnings.simplefilter("ignore")in the geometry test is replaced by a modulefilterwarningslist of 5 known messages (padding notice, MNE montage rename, STFT window, nested tensor,weight_norm), so other warnings show up.NO_STRATEGY= {NeuroRVQ, MAPA, BrainOmni, BrainTokenizer}: these take nochannel_strategyargument, so they are left out oftest_native_checkpoint_loads_under_a_strategy._SegmentPatch.forward(Labram) and_PatchEmbedNetwork.forward(LUNA) saidn_times // patch_sizepatches; with the default padding the count isceil(n_times / patch_size).Checks (CPU, torch 2.14.1, mne 1.13.2):
test_pretrained_compat.py: 240 passed, 0 skipped (master: 187 cases, of which the 9 REVE cases are skipped without--run-network).n_times800/837 and 512/549: outputs and state-dict keys identical to master, max abs diff 0.0.