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 using torch.use_deterministic_algorithms(True), the sparsemax function fails due to the lack of deterministic support for cumsum in CUDA. This issue occurs specifically in the _sparsemax_threshold_and_support function, where the operation:
topk_cumsum=topk.cumsum(dim) -1
triggers the following error:
RuntimeError: cumsum_cuda_kernel does not have a deterministic implementation, but you set 'torch.use_deterministic_algorithms(True)'. You can turn off determinism just for this operation, or you can use the 'warn_only=True' option, if that's acceptable for your application. You can also file an issue at https://github.com/pytorch/pytorch/issues to help us prioritize adding deterministic support for this operation.
Without a deterministic support models trained on GPU with the use of sparmax have unexcepted behavior when running on CPU for inference (with a radical drop in prediction accuracy).
Problem
When using
torch.use_deterministic_algorithms(True)
, the sparsemax function fails due to the lack of deterministic support forcumsum
in CUDA. This issue occurs specifically in the_sparsemax_threshold_and_support
function, where the operation:triggers the following error:
Without a deterministic support models trained on GPU with the use of sparmax have unexcepted behavior when running on CPU for inference (with a radical drop in prediction accuracy).
Steps to reproduce
Environment
1.3
2.4.0
12.1
3.12.4
Ubuntu 20.04 LTS
Dependencies
Solution
According to this issue, deterministic support for
cumsum
is resolved in PyTorch 2.6.0, but this version is not released yet.For older versions, the following workarounds could be considered:
cumsum
.The text was updated successfully, but these errors were encountered: