ml5-library
ml5-library copied to clipboard
Possible memory leak in charRNN?
Dear ml5 community, I think there maybe a memory leak with charRNN in ml5js. I was making an example that uses stateful prediction with a custom-trained model. I followed the tutorial below provided by paperspace to train the model. https://blog.paperspace.com/training-an-lstm-and-using-the-model-in-ml5-js/ I'm quite new to ml5js, and the problem may exclusively be in my code, but memory leak is happening when text is being generated for some time.
ā Step 1: Describe the issue š
I think I found a possible memory leak while using charRNN.
ā Step 2: Screenshots or Relevant Documentation š¼
I looked at the code that I think the charRNN library is using, and I don't think it is releasing tensors after use. Maybe there is no need to? I'm not sure. Below is the link to the code. https://github.com/ml5js/ml5-library/blob/development/src/CharRNN/index.js
ā Step 3: Share an example of the issue š¦
The example below is a demonstration of this issue. The example is using stateful prediction. The model is trained with korean text, and therefore needs korean text as input. It takes some time for the browser to crash. example link: https://hlp-pls.github.io/generate-text-file/ code repository link: https://github.com/hlp-pls/generate-text-file
ā Describe your setup š¦
Here's some helpful information about my setup...
- Web browser & version: Chrome 83.0.4103.116
- Operating System: macOS 10.14.6
- ml5 version you're using: v0.5.0
This is the error message that the console shows!
Great catch! You are right ā there are definitely some tensors which are not getting disposed. Iām adding this one to my todo list.