Got OSError: [Errno 12] Cannot allocate memory

When trainning a model, I got OSError: [Errno 12] Cannot allocate memory

I googled, found the way to set swap file for Nano, but could not find the way to set swap file for NX.

Do you have any suggestions?

Thank you.

More info,

I am training Resnet18.

Here are file counts I used:
Test 6276
Val 6321
Train 93270

The total file size is 7.42 GB

I removed some images, and it works now.

On a computer/server, when I get out of memery error, I set the batch size smaller to fix the issue.

But on jetson NX, decrease batch size do not work… I change it from 32 to 16, but still I got the error.

Should I change it to 8 or 1?

Later, I need to add more images.

hello zw_sd,

may I also know which JetPack release you’re working with,
thanks

It should be the latest one. I started training again, let me check it later.

Package: nvidia-jetpack
Version: 4.4-b186

hello zw_sd,

could you please try the suggestions from Topic 158686,
thanks

Hi @zw_sd, you can mount a SWAP file for NX the same way as Nano - see this procedure:

https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-transfer-learning.md#mounting-swap

1 Like

Thank you @dusty_nv @JerryChang, I will try to set. :)