RuntimeError: CUDA error: device-side assert triggered
When I personally use pytorch lightning, I get the error RuntimeError: CUDA error: device-side assert triggered
Personally, it is becausethe number of classification categories does not match, but there will be no error when running on GPU
Solution: It is recommended to modify the operating environment to cpu, then you can see where the problem lies where
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)
Change to
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)
and you can clearly see your mistake!