-
Notifications
You must be signed in to change notification settings - Fork 374
Description
Describe the bug
The UNETR implementation in the research-contributions repository uses an outdated parameter name pos_embed that
is incompatible with MONAI versions >= 1.3.0. Starting from MONAI 1.3.0, the parameter was renamed from
pos_embed to proj_type in the ViT class.
To Reproduce
Steps to reproduce the behavior:
- Install MONAI >= 1.3.0 (tested with MONAI 1.5.0)
- Clone the research-contributions repository
- Navigate to
UNETR/BTCV/networks/unetr.py - Try to instantiate the UNETR model:
from networks.unetr import UNETR
model = UNETR(in_channels=1, out_channels=14, img_size=(96, 96, 96))- Observe the error when ViT is initialized with pos_embed parameter
Expected behavior
The UNETR model should work with current MONAI versions without parameter compatibility issues. The parameter
should be proj_type for MONAI >= 1.3.0.
Screenshots
N/A
Environment (please complete the following information):
- OS: Windows 11
- Python version: 3.12.8
- MONAI version: 1.5.0
- PyTorch version: 2.8.0+cu129
- CUDA/cuDNN version: CUDA 12.9
- GPU models and configuration: NVIDIA GeForce RTX 4060 Laptop GPU
Additional context
The issue affects users trying to use the UNETR implementation with newer MONAI versions. A simple fix would be
to:
- Update line 37 from pos_embed: str = "perceptron" to proj_type: str = "perceptron"
- Update line 96 from pos_embed=pos_embed to proj_type=proj_type
- Update the docstring and examples accordingly
This change would maintain backward compatibility if the minimum supported MONAI version is updated to 1.3.0, or
alternatively, a version check could be implemented to support both parameter names.