참고/Error
[에러해결] RuntimeError: CUDA out of memory
yul_S2
2023. 1. 13. 16:59
반응형
RuntimeError: CUDA out of memory
batch size가 너무 크거나 코드 상에서 메모리가 불필요하게 사용되고 있기 때문에 발생.
해결 방법
1. batch size 사이즈 줄이기
2. GPU의 캐시를 비워주고 다시 실행
import gc
import torch
gc.collect()
torch.cuda.empty_cache()
반응형