Skip to content

Require PyTorch 2.4 and remove obsolete compatibility code - #1174

Merged
bruAristimunha merged 4 commits into
masterfrom
raise-torch-minimum-2.4
Sep 21, 2026
Merged

bruAristimunha merged 4 commits into
masterfrom
raise-torch-minimum-2.4

Conversation

@bruAristimunha

@bruAristimunha bruAristimunha commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Require PyTorch and TorchAudio >= 2.4 so installations support the native RMSNorm already used by MVPFormer and needed by BaRISTA (#1173). Merge this PR before #1173.

Remove REVE's old-version import guard, availability flag, warning, manual attention fallback, and intermediate attention wrapper. Call native scaled-dot-product attention directly. Replace handwritten RMS normalization in REVE and ZUNA with native functional.rms_norm, retaining only the float32 accumulation and output casts needed for their reference behavior. Epsilon values and checkpoint parameter keys are preserved. CodeBrain's normalization is unchanged because its formula differs from standard RMSNorm.

Address both review comments: move the release note into Requirements, remove Intel macOS from uv's required environments, and document the dropped platform in the installation guide. PyTorch stopped publishing Intel macOS binaries after 2.2.

Validation:

  • Installed PyTorch/TorchAudio 2.4.0 in an isolated environment: 22 focused tests and 11 integration tests passed; 17 integration cases skipped (network-dependent REVE cases and existing exclusions).
  • The same 22 focused tests passed on PyTorch 2.6.0.
  • Small REVE and ZUNA models strictly load the previous state dictionaries and produce identical logits in float32 and CPU bfloat16 autocast. Float32 gradients match; ZUNA bfloat16 gradients differ by 0.20% in relative L2 norm in the seeded comparison due to rounding through the native operation.
  • A float16 input of 1000 confirms why the small dtype adapters remain: bare PyTorch 2.4 RMSNorm overflows during squaring and returns zeros; the adapters return ones.
  • Dependency-bound checks, configured import lint, source formatting, spelling, and whitespace checks passed. Mypy reports existing errors in REVE's unchanged position-bank code; no new errors in the modified paths.

The full documentation build exposed an existing MNE 1.13 incompatibility in the sleep-staging gallery example: N3 and N4 intentionally share a class target, but MNE now rejects duplicate event-ID values. Keep annotation event IDs unique in the shared windower and retain the requested class targets in metadata, including per-event strides. Also repair the unresolved Copilot link in the changelog. The windowing suite passed 141 tests with two skips on MNE 1.13.2; eight alias/stride/preload regression cases passed after expanding coverage. All configured pre-commit hooks pass.

Copilot AI lite review requested due to automatic review settings September 21, 2026 15:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4707e937fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml

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 review overview

🟢 Approval recommended

No approval-blocking issues remain; the outstanding feedback is a minor nit.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Raises minimum PyTorch and TorchAudio versions to 2.4 to support native RMSNorm, with related documentation updates.

Changes:

  • Updates dependency bounds.
  • Adds a release-note entry.
  • Refreshes ZUNA’s RMSNorm documentation.
File Description
pyproject.toml Raises PyTorch and TorchAudio minimum versions.
docs/​whats_new.rst Documents the dependency requirement.
braindecode/​models/​zuna.py Removes stale compatibility wording.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/whats_new.rst Outdated
Copilot AI review requested due to automatic review settings September 21, 2026 15:42
@bruAristimunha bruAristimunha changed the title Require PyTorch and TorchAudio 2.4 or newer Require PyTorch 2.4 and remove obsolete compatibility code Sep 21, 2026

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 review overview

🔵 Needs a closer look

Restore REVE RMSNorm’s prior constructor defaults and dim= compatibility.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 21, 2026 15:53

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 review overview

🟢 Approval recommended

Validation covers the changes and no blocking review comments remain.

Review effort: Lite
Findings: None

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.79%. Comparing base (25c7ed6) to head (a5ca7e4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1174      +/-   ##
==========================================
+ Coverage   86.57%   86.79%   +0.21%     
==========================================
  Files         142      142              
  Lines       16303    16271      -32     
==========================================
+ Hits        14114    14122       +8     
+ Misses       2189     2149      -40     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings September 21, 2026 17:28

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 review overview

🟢 Approval recommended

Only a minor, non-blocking documentation nit remains; no approval-blocking issues were identified.

Review effort: Lite
Findings: None

@bruAristimunha
bruAristimunha merged commit 0dd776d into master Sep 21, 2026
13 of 14 checks passed
bruAristimunha added a commit to julien-gadonneix/braindecode that referenced this pull request Sep 24, 2026
Take master's REVE and ZUNA files (same RMSNorm change, from braindecode#1176) and
drop the duplicate API-changes entry for the PyTorch >= 2.4 requirement
(braindecode#1174). Affected model tests: 328 passed, 56 skipped.
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