anomalib icon indicating copy to clipboard operation
anomalib copied to clipboard

patchcore torch.pairwise_distance OOM on larger datasets

Open opassos opened this issue 4 years ago • 3 comments

I get CUDA memory blowing when doing larger datasets

return torch.pairwise_distance(x1, x2, p, eps, keepdim)
RuntimeError: CUDA out of memory. Tried to allocate 724.00 MiB (GPU 0; 11.00 GiB total capacity; 7.62 GiB already allocated; 190.31 MiB free; 8.77 GiB reserved in total by PyTorch)

Is there anything that could be done here? like moving this computation to CPU?

opassos avatar Feb 21 '22 13:02 opassos

@opassos Have you faced this patchcore issue https://github.com/openvinotoolkit/anomalib/issues/111?

innat avatar Feb 23 '22 10:02 innat

Hi @opassos, yeah, as you said, we could make device type optional in the components. Currently almost all of them (ie., model, anomaly-map generators, metric computation) are on GPU, which may not be always efficient.

samet-akcay avatar Feb 23 '22 12:02 samet-akcay

I guess i have the same problem. I opened up this discussion https://github.com/openvinotoolkit/anomalib/discussions/115 as i was not aware of this issue

daMichaelB avatar Feb 23 '22 20:02 daMichaelB

Closing as this has been addressed in #1267

samet-akcay avatar Aug 15 '23 14:08 samet-akcay