Skip to content

TypeError in RunCellpose in GPU mode #154

Open
@braymp

Description

Running the latest version of RunCellpose 2b3d133 with the attached pipeline on the welcome screen example images yields the following error:

Traceback (most recent call last):
  File "C:\Users\brayma2\OneDrive - Novartis Pharma AG\github\cellprofiler-plugins\runcellpose.py", line 373, in run
    y_data, flows, *_ = model.eval(
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\models.py", line 286, in eval
    masks, flows, styles = self.cp.eval(x,
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\models.py", line 629, in eval
    masks, styles, dP, cellprob, p, bd, tr = self._run_cp(x,
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\models.py", line 695, in _run_cp
    yf, style = self._run_nets(img, net_avg=net_avg,
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\core.py", line 405, in _run_nets
    y0, style = self._run_net(img, augment=augment, tile=tile,
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\core.py", line 479, in _run_net
    y, style = self._run_tiled(imgs, augment=augment, bsize=bsize,
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\core.py", line 580, in _run_tiled
    y0, style = self.network(IMG[irange], return_conv=return_conv)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\core.py", line 347, in network
    y, style = self.net(X)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\resnet_torch.py", line 200, in forward
    T0 = self.upsample(style, T0, self.mkldnn)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\resnet_torch.py", line 167, in forward
    x = self.up[n](x, xd[n], style, mkldnn=mkldnn)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellpose\resnet_torch.py", line 118, in forward
    x = self.proj(x) + self.conv[1](style, self.conv[0](x) + y, mkldnn=mkldnn)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\container.py", line 141, in forward
    input = module(input)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 446, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 442, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
RuntimeError: CUDA out of memory. Tried to allocate 50.00 MiB (GPU 0; 4.00 GiB total capacity; 317.22 MiB already allocated; 2.01 GiB free; 409.60 MiB allowed; 360.00 MiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

I'm less concerned about the above error, which seems outside of scope here (although if you have suggestions on how to fix, I'm all ears). However, it's the error following that I wanted to bring up:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\brayma2\onedrive - novartis pharma ag\github\cellprofiler\master\cellprofiler\gui\pipelinecontroller.py", line 3390, in do_step
    self.__pipeline.run_module(module, workspace_model)
  File "C:\Users\brayma2\.conda\envs\py38\lib\site-packages\cellprofiler_core\pipeline\_pipeline.py", line 1298, in run_module
    module.run(workspace)
  File "C:\Users\brayma2\OneDrive - Novartis Pharma AG\github\cellprofiler-plugins\runcellpose.py", line 386, in run
    except float(cellpose_ver[0:3]) >= 0.7 and int(cellpose_ver[0])<2:
TypeError: catching classes that do not inherit from BaseException is not allowed

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions