【bug记录】RuntimeError: CUDA error: device-side assert triggered

RuntimeError: CUDA error: device-side assert triggered

我个人使用pytorch lightning时,报错RuntimeError: CUDA error: device-side assert triggered

我个人是因为分类类别数目对不上,但是在gpu上运行是不会提示错误的

解决方案:建议修改运行环境为cpu,就可以看到问题出在了哪里

trainer=pl.Trainer(devices=1,max_epochs=5,accelerator='gpu',default_root_dir='./checkpoints',limit_train_batches=5,limit_val_batches=1,limit_test_batches=5)
修改为
trainer=pl.Trainer(devices=1,max_epochs=5,accelerator='cpu',default_root_dir='./checkpoints',limit_train_batches=5,limit_val_batches=1,limit_test_batches=5)
可以清晰的看到自己的错误啦!

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44904205/article/details/132540423