ERROR

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 76.00 MiB. GPU 0 has a total capacty of 23.69 GiB of which 19.56 MiB is free. Process 29502 has 23.65 GiB memory in use. Of the allocated memory 21.81 GiB is allocated by PyTorch, and 48..

파송송 2023. 12. 12. 03:07
728x90

한 번에 처리해야하는 메모리가 커서 발생하는 에러로 batch size를 줄이거나 캐시를 지워주면 된다.

import torch, gc
gc.collect()
torch.cuda.empty_cache()

batch_size = 1000 -> 64

728x90