Repository navigation
REVE, Labram: accept ch_mask - #1539
julien-gadonneix wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1539 +/- ##
==========================================
- Coverage 91.38% 91.36% -0.02%
==========================================
Files 170 170
Lines 22137 22173 +36
==========================================
+ Hits 20229 20259 +30
- Misses 1908 1914 +6 🚀 New features to boost your workflow:
|
bruAristimunha
left a comment
There was a problem hiding this comment.
Thanks, the shared helpers are reused well (check_ch_mask, masked_mean, masked_group_norm), and the channel-tied heads refuse the mask as they should. I checked the less obvious paths:
- the Labram key bias is added to the relative-position bias;
- the HPU path falls back to the plain attention whenever a mask is set;
- with
ch_names, the mask lines up becausexis not reordered; - REVE re-indexes the mask together with
channel_index.
P2: Labram, patch_embed loop with hasattr(layer, "norm1")
patch_embed is always exactly segment_patch → temporal_conv in tokenizer mode, so the type sniffing (and its TorchScript caveat) can go:
x = self.patch_embed.temporal_conv(self.patch_embed.segment_patch(x), ch_mask)P2: padded tokens in the token-level outputs
REVE's return_features["features"] and Labram's features / return_patch_tokens still carry the padded channels' tokens, which are finite but arbitrary. #1540 zeroes them for the seven iEEG models. Please zero them here too (masked_fill(~token_mask[..., None], 0.0)), so token outputs mean the same thing in every model that takes ch_mask.
P3
- Labram
forward_features:xis always 3-D at that point, soch_mask[:, :, None]reads better than thereshape(list(...) + [1] * ...). _TemporalConv: passeps=self.normN.epstomasked_group_norm. It matches the default today, but this keeps the two in sync if anyone changes it.- codecov/project is red. The uncovered lines are probably the two refusal branches;
test_ch_mask_is_refused_by_fixed_size_headscould take REVE (attention_pooling=False) and Labram (neural_tokenizer=False) as two more cases.
|
Thanks!
|
|
Thanks for the updates, they address the review. Two things before merging:
|
…-mask # Conflicts: # test/unit_tests/models/test_ch_mask.py
|
Merged master: kept this side of the |
|
#1548 (now on master) checks the # test/unit_tests/models/test_model_contract.py, _CH_MASK_EXTRAS
"Labram": ("ch_names", lambda i, n: LABRAM_CHANNEL_ORDER[:n]),You also need a strict xfail for Labram in |
|
Done: merged master, added Labram to FYI, |
Co-authored-by: Julien GADONNEIX <[email protected]>
|
Merged through #1549: this branch with master merged in (both sides kept), plus fixes for the Copilot findings (on_missing='drop' mask, offline REVE-flatten) and a seeded contract case for the Brant flake you reported. Thanks @julien-gadonneix, you are co-author of the squash commit. |
REVEandLabramaccept ach_maskof real channels, as the iEEG foundation models of #1487, so one batch can mix recordings with different channel counts.masked_group_norm).attention_pooling=True) and Labram's decoder mode (needsneural_tokenizer=True).test_labram_qkv_split.py: the frozen reference attention accepts the newkey_maskargument and asserts it is unused; its computation is unchanged.Testing
test_ch_mask.py: REVE and Labram added (each recording matches running alone, eager and scripted; no gradient into padding; channel-tied heads refuse);pytest test/unit_tests/models -k "reve or labram or ch_mask": 141 passed, 45 skippedtest/unit_tests/modelswith 16 xdist workers in 64 GB: 4713 passed, 34 crashed workers (out of memory) on models this PR does not touch, plus one Labram contract test that passes when rerun alonepre-commit run --files <changed files>: passed