报错信息:
RuntimeError: adaptive_avg_pool2d_backward_cuda 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 athttps://github.com/pytorch/pytorch/issues to help us prioritize adding deterministic support for this operation.
解决方法:
禁用确定性算法模式:
如果你的应用程序可以容忍一些不确定性,可以尝试禁用确定性算法模式。比如说我是yolov7就在373行加一段代码
torch.use_deterministic_algorithms(False)
如果不是yolov7,在train.py里面ctrl+f
搜索
scaler.scale(loss)
在这个之前添加torch.use_deterministic_algorithms(False)
如果已经有了,就将
torch.use_deterministic_algorithms(True)
改为
torch.use_deterministic_algorithms(False)