煩人的pytorch gpu出錯問題:RuntimeError: CUDA out of memory. Tried to allocate 14.00 MiB 遠程主機間複製文件及文件夾

一、RuntimeError: CUDA out of memory. Tried to allocate 14.00 MiB (GPU 0; 10.76 GiB total capacity; 9.69 GiB already allocated; 15.56 MiB free; 9.91 GiB reserved in total by PyTorch)緩存

  • 應該有三個緣由
  1. GPU還有其餘進程佔用顯存,致使本進程沒法分配到足夠的顯存
  2. 緩存過多,使用torch.cuda.empty_cache()清理緩存
  3. 卡不行,換塊顯存更大的卡吧
  • 除此以外,注意pytorch在test時,必定要加上

下面的頗有效:code

with torch.no_grad():
  # test process

不然會使顯存加倍致使OOM錯誤進程

二、遠程主機間複製文件及文件夾ip

複製文件: ci

        * 命令格式: rem

                scp local_file remote_username@remote_ip:remote_folder get

                或者 it

                scp local_file remote_username@remote_ip:remote_file class

                或者 test

                scp local_file remote_ip:remote_folder 

                或者 

                scp local_file remote_ip:remote_file

複製目錄: 

        * 命令格式: 

                scp -r local_folder remote_username@remote_ip:remote_folder 

                或者 

                scp -r local_folder remote_ip:remote_folder

相關文章
相關標籤/搜索