Hi there,
I was trying out the Colab inference notebook ([here])(https://colab.research.google.com/github/MMathisLab/CellSeg3d/blob/main/Notebooks/Colab_inference_demo.ipynb#scrollTo=IFbmZ3_zAm-1) and I've gotten the following error. All original code above this line ran without error:
result = cs3d.inference_on_images(
demo_image,
config=inference_config,
)
WARNING:napari_cellseg3d.utils:Caught TypeError: SwinUNETR.__init__() got multiple values for argument 'in_channels'
ERROR:napari_cellseg3d.utils:SwinUNETR.__init__() got multiple values for argument 'in_channels'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/models/model_SwinUNetR.py", line 34, in __init__
super().__init__(
TypeError: SwinUNETR.__init__() got multiple values for argument 'in_channels'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/worker_inference.py", line 859, in inference
model = model_class(
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/models/model_SwinUNetR.py", line 47, in __init__
super().__init__(
TypeError: SwinUNETR.__init__() got multiple values for argument 'in_channels'
--------------------
Parameters summary :
Model is : SwinUNetR
Window inference is enabled
Window size is 64
Window overlap is 0.25
Dataset loaded on cuda device
--------------------
MODEL DIMS : [64, 64, 64]
Model name : SwinUNetR
Instantiating model...
Changing numpy and monai versions solved the issue for me:
!pip install -U "numpy>=2.1,<2.6" "monai==1.3.2"
import numpy, monai
print("NumPy:", numpy.__version__)
print("MONAI:", monai.__version__)
NumPy: 2.4.6
MONAI: 1.3.2
Then updating reshape to shape to match different numpy version:
from pathlib import Path
p = Path("/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/worker_inference.py")
s = p.read_text()
s = s.replace("np.reshape(volume, newshape=(1, *volume.shape))",
"np.reshape(volume, (1, *volume.shape))")
p.write_text(s)
print("Patched:", p)
Hi there,
I was trying out the Colab inference notebook ([here])(https://colab.research.google.com/github/MMathisLab/CellSeg3d/blob/main/Notebooks/Colab_inference_demo.ipynb#scrollTo=IFbmZ3_zAm-1) and I've gotten the following error. All original code above this line ran without error:
Changing numpy and monai versions solved the issue for me:
NumPy: 2.4.6
MONAI: 1.3.2
Then updating reshape to shape to match different numpy version: