Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ jobs:
- name: Install the dependencies
run: |
python -m pip install --user --upgrade pip wheel
python -m pip install torch==2.5.1 torchvision==0.20.1
cat "requirements-dev.txt"
python -m pip install -r requirements-dev.txt
python -m pip install torch==2.5.1 torchvision==0.20.1 -r requirements-dev.txt
python -m pip list
python setup.py develop # test no compile installation
shell: bash
Expand Down
5 changes: 3 additions & 2 deletions monai/transforms/signal/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,11 @@ def __call__(self, signal: np.ndarray) -> Any:
Args:
signal: signal to be frequency removed
"""
signal = convert_to_tensor(signal, dtype=torch.double)
b_notch, a_notch = convert_to_tensor(
iirnotch(self.frequency, self.quality_factor, self.sampling_freq), dtype=torch.float
iirnotch(self.frequency, self.quality_factor, self.sampling_freq), dtype=torch.double
)
y_notched = filtfilt(convert_to_tensor(signal), a_notch, b_notch)
y_notched = filtfilt(signal, a_notch, b_notch)

return y_notched

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires = [
"wheel",
"setuptools",
"torch>=2.4.1",
"torch>=2.5.1",
"ninja",
"packaging"
]
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
torch>=2.4.1; platform_system != "Windows"
torch>=2.4.1, !=2.7.0; platform_system == "Windows"
torch>=2.5.1; platform_system != "Windows"
torch>=2.5.1, !=2.7.0; platform_system == "Windows"
numpy>=1.24,<3.0
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm non-breaking claim and dependency consistency (torch, torchaudio, numpy).

  • Raising the torch floor to 2.5.1 narrows supported environments. If the PR is marked “non-breaking,” confirm our supported matrix already requires ≥2.5.1 and update docs/release notes if needed.
  • PR summary mentions “adds torchaudio as a dependency.” If torchaudio is only added to dev requirements, that’s fine; if runtime code now depends on it, add a runtime pin (or an extra like monai[audio]) and ensure torch/torchaudio version compatibility.
  • Given the NumPy 2.3.1 test failure is the driver, ensure our NumPy pin and CI cover 2.x and that the dtype fix resolves the test across OSes.

Run this script to check for constraint consistency and runtime usage:

I can help propose extras (e.g., [audio]) and align pins once we see the scan output.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Torch constraints across repo =="
rg -n --no-heading -A2 -B2 $'torch\\s*[<>=!]' || true

echo
echo "== Torchaudio presence (constraints/imports) =="
rg -n --no-heading -A2 -B2 $'torchaudio' || true

echo
echo "== Numpy constraints (requirements*/pyproject) =="
rg -n --no-heading $'^numpy.*' requirements* pyproject.toml || true

echo
echo "== CI workflows referencing torch versions =="
fd -t f -a .github | xargs -I {} rg -n --no-heading -H 'torch|pytorch|TORCH_VERSION' {} || true

Length of output: 18092


Action required — align torch pins, confirm torchaudio runtime vs dev, and verify NumPy 2.x CI

Scan summary (concise): pyproject.toml and requirements.txt require torch>=2.5.1, but setup.cfg/docs/env still allow older torch/pytorch; torchaudio appears only in dev requirements; numpy is pinned >=1.24,<3.0.

Files needing attention:

  • pyproject.toml — torch>=2.5.1 (OK if intended).
  • requirements.txt — torch>=2.5.1 / Windows variant (OK).
  • setup.cfg — install_requires has torch>=2.4.1 — update to >=2.5.1 to match or document the intended variance.
  • environment-dev.yml — pytorch>=2.3.0 — update or justify (dev env still allows older PyTorch).
  • docs/requirements.txt — references torch>=2.4.1 and a 2.4.1 CPU wheel — update docs wheel/pin to match new floor.
  • requirements-dev.txt — contains torchaudio (dev only). If torchaudio is now a runtime dependency, move it to runtime deps (pyproject/setup.cfg/requirements) or provide an extra (e.g., [audio]) and pin to a torchaudio version compatible with torch>=2.5.1.
  • monai/transforms/signal/array.py & tests/transforms/test_signal_remove_frequency.py — use optional_import/skipUnless for torchaudio; ensure CI either installs torchaudio for those tests or accepts skips.
  • numpy (requirements.txt / setup.cfg / environment-dev.yml) — pinned >=1.24,<3.0. If NumPy 2.3.1 caused failures, add CI coverage for numpy==2.3.1 and confirm the dtype fix resolves the test across OSes.
  • .github workflows — no references to torch/pytorch/TORCH_VERSION found; add/update CI matrix to explicitly exercise the declared minimal torch and numpy versions.

Please update the listed files or confirm the intended supported matrix and whether torchaudio is a runtime dependency; I can prepare concrete diffs if you want.

🤖 Prompt for AI Agents
In requirements.txt lines 1-2, align the torch pins across the repository:
update setup.cfg install_requires, environment-dev.yml, and
docs/requirements.txt to require torch>=2.5.1 (or document intentional
divergence), and remove the outdated 2.4.1 CPU wheel reference; decide whether
torchaudio is a runtime dependency—if it is, move it from requirements-dev.txt
into runtime deps (pyproject/setup.cfg/requirements) or expose it as an optional
extra (e.g., [audio]) with a torchaudio version compatible with torch>=2.5.1,
otherwise make all torchaudio uses in monai/transforms/signal/array.py and its
tests use optional_import/skipUnless so tests skip when torchaudio is absent;
pin numpy policy consistently (keep >=1.24,<3.0), add CI jobs to run with
numpy==2.3.1 and the minimal torch>=2.5.1 (including Windows variant), and
update GitHub workflow matrices to explicitly exercise the declared minimal
torch and numpy versions so CI validates the compatibility matrix.

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ setup_requires =
ninja
packaging
install_requires =
torch>=2.4.1
torch>=2.5.1
numpy>=1.24,<3.0
Comment on lines 44 to 46
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Add Windows marker to exclude torch 2.7.0 here as well.

setup.cfg doesn’t reflect the Windows !=2.7.0 exclusion used elsewhere. Mirror it to avoid pulling the known-bad build on Windows.

 install_requires =
-    torch>=2.5.1
+    torch>=2.5.1; platform_system != "Windows"
+    torch>=2.5.1,!=2.7.0; platform_system == "Windows"
     numpy>=1.24,<3.0

🏁 Script executed:

#!/bin/bash
# search for torch references across the repo
rg -n "torch" -C2 .

# search for Windows exclusion of version 2.7.0
rg -n "!=2.7.0" -C2 .

Length of output: 274858


Add Windows exclusion to setup.cfg install_requires
File setup.cfg lines 44–46: mirror requirements.txt to avoid torch 2.7.0 on Windows.

 install_requires =
-    torch>=2.5.1
+    torch>=2.5.1; platform_system != "Windows"
+    torch>=2.5.1,!=2.7.0; platform_system == "Windows"
     numpy>=1.24,<3.0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
install_requires =
torch>=2.4.1
torch>=2.5.1
numpy>=1.24,<3.0
install_requires =
torch>=2.5.1; platform_system != "Windows"
torch>=2.5.1,!=2.7.0; platform_system == "Windows"
numpy>=1.24,<3.0
🤖 Prompt for AI Agents
In setup.cfg around lines 44 to 46, the install_requires entry currently forces
torch for all platforms; update it to mirror requirements.txt and exclude
installing torch on Windows to avoid pulling torch 2.7.0. Change the torch
requirement to a platform-specific marker (e.g. "torch>=2.5.1; sys_platform !=
'win32'") or match whatever conditional used in requirements.txt, leaving numpy
unchanged, so Windows installs will skip torch and follow the mirrored
requirements.


[options.extras_require]
Expand Down
Loading