You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to compute MaP on the GPU with no predictions, I receive the error:RuntimeError: Sort currently does not support bool dtype on CUDA.
This occurs in torchmetrics==0.7.3 and torchmetrics==0.8.0, the error does not occur in 0.7.2.
To Reproduce
Steps to reproduce the behavior...
Traceback (most recent call last):
File "C:/Users/hughesc/OneDrive - Microsoft/Documents/Git/pytorch-accelerated/pytorch_accelerated/exp.py", line 24, in <module>
print(map.compute())
File "C:\Users\hughesc\Anaconda3\envs\accelerated-dev\lib\site-packages\torchmetrics\metric.py", line 440, in wrapped_func
value = compute(*args, **kwargs)
File "C:\Users\hughesc\Anaconda3\envs\accelerated-dev\lib\site-packages\torchmetrics\detection\mean_ap.py", line 765, in compute
precisions, recalls = self._calculate(classes)
File "C:\Users\hughesc\Anaconda3\envs\accelerated-dev\lib\site-packages\torchmetrics\detection\mean_ap.py", line 627, in _calculate
recall, precision, scores = MeanAveragePrecision.__calculate_recall_precision_scores(
File "C:\Users\hughesc\Anaconda3\envs\accelerated-dev\lib\site-packages\torchmetrics\detection\mean_ap.py", line 697, in __calculate_recall_precision_scores
inds = torch.argsort(det_scores, descending=True)
RuntimeError: Sort currently does not support bool dtype on CUDA.
Hi, @Chris-hughes10 - Great first issue! 🎉 I love the description and thanks for sharing the code for reproducing the bug.
I can confirm that this is a regression from release 0.7.2, IMO: an explicit cast from torch.bool to torch.uint8 (on CUDA only) while applying torch.argsort should fix this. Looks like PyTorch doesn't support sorting for boolean dtypes on CUDA devices:
// FIXME: remove this check once cub sort supports boolTORCH_CHECK(self_dtype != ScalarType::Bool,
"Sort currently does not support bool dtype on CUDA.");
To maintainers: we don't test for boolean inputs (I only see floating point inputs) and this issue only comes when we pass empty preds.
@Chris-hughes10 : In case it's too important and cannot wait till Monday, please let me know. I can create a branch with the fix. I just want to wait for everyone's opinion on this, as they might have more context. :)
🐛 Bug
When I try to compute MaP on the GPU with no predictions, I receive the error:
RuntimeError: Sort currently does not support bool dtype on CUDA.
This occurs in
torchmetrics==0.7.3
andtorchmetrics==0.8.0
, the error does not occur in0.7.2
.To Reproduce
Steps to reproduce the behavior...
Code sample
Expected behavior
I would like to be able to compute the metric on the GPU
Environment
conda
,pip
, build command if you used source): condaThe text was updated successfully, but these errors were encountered: