「CUDA out of memory.」で2週間考えた。
このエラーをもっと詳しく書くと
CUDA out of memory. Tried to allocate 48.00 MiB (GPU 0; 4.00 GiB total capacity; 3.38 GiB already allocated; 0 bytes free; 3.44 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
簡単に言うと、
「PyTorchに一度に処理させるデータがメモリのサイズを超えています。見直してね。」
と言っています。
コードの中のbatch_size=16を見直せということですが、それは最後の手段として、何かもっといい方法ないか探しまくりました。
閲覧数:51
