-
Notifications
You must be signed in to change notification settings - Fork 545
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When I try to train a new model, an error occurs when saving.
To Reproduce
Steps to reproduce the behavior: I followed the train new model instructions.
Run log
Ran python -m cellpose got:
2025-10-08 11:34:05,762 [INFO] training with ['DSCF5955.JPG']
2025-10-08 11:34:05,766 [INFO] training new model starting at model cpsam
2025-10-08 11:34:05,768 [WARNING] model_type argument is not used in v4.0.1+. Ignoring this argument...
2025-10-08 11:34:05,811 [INFO] ** TORCH MPS version installed and working. **
2025-10-08 11:34:05,818 [INFO] >>>> using GPU (MPS)
2025-10-08 11:34:44,643 [INFO] >>>> loading model /Users/GeorgesKanaan/.cellpose/models/cpsam
GUI_INFO: name of new model: cpsam_train1
2025-10-08 11:38:08,910 [INFO] computing flows for labels
2025-10-08 11:39:42,853 [INFO] >>> computing diameters
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 7.80it/s]
2025-10-08 11:39:43,018 [INFO] >>> normalizing {'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 20.0, 'smooth_radius': 0.0, 'tile_norm_blocksize': 0.0, 'tile_norm_smooth3D': 1.0, 'invert': False}
2025-10-08 11:39:44,638 [INFO] >>> n_epochs=100, n_train=1, n_test=None
2025-10-08 11:39:44,638 [INFO] >>> AdamW, learning_rate=0.00001, weight_decay=0.10000
2025-10-08 11:39:44,673 [INFO] >>> saving model to /Users/GeorgesKanaan/Documents/Work/0_Projects/0_Memory/1_Cycling_Memory/Data/Scope/33S10_25ul/models/cpsam_train1
Traceback (most recent call last):
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.10/site-packages/cellpose/gui/gui.py", line 1808, in new_model
self.train_model(restore=restore, normalize_params=normalize_params)
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.10/site-packages/cellpose/gui/gui.py", line 1825, in train_model
self.new_model_path, train_losses = train.train_seg(
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.10/site-packages/cellpose/train.py", line 468, in train_seg
loss.backward()
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.10/site-packages/torch/_tensor.py", line 648, in backward
torch.autograd.backward(
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.10/site-packages/torch/autograd/__init__.py", line 353, in backward
_engine_run_backward(
File "/Users/GeorgesKanaan/micromamba/envs/jupyter/lib/python3.10/site-packages/torch/autograd/graph.py", line 824, in _engine_run_backward
return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
RuntimeError: Expected scalar_type == ScalarType::Float || inputTensor.scalar_type() == ScalarType::Int || scalar_type == ScalarType::Bool to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working