Skip to content

Fix legacy on_non_divisible fill for subclasses (STEEGFormer wrappers); trim #1399 - #1407

Merged
bruAristimunha merged 5 commits into
braindecode:masterfrom
bruAristimunha:ponytail/trim-1399
Oct 14, 2026
Merged

bruAristimunha merged 5 commits into
braindecode:masterfrom
bruAristimunha:ponytail/trim-1399

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

Follow-up to #1399.

Fix. from_config / from_pretrained filled on_non_divisible="crop" for configs saved before the option existed, even when the class being loaded is a subclass whose __init__ doesn't take that argument. A downstream wrapper, neuraltrain's STEEGFormerEncoderCompatible, then raised TypeError: unexpected keyword argument 'on_non_divisible'. That broke 1,163 cells of the NeuralBench model×study check on master, across all four STEEGFormer configs. The fill now only happens when the __init__ accepts the argument; a regression test covers it.

Trim. Same behaviour, less code:

  • _patch_count and _pad_or_crop_to_patches without the long docstrings.
  • One REVE padding warning instead of two.
  • The on_non_divisible tests: one parametrized test per model plus the legacy-config checks (411 → ~160 lines).
  • The patch-helper tests in one table.
  • A 5-line changelog entry instead of 22.

A subclass with its own signature (neuraltrain's STEEGFormerEncoderCompatible)
got on_non_divisible='crop' injected by from_pretrained and raised TypeError:
1,163 NeuralBench matrix cells (all four STEEGFormer configs) on master.
Copilot AI balanced review requested due to automatic review settings October 14, 2026 19:04

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (c03aa49) to head (ada53cd).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1407      +/-   ##
==========================================
- Coverage   90.14%   90.13%   -0.01%     
==========================================
  Files         167      167              
  Lines       21817    21809       -8     
==========================================
- Hits        19666    19657       -9     
- Misses       2151     2152       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruAristimunha
bruAristimunha merged commit 4eafc3a into braindecode:master Oct 14, 2026
11 of 12 checks passed
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.

2 participants