Skip to content

[BUG]save model fail for RuntimeError: "mse_cpu" not implemented for 'BFloat16' #1279

@Yunxia-wang

Description

@Yunxia-wang

Describe the bug

I used cellpose gui to hand annotation and retrain the model. I meet the error in saving model with RuntimeError: "mse_cpu" not implemented for 'BFloat16'

I used the MacBook Pro, 2.3 GHz 8-Core Intel Core i9

Run log
python -m cellpose

,,,
2025-07-22 10:26:48,093 [INFO] >>> saving model to /Users/cell_seg_res/S1R_5/analysis_outputs/models/cpsam_20250722_090158
Traceback (most recent call last):
File "/Users/yunxiawang/Downloads/cellpose-main/cellpose/gui/gui.py", line 1809, in new_model
self.train_model(restore=restore, normalize_params=normalize_params)
File "/Users/yunxiawang/Downloads/cellpose-main/cellpose/gui/gui.py", line 1826, in train_model
self.new_model_path, train_losses = train.train_seg(
File "/Users/yunxiawang/Downloads/cellpose-main/cellpose/train.py", line 463, in train_seg
loss = _loss_fn_seg(lbl, y, device)
File "/Users/yunxiawang/Downloads/cellpose-main/cellpose/train.py", line 49, in _loss_fn_seg
loss = criterion(y[:, -3:-1], veci)
File "/Users/yunxiawang/miniconda3/envs/cellpose/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/Users/yunxiawang/miniconda3/envs/cellpose/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/yunxiawang/miniconda3/envs/cellpose/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 535, in forward
return F.mse_loss(input, target, reduction=self.reduction)
File "/Users/yunxiawang/miniconda3/envs/cellpose/lib/python3.8/site-packages/torch/nn/functional.py", line 3339, in mse_loss
return torch._C._nn.mse_loss(expanded_input, expanded_target, _Reduction.get_enum(reduction))
RuntimeError: "mse_cpu" not implemented for 'BFloat16'
,,,

Screenshots
process figures
Image

Image Image Image

Error figures
Image

Please help me. Thank you

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions