Skip to content

REVE, Labram: accept ch_mask (#1539, merged with master) - #1549

Merged
bruAristimunha merged 9 commits into
braindecode:masterfrom
bruAristimunha:pr1539-onmaster
Nov 5, 2026
Merged

bruAristimunha merged 9 commits into
braindecode:masterfrom
bruAristimunha:pr1539-onmaster

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

This is #1539 by @julien-gadonneix (REVE and Labram accept ch_mask), with master merged in. #1540 landed after his last merge and conflicted with this branch, and the branch doesn't allow maintainer edits.

The merge resolution keeps both sides:

No code changes beyond the merge. The squash commit keeps Julien as co-author. #1539 will be closed in favour of this PR.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 16:54

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.

🟡 Changes recommended

Dropping channels can leave a sample with no valid channels and cause attention pooling to produce NaN predictions; the selected mask needs revalidation and a regression test.

1 open issue
What changed in this PR

This PR integrates #1539 with master, adding channel-mask support to REVE and Labram for batches with different channel counts while preserving #1540’s token-output changes.

Changes:

  • Mask padded channels in attention, pooling, and Labram’s normalization.
  • Return zeroed padded tokens through "tokens" and reject masks for incompatible heads.
  • Extend model tests and document the new behavior.
File Description
test/​unit_tests/​training/​test_ch_mask_training.py Mark Labram training as expected to fail without channel-name routing.
test/​unit_tests/​models/​test_model_contract.py Supply Labram channel names for model contract tests.
test/​unit_tests/​models/​test_labram_qkv_split.py Adapt reference attention to accept an unused key mask.
test/​unit_tests/​models/​test_ch_mask.py Test REVE/Labram masking, token outputs, and incompatible heads.
docs/​whats_new.rst Document channel-mask and token-output support.
braindecode/​models/​reve.py Add masked attention, pooling, and zeroed token outputs.
braindecode/​models/​labram.py Add masked normalization, attention, pooling, and token outputs.

Review effort: Balanced

Comment thread braindecode/models/reve.py Resolved
Copilot AI balanced review requested due to automatic review settings November 5, 2026 17:06

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.

🔵 Needs a closer look

The REVE-flatten test case bypasses the network-test guard, allowing an uncached position-bank download to fail the default suite offline without --run-network.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity REVE-flatten bypasses the network-test guard

test/​unit_tests/​models/​test_ch_mask.py:224

test/conftest.py::_is_reve_param recognizes REVE, but not REVE-flatten, so this case bypasses the network-test guard. Constructing REVE downloads its position bank when it is not cached, which can make the default suite fail offline without --run-network. Rename this case to REVE so the collection hook marks it as network-dependent.

1 resolved since last review

Review effort: Balanced

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.95238% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.39%. Comparing base (b40e1cc) to head (77b23f8).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1549   +/-   ##
=======================================
  Coverage   91.39%   91.39%           
=======================================
  Files         170      170           
  Lines       22155    22191   +36     
=======================================
+ Hits        20249    20282   +33     
- Misses       1906     1909    +3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruAristimunha

Copy link
Copy Markdown
Collaborator Author

Addressed the remaining review points in 77b23f8:

  • Copilot, REVE-flatten offline: renaming it to "REVE" or widening conftest._is_reve_param would also have marked REVE-overlap (test_on_non_divisible) and REVE-local-bank (test_pretrained_compat) as network tests. Those cases deliberately use a local position bank so that they run offline. So the refusal test now does the same: it writes a one-entry reve_positions.json and sets REVE_POSITIONS_PATH, and REVE-flatten runs in the default offline suite.
  • @julien-gadonneix, flaky test_registered_model_ch_mask_training[Brant]: the case was unseeded, so every run drew different weights and data. _ch_mask_case now calls torch.manual_seed(0). The Brant case passed 10 of 10 repeated runs in a Voyager job.

Verified in one job without --run-network: the ch_mask, contract, training, routing, module and REVE/Labram model tests gave 357 passed and 0 failed, and pre-commit passed.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 17:30

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.

🟢 Approval recommended

No active review issues are recorded for the REVE and Labram channel-mask support changes.

No open issues 🎉

Review effort: Balanced

@bruAristimunha
bruAristimunha merged commit 6fda413 into braindecode:master Nov 5, 2026
9 checks passed
@bruAristimunha bruAristimunha mentioned this pull request Nov 5, 2026
3 tasks done
bruAristimunha added a commit to bruAristimunha/braindecode that referenced this pull request Nov 9, 2026
bruAristimunha added a commit to bruAristimunha/braindecode that referenced this pull request Nov 9, 2026
Brings in the ch_mask series (braindecode#1545 braindecode#1548 braindecode#1540 braindecode#1549 braindecode#1542 braindecode#1543 braindecode#1544 braindecode#1550), braindecode#1557 and braindecode#1559 (master dba9d42). No conflicts; NOTICE.txt and docs/whats_new.rst carry only this PR's additions over master.
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.

3 participants