ivadomed / ivadomed/model-spinal-rootlets
Running nnUnet inference on Apple GPU
- Dominant language
- Python
- Stars
- 8
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
I tried to install nnU-Net locally on my new MacBook using:
https://github.com/ivadomed/model-spinal-rootlets/blob/72c1842285daf7e9671216f8c81380ec801e917d/packaging_lumbar_rootlets/README.md?plain=1#L44
But I got this error when running `run_inference_single_subject.py`
```
python ~/code/model-spinal-rootlets/packaging_lumbar_rootlets/run_inference_single_subject.py -h
Traceback (most recent call last):
File "/Users/valosek/code/model-spinal-rootlets/packaging_ventral_rootlets/run_inference_single_subject.py", line 31, in
from nnunetv2.inference.predict_from_raw_data import nnUNetPredictor
File "/Users/valosek/miniconda3/envs/nnunet/lib/python3.9/site-packages/nnunetv2/inference/predict_from_raw_data.py", line 22, in
from nnunetv2.inference.data_iterators import PreprocessAdapterFromNpy, preprocessing_iterator_fromfiles, \
File "/Users/valosek/miniconda3/envs/nnunet/lib/python3.9/site-packages/nnunetv2/inference/data_iterators.py", line 12, in
from nnunetv2.preprocessing.preprocessors.default_preprocessor import DefaultPreprocessor
File "/Users/valosek/miniconda3/envs/nnunet/lib/python3.9/site-packages/nnunetv2/preprocessing/preprocessors/default_preprocessor.py", line 25, in
from nnunetv2.preprocessing.cropping.cropping import crop_to_nonzero
File "/Users/valosek/miniconda3/envs/nnunet/lib/python3.9/site-packages/nnunetv2/preprocessing/cropping/cropping.py", line 5, in
from acvl_utils.cropping_and_padding.bounding_boxes import get_bbox_from_mask, crop_to_bbox, bounding_box_to_slice
File "/Users/valosek/miniconda3/envs/nnunet/lib/python3.9/site-packages/acvl_utils/cropping_and_padding/bounding_boxes.py", line 5, in
import blosc2
File "/Users/valosek/miniconda3/envs/nnunet/lib/python3.9/site-packages/blosc2/__init__.py", line 86, in
from .blosc2_ext import (
File "blosc2_ext.pyx", line 1, in init blosc2.blosc2_ext
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
```
So, I tried `venv_sct`, and it worked!
```
source $SCT_DIR/python/etc/profile.d/conda.sh
conda activate venv_sct
python ~/code/model-spinal-rootlets/packaging_lumbar_rootlets/run_inference_single_subject.py -h
```
But since it took several minutes to run inference on a single image using CPU, I checked the status of [accelaring nnunet on Apple's GPUs](https://github.com/MIC-DKFZ/nnUNet/issues/2435) and found this [super relevant PR](https://github.com/pytorch/pytorch/pull/145366#issuecomment-2737992581); continued in the next comment.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with packaging_lumbar_rootlets/README.md and run_inference_single_subject.py, then reproduce the NumPy/blosc2 import error and compare it with the working venv_sct invocation. Review the referenced nnUNet issue and PyTorch PR for Apple GPU support; the payload does not define a concrete change or acceptance test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, python, pytorch
- Domain
- machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100