Cuda out of memory


(Mercea Otniel Bogdan) #1

Hello,

My name is Mercea Otniel Bogdan and i get CUDA error: out of memory on the lesson1-pets notebook. I have a GeForce GTX 670 with 2gb of memory. Is there a possibility to run it using this graphic card or should i buy a new one?


(Mercea Otniel Bogdan) #2

Solved. If someone has the same problem this line
data = ImageDataBunch.from_name_re(path_img, fnames, pat, ds_tfms=get_transforms(), size=224, bs=16)
will help.


(Sanyam Bhutani) #3

bs or batch size refers to the “chunk of data” you feed into your GPU for it to look at. If you’re using a smaller GPU or getting out of memory errors-reducing bs therefore helps because the size can now be accommodated in memory.

When you try using bigger models. “Bigger” refers to “deeper” Neural Nets: Ex Resnetx Where x is a bigger number-you can expect the same behaviour and again a reduction in bs would be required.


(ecdrid) #4

You should use Google Cloud ideally as it comes with free credits and a faster GPU also else you will have to wait for a longer time for an epoch to finish (easy to setup also, just follow the docs for that) and currently your GPU will be a bottleneck for later stages in the course,
So you should really get up GCP running!

Here’s Jeremy’s post