项目场景:
`
2024.9.26日,YOLOv9报错处理torch.cuda.amp.autocast
问题描述
报错,torch.cuda.amp.autocast(amp): torch.cuda.amp.autocast is deprecated,please use torch.amp.autocast 当去掉cuda之后,会报错device_type应该是str类型而不是bool类型:
原因分析:
新的autocast类没有默认给device_type赋值为“cuda”:
解决方案:
直接将对应的代码修改为如下代码,就可以正常跑了。但是仅限在GPU上跑才能正常运行。
with torch.amp.autocast(device_type = "cuda",enabled=amp):
如果有用,请点赞。
2791

被折叠的 条评论
为什么被折叠?



