RuntimeError: nonzero is not supported for tensors with more than INT_MAX elements
Opened this issue · 2 comments
I am traying to segment a Xenium picture to subsequently use the npy mask with Xenium ranger to allocate my transcriptional data.
The xenium picture is 51206 x 95243 px
I generated training ROIs, and trained a new model with the GUI.
I tested the model with a 19974 x 2857 px test ROI, and it worked nicely, while generating a 20Gb NPY mask.
Anything bigger crash the kernel, even if the memory didn't seem to reach the max.
I tried SOPA, but the segmentation was not great, like if it didn't use my trained model.
Anyone with experience using cellpose for full Xenium slide segmentation?
python -m cellpose --verbose --image_path $VSC_SCRATCH/Spatial/Xenium/Test_region.ome.tif --pretrained_model 2410-6362 --chan 3 --chan2 1 --diameter 0
Upload:
I ran half of the section on a HPC with 257Gb of RAM
It seems to be able to run it with the allocated ressources, but I got the following error:
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/data/leuven/335/vsc33513/miniconda_wice/envs/sopa_env/lib/python3.11/site-packages/cellpose/main.py", line 358, in
main()
File "/data/leuven/335/vsc33513/miniconda_wice/envs/sopa_env/lib/python3.11/site-packages/cellpose/main.py", line 205, in main
out = model.eval(
^^^^^^^^^^^
File "/data/leuven/335/vsc33513/miniconda_wice/envs/sopa_env/lib/python3.11/site-packages/cellpose/models.py", line 534, in eval
masks = self._compute_masks(x.shape, dP, cellprob, flow_threshold=flow_threshold,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/leuven/335/vsc33513/miniconda_wice/envs/sopa_env/lib/python3.11/site-packages/cellpose/models.py", line 620, in _compute_masks
outputs = dynamics.resize_and_compute_masks(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/leuven/335/vsc33513/miniconda_wice/envs/sopa_env/lib/python3.11/site-packages/cellpose/dynamics.py", line 839, in resize_and_compute_masks
mask = compute_masks(dP, cellprob, niter=niter,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/leuven/335/vsc33513/miniconda_wice/envs/sopa_env/lib/python3.11/site-packages/cellpose/dynamics.py", line 906, in compute_masks
mask = get_masks_torch(p_final, inds, dP.shape[1:],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/leuven/335/vsc33513/miniconda_wice/envs/sopa_env/lib/python3.11/site-packages/cellpose/dynamics.py", line 764, in get_masks_torch
seeds1 = torch.nonzero((h1 - hmax1 > -1e-6) * (h1 > 10))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: nonzero is not supported for tensors with more than INT_MAX elements
Here are the packages version:
archspec 0.2.3
boltons 23.0.0
Brotli 1.0.9
cellpose 3.1.0
certifi 2024.8.30
cffi 1.17.1
charset-normalizer 3.3.2
conda 24.7.1
conda-libmamba-solver 24.7.0
conda-package-handling 2.3.0
conda_package_streaming 0.10.0
distro 1.9.0
fastremap 1.15.0
filelock 3.16.1
frozendict 2.4.2
fsspec 2024.9.0
idna 3.7
imagecodecs 2024.9.22
Jinja2 3.1.4
jsonpatch 1.33
jsonpointer 2.1
libmambapy 1.5.8
llvmlite 0.43.0
MarkupSafe 2.1.5
menuinst 2.1.2
mpmath 1.3.0
natsort 8.4.0
networkx 3.3
numba 0.60.0
numpy 2.0.2
nvidia-cublas-cu12 12.1.3.1
nvidia-cuda-cupti-cu12 12.1.105
nvidia-cuda-nvrtc-cu12 12.1.105
nvidia-cuda-runtime-cu12 12.1.105
nvidia-cudnn-cu12 9.1.0.70
nvidia-cufft-cu12 11.0.2.54
nvidia-curand-cu12 10.3.2.106
nvidia-cusolver-cu12 11.4.5.107
nvidia-cusparse-cu12 12.1.0.106
nvidia-nccl-cu12 2.20.5
nvidia-nvjitlink-cu12 12.6.68
nvidia-nvtx-cu12 12.1.105
opencv-python-headless 4.10.0.84
packaging 24.1
pip 24.2
platformdirs 3.10.0
pluggy 1.0.0
pycosat 0.6.6
pycparser 2.21
Pygments 2.18.0
PyQt6 6.7.1
PyQt6-Qt6 6.7.3
PyQt6_sip 13.8.0
pyqtgraph 0.13.7
PySocks 1.7.1
QtPy 2.4.1
requests 2.32.3
roifile 2024.9.15
ruamel.yaml 0.17.21
scipy 1.14.1
setuptools 75.1.0
superqt 0.6.7
sympy 1.13.3
tifffile 2024.9.20
torch 2.4.1
tqdm 4.66.5
triton 3.0.0
truststore 0.8.0
typing_extensions 4.12.2
urllib3 2.2.2
wheel 0.44.0
zstandard 0.22.0