HELP - mixed precision problem

I am new to pytorch. I was using tensorflow and keras before but when I came to know about pytorch’s stability and native AMP support. I switched to pytorch.

GPU: RTX 2070 super (vram - 8GB)

I used mixed precision with grad accum of 2. Image resolution is 416 x 416. But I’m getting CUDA out of memory error. I even switched to kaggle kernel, The same error pops up there too.

kaggle GPU: NVIDIA K80(vram-16GB)

Is my logic correct?

Thanks in advance

The code logic is correct as seen in the amp example, so you might need to reduce the batch size further.
Is the training running fine without gradient accumulation and if so how large is the memory usage?

my batch size is 32 for validation and 16 for training with gradient accumulation of 2.
even wihtout grad accum, it’s not working properly.
I even tried with reduced img resolution and batch size 16 for both.