I am training multiple models in R. After a while, I run out of memory.
From rudimentary googling, the tensorflow sessions seems to hold things in memory after the objects have been overwritten in R. This has been a problem that others have encountered, however I have seen no answers that help for keras in R in particular.
Keras: release memory after finish training process
Tensorflow2.0: GPU runs out of memory during hyperparameter tuning loop
I've tried running these commands after each loop:
rm(model)
k_clear_session()
tf$compat$v1$keras$backend$clear_session()
but these problems persist. Any ideas on how to release the memory Keras uses?
I'm running this code on a laptop, and I'm pretty sure I don't have a GPU.