UCSD-E4E / acoustic-multiclass-training

Data processing and training pipeline for classifying bird species by sound
GNU General Public License v3.0
9 stars 2 forks source link

HOTFIX: improve gpu memory usage #85

Closed Sean1572 closed 1 year ago

Sean1572 commented 1 year ago

image

Obsreved that during the inner validation loop, the gpu utilization worsened resulting in CUDA out of memory errors. This was because tensors for training were still within scope during validation. This change should fix this error by freeing those tensors from memory prior to validation run

benjamin-cates commented 1 year ago

I still noticed the same memory usage spikes during validation on my machine, prolly should test it first

benjamin-cates commented 1 year ago

There might be an official way to free them without del

Sean1572 commented 1 year ago

There might be an official way to free them without del

https://discuss.pytorch.org/t/how-to-delete-a-tensor-in-gpu-to-free-up-memory/48879/9

We can do empty cache but this seems to be enough