Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Issue when running with post-release version of PyTorch #1054

Open
MeyerBender opened this issue Nov 18, 2024 · 0 comments
Open

[BUG] Issue when running with post-release version of PyTorch #1054

MeyerBender opened this issue Nov 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@MeyerBender
Copy link

Describe the bug
Running cellpose with PyTorch version 2.5.1.post303 leads to the following error:

File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/spatialproteomics/tl/tool.py", line 86, in cellpose
    masks_pred, _, _, _ = model.eval(
  File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/cellpose/models.py", line 187, in eval
    diams, _ = self.sz.eval(x, channels=channels, channel_axis=channel_axis,
  File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/cellpose/models.py", line 776, in eval
    masks = self.cp.eval(
  File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/cellpose/models.py", line 534, in eval
    masks = self._compute_masks(x.shape, dP, cellprob, flow_threshold=flow_threshold,
  File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/cellpose/models.py", line 620, in _compute_masks
    outputs = dynamics.resize_and_compute_masks(
  File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/cellpose/dynamics.py", line 839, in resize_and_compute_masks
    mask = compute_masks(dP, cellprob, niter=niter,
  File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/cellpose/dynamics.py", line 913, in compute_masks
    mask = remove_bad_flow_masks(mask, dP, threshold=flow_threshold,
  File "/g/huber/users/meyerben/notebooks/spatialproteomics_pipelines/celestimo/.snakemake/conda/4057a625210cbf20c14eec4e61ec3417_/lib/python3.9/site-packages/cellpose/dynamics.py", line 623, in remove_bad_flow_masks
    major_version, minor_version, _ = torch.__version__.split(".")
ValueError: too many values to unpack (expected 3)

Should be fairly easy to fix by simple replacing the corresponding line with something like this:

torch_version = torch.__version__.split(".")
major_version, minor_version = torch_version[0], torch_version[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant