Md Shafiul Islam
Md Shafiul Islam

Reputation: 1659

Getting CUDA out of memory under pytorch in Google Colab

I am trying to replicate the work described here (https://www.analyticsvidhya.com/blog/2019/02/building-crowd-counting-model-python/) in google colab. Unfortunately at first it was working but after a some time it is showing cuda out of memory error for this line of code.

output = model(img.unsqueeze(0))

Here is the error description:

RuntimeError: CUDA out of memory. Tried to allocate 98.00 MiB (GPU 0; 11.17 GiB total capacity; 10.78 GiB already allocated; 40.81 MiB free; 34.25 MiB cached)

I tried to run this code in different google account but shows same error.

Upvotes: 6

Views: 5091

Answers (1)

Muhammad Arslan
Muhammad Arslan

Reputation: 155

You could also resolve the issue by lowering the batch size and not the image resolution - as lowering the latter will affect the classification accuracy

Upvotes: 2

Related Questions