Skip to content

Cellpose plugin - Test GPU not working #273

@viksyn2

Description

@viksyn2

Hi, the button "Test GPU" in the Cellpose plugin does not work. I am using CellProfiler 4.8 and Cellpose 2.3.8
First it writes that it cannot find the 'core' module, and then it cannot find 'cellpose_var'. Both are not part of the "test_gpu" function.
Theis can be corredcted by adding these lines into the code:

def do_check_gpu(self):
    import importlib.util
    **from cellpose import core # added line**
    torch_installed = importlib.util.find_spec('torch') is not None
    #if the old version of cellpose <2.0, then use istorch kwarg
    **self.cellpose_ver = importlib.metadata.version('cellpose') # added line**
    if float(self.cellpose_ver[0:3]) >= 0.7 and int(self.cellpose_ver[0])<2:
        GPU_works = core.use_gpu(istorch=torch_installed)
    else:  # if new version of cellpose, use use_torch kwarg
        GPU_works = core.use_gpu(use_torch=torch_installed)
    if GPU_works:
        message = "GPU appears to be working correctly!"
    else:
        message = (
            "GPU test failed. There may be something wrong with your configuration."
        )
    import wx

    wx.MessageBox(message, caption="GPU Test")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions