tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

Add logic to limit binaryCache size

Open eschirtz opened this issue 6 years ago • 4 comments

TensorFlow.js version

@tensorflow/tfjs ^1.7.0

Browser version

Electron ^6.0.0

Describe the problem or feature request

(This is a feature request based off the issue reported in #604)

We would like to be able to set a limit (or have it automatically maintained) for the internal cache. Running many operations on tensors of varying length (10,000 variable length audio files) causes a GPU memory leak not detectable via tf.memory. This is because a new texture is cached for each different length tensor. Our memory usage skyrockets and tanks the performance of our application.

We understand this can be fixed by trimming/padding the audio files to a fixed length, and this would have the added advantage of better caching, however it feels wrong to have this performance hit if a user does not want to, or cannot fix the length of their input tensors.

Having the ability to either dispose() or remove caching for certain operations would be very useful.

We also would like to keep our models in memory and cached so calling tf.backend.dispose would not work.

Code to reproduce the bug / link to feature request

Reproduction example at #604.

Please let me know if there is already a way to achieve this,

Thanks, keep up the good work!

eschirtz avatar Apr 10 '20 04:04 eschirtz

+1, same problem

dhasegan avatar May 12 '20 17:05 dhasegan

Hi, @eschirtz

Apologize for the delayed response and Just to confirm, May I know your issue got resolved or you're still looking to implement this feature from our end ?

Could you please refer this comment which may help you to resolve your issue ? Thank you!

gaikwadrahul8 avatar May 02 '23 08:05 gaikwadrahul8

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

google-ml-butler[bot] avatar May 09 '23 09:05 google-ml-butler[bot]

Closing as stale. Please @mention us if this needs more attention.

google-ml-butler[bot] avatar May 16 '23 10:05 google-ml-butler[bot]