Project-MONAI / Project-MONAI/MONAI
Some Stored Weights for Bundles Not Compatible With `weights_only=True`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.7k
- Forks
- 1.6k
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 20
Description
Describe the bug
Some weights .pt files stored on the model zoo and Huggingface are not compatible with loading weights only. One example is the weights for pancreas_ct_dints_segmentation being stored as Numpy arrays, these should be stored as tensors and then the code for DINTS must be updated to not assume arrays (such as here).
To Reproduce
Steps to reproduce the behavior:
- Try loading the DINTS model with the given weights.
- Failure will occur with
torch.loadwhen loading thesearch_code_18590.ptfile.
Expected behavior
Should load without complaint.
Environment
Ensuring you use the relevant python executable, please paste the output of:
================================
Printing MONAI config...
================================
MONAI version: 1.7.dev2630
Numpy version: 2.4.6
Pytorch version: 2.13.0+cu130
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 82bbaeeb45e5490606c4ff4615dd85e0e83fce7c
MONAI __file__: /home/<username>/miniconda3/envs/rankseg_test/lib/python3.11/site-packages/monai/__init__.py
Optional dependencies:
Pytorch Ignite version: NOT INSTALLED or UNKNOWN VERSION.
ITK version: NOT INSTALLED or UNKNOWN VERSION.
Nibabel version: 5.4.2
scikit-image version: NOT INSTALLED or UNKNOWN VERSION.
scipy version: 1.17.1
Pillow version: 12.3.0
Tensorboard version: NOT INSTALLED or UNKNOWN VERSION.
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: NOT INSTALLED or UNKNOWN VERSION.
tqdm version: 4.70.0
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 7.2.2
pandas version: NOT INSTALLED or UNKNOWN VERSION.
einops version: NOT INSTALLED or UNKNOWN VERSION.
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.
pynrrd version: NOT INSTALLED or UNKNOWN VERSION.
clearml version: NOT INSTALLED or UNKNOWN VERSION.
For details about installing the optional dependencies, please visit:
https://monai.readthedocs.io/en/latest/installation.html#installing-the-recommended-dependencies
================================
Printing system config...
================================
System: Linux
Linux version: Ubuntu 24.04.4 LTS
Platform: Linux-6.8.0-124-generic-x86_64-with-glibc2.39
Processor: x86_64
Machine: x86_64
Python version: 3.11.15
Process name: python
Command: []
Num physical CPUs: 64
Num logical CPUs: 128
Num usable CPUs: 128
CPU usage (%): [2.6, 0.8, 0.7, 0.5, 0.8, 0.4, 0.4, 0.5, 0.5, 0.8, 0.2, 0.3, 0.5, 0.2, 0.3, 0.9, 0.2, 0.2, 0.2, 1.2, 0.2, 0.3, 0.1, 0.6, 0.1, 0.4, 0.2, 0.1, 0.7, 0.1, 0.1, 0.1, 0.2, 0.5, 0.1, 0.1, 0.1, 0.1, 0.1, 0.0, 0.1, 0.1, 0.1, 0.0, 0.1, 0.0, 0.1, 0.1, 0.0, 0.0, 0.1, 0.0, 0.1, 0.1, 0.1, 0.0, 0.1, 0.0, 0.0, 0.1, 0.1, 0.0, 0.1, 0.0, 0.3, 0.1, 0.3, 0.0, 0.1, 0.2, 0.1, 0.2, 0.1, 0.1, 0.1, 0.4, 0.1, 0.5, 0.3, 0.0, 0.2, 0.1, 0.1, 0.7, 0.1, 0.1, 0.1, 1.5, 0.1, 0.0, 0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.1, 0.2, 0.0, 0.1, 0.1, 0.0, 0.0, 0.0, 0.1, 0.0, 0.1, 0.0, 0.1, 0.0, 0.0, 0.1, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.1, 0.0, 0.3, 0.0, 0.1]
CPU freq. (MHz): 1904
Load avg. in last 1, 5, 15 mins (%): [0.1, 0.1, 0.2]
Disk usage (%): 93.1
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 503.3
Available memory (GB): 463.9
Used memory (GB): 39.4
================================
Printing GPU config...
================================
Num GPUs: 4
Has CUDA: True
CUDA version: 13.0
cuDNN enabled: True
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None
cuDNN version: 92000
Current device: 0
Library compiled for CUDA architectures: ['sm_75', 'sm_80', 'sm_86', 'sm_90', 'sm_100', 'sm_120']
GPU 0 Name: NVIDIA A40
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 84
GPU 0 Total memory (GB): 44.4
GPU 0 CUDA capability (maj.min): 8.6
GPU 1 Name: NVIDIA A40
GPU 1 Is integrated: False
GPU 1 Is multi GPU board: False
GPU 1 Multi processor count: 84
GPU 1 Total memory (GB): 44.4
GPU 1 CUDA capability (maj.min): 8.6
GPU 2 Name: NVIDIA A40
GPU 2 Is integrated: False
GPU 2 Is multi GPU board: False
GPU 2 Multi processor count: 84
GPU 2 Total memory (GB): 44.4
GPU 2 CUDA capability (maj.min): 8.6
GPU 3 Name: NVIDIA A40
GPU 3 Is integrated: False
GPU 3 Is multi GPU board: False
GPU 3 Multi processor count: 84
GPU 3 Total memory (GB): 44.4
GPU 3 CUDA capability (maj.min): 8.6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the DINTS loading logic in monai/networks/nets/dints.py near the referenced line and reproduce the failure by loading search_code_18590.pt with weights_only=True. Check how the pancreas_ct_dints_segmentation weights are stored on the model zoo or Hugging Face and identify the affected bundle files. Done means the stored weights load without complaint and DINTS no longer assumes NumPy arrays.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100