-
Notifications
You must be signed in to change notification settings - Fork 1.6k
HyenaUnetR (SwinUnetR + HyenaND): subquadratic alternative to windowed self-attention #8958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e287711
add HyenaND mixer and FFT depthwise conv
farhadrgh b8f3ee1
thread use_hyena and hyena_stages through stages
farhadrgh db758e3
add HyenaNDUNETR with from_paper_variant constructor
farhadrgh 1d25997
document HyenaND blocks and HyenaNDUNETR;
farhadrgh d2cad23
add nvsubquadratic to requirements-dev.txt
farhadrgh ede48dd
rename HyenaNDUNETR.from_paper_variant to get_variant
farhadrgh 0d0fd54
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e910366
Merge branch 'dev' into farhadr/hyena
farhadrgh 6979290
gate nvsubquadratic by python_version; add hyena-dep + GPU jobs
farhadrgh 9fc729d
style: fix isort + black on HyenaND files; nvsubquadratic --no-deps i…
farhadrgh b4ee214
target nvsubquadratic 0.1.1 (3.10 support, slimmed deps)
farhadrgh 8b29b96
target nvsubquadratic 0.1.1 (3.10 support, slimmed deps)
farhadrgh 0015215
address CodeRabbit review
farhadrgh e10a543
Merge branch 'dev' into farhadr/hyena
farhadrgh eeb8cbd
fix mypy
farhadrgh f31b90b
clearer ImportError hint for the optional nvsubquadratic dep
farhadrgh 0045644
Merge branch 'dev' into farhadr/hyena
farhadrgh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Optional self-hosted GPU CI for the HyenaND test surface. | ||
| # | ||
| # This workflow exercises the CUDA-required Hyena tests | ||
| # (tests/networks/blocks/test_hyena_block.py CUDA cases, the four-paper-variant | ||
| # forward and gradient cases in tests/networks/nets/test_swin_unetr.py and | ||
| # tests/networks/nets/test_hyena_nd_unetr.py, the SwinUNETR(use_hyena=False) | ||
| # golden-hash backward-compat regression, and sliding-window inference). | ||
| # | ||
| # Disabled by default (``if: false``). To enable: | ||
| # 1. Ensure a self-hosted runner with the labels below is available, AND | ||
| # 2. Ensure the runner has CUDA-capable hardware visible (the existing | ||
| # ``pythonapp-gpu.yml`` uses ``--gpus all`` against ``[self-hosted, linux, | ||
| # x64, common]``). Reuse that pool if possible. | ||
| # 3. Flip ``if: false`` to ``if: github.event.pull_request.merged != true`` | ||
| # (mirroring ``pythonapp-gpu.yml``'s gating pattern). | ||
| # | ||
| # Unlike ``pythonapp-gpu.yml``, this job pins Python 3.11+ so that | ||
| # ``nvsubquadratic`` (Hyena's optional dep, ``Requires-Python >= 3.11``) installs. | ||
|
|
||
| name: hyena-gpu | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: hyena-gpu-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| GPU-Hyena: | ||
| if: ${{ false }} # See header for enable instructions. | ||
| strategy: | ||
| matrix: | ||
| environment: | ||
| # NGC PyTorch 25.05 ships Python 3.12 and CUDA 12.5. Bump as needed. | ||
| - "NGC25.05+PY312" | ||
| include: | ||
| - environment: NGC25.05+PY312 | ||
| base: "nvcr.io/nvidia/pytorch:25.05-py3" | ||
| container: | ||
| image: ${{ matrix.base }} | ||
| options: --gpus all --env NVIDIA_DISABLE_REQUIRE=true | ||
| runs-on: [self-hosted, linux, x64, common] | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip wheel | ||
| python -c "import sys; assert sys.version_info >= (3, 11), f'Python >= 3.11 required for nvsubquadratic, got {sys.version}'" | ||
| python -m pip install -r requirements-dev.txt | ||
| python -m pip install -e '.[hyena]' | ||
| python -m pip list | ||
| shell: bash | ||
| - name: Verify CUDA + nvsubquadratic | ||
| run: | | ||
| nvidia-smi | ||
| python -c "import torch; assert torch.cuda.is_available(); print('CUDA OK:', torch.cuda.get_device_name(0))" | ||
| python -c "from monai.networks.blocks.hyena import is_nvsubquadratic_available; \ | ||
| assert is_nvsubquadratic_available(), 'nvsubquadratic must be importable'" | ||
| shell: bash | ||
| - name: Run Hyena test suite (CUDA + no-CUDA) | ||
| run: | | ||
| python -m pytest -v \ | ||
| tests/networks/blocks/test_hyena_block.py \ | ||
| tests/networks/nets/test_hyena_nd_unetr.py \ | ||
| tests/networks/nets/test_swin_unetr.py | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.