1、问题描述:
在YOLOv5中添加CBAM注意力机制,运行后报错如下:
RuntimeError: adaptive_max_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 at https://github.com/pytorch/pytorch/issues to help us prioritize adding deterministic support for this operation.
在这里插入图片描述
2、解决办法:
根据报错提示,找到train.py文件中的317行。

在scaler.scale(loss).backward()前添加torch.use_deterministic_algorithms(False)

在这里插入图片描述

Logo

欢迎来到FlagOS开发社区,这里是一个汇聚了AI开发者、数据科学家、机器学习爱好者以及业界专家的活力平台。我们致力于成为业内领先的Triton技术交流与应用分享的殿堂,为推动人工智能技术的普及与深化应用贡献力量。

更多推荐