RuntimeError: $ Torch: not enough memory: you tried to allocate 1GB. Buy new RAM!

I closed gpu but still got this error. and I am sure that my cpu ram is enough (16GB).
so why this error occurred?

You can check with the following command if you are on linux system:

watch -n 1 'free -m'
1 Like

but my program can not run. if there is no process, the command will work?

The above command gives you reports of free ram space at every second.

So you can run it in one terminal and in another terminal you can run your programme. If you see that there is a spike in used ram space and getting the error, then probably there is a memory problem.

thank you, if is there similar command on windows?

It’s a known issue and I have created a PR on this. It’s #5585.

i have set the worker =0 , but the error still exits…

Hello, how do you solve it? Got the same error.

Hi! Did you figure out a solution? I am having a similar error.

I am having a similar issue in that the first time I r run the network no memory issue is reported. But the second time when I try to run on the same data again it reports a memory issue. Weird.