[Python] 'CUDA' out of memory issue

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    here I am tried training data for my AI/ML model and i got 'CUDA' out of memory issue :

    Any solution would be the great help

    torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 3.52 GiB. GPU 0 has a total capacity of 11.75 GiB of which 609.19 MiB is fr ee. Including non-PyTorch memory, this process has 10.89 GiB memory in use. Of the allocated memory 10.72 GiB is allocated by PyTorch, and 17.72 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

    To overcome the issue to train models, I already used garbage collector and possible other alternatives but won't work

    Continue reading...

Compartilhe esta Página