tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

Alternative React Native storage based on mmkv

Open paradite opened this issue 3 years ago • 0 comments

Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template

System information

  • TensorFlow.js version (you are using): 3.19.0
  • Are you willing to contribute it (Yes/No): Yes. I have the code ready.

Describe the feature and the current behavior/state.

Currently, tf.js only supports asyncStorageIO, which is based on async-storage

It has a strict max size limit of 6MB on Android, which is hard to override with Expo managed workflow.

This makes it impossible to store multiple models of reasonable size on the device.

I have written an alternative IO adapter based on react-native-mmkv, which uses file system for storage instead of SQLite and has no size limit on Android. It also claims to have better performance than Async Storage.

The source code is largely based on existing asyncStorageIO and can be found here: https://github.com/ai-simulator/tfjs-react-native-mmkv-storage.

I hope to add this functionality into tf.js itself.

Will this change the current api? How?

No. It can be offered as new API alongside existing asyncStorageIO.

Who will benefit with this feature?

People who use tf.js on React Native and wants to store model size that is larger than 6MB.

Any Other info.

NA

paradite avatar Sep 02 '22 04:09 paradite