MMKV storage IO for tfjs-react-native based on react-native-mmkv.
Alternative for tfjs built-in asyncStorageIO, which is based on async-storage.
Differences with tfjs built-in asyncStorageIO:
- Use filesystem instead of SQLite on Android to avoid storage limits
- Supposedly faster
- v2.x: react-native-mmkv = 2.4.3 (dependency), react-native 0.70 and below
- v3.x: react-native-mmkv = ^2.10.1 (peer dependency), react-native 0.71 and above
$ yarn add tfjs-react-native-mmkv-storage
import { mmkvStorageIO } from 'tfjs-react-native-mmkv-storage';
// save model
const model = tf.sequential();
// setup model...
await model.save(mmkvStorageIO(`mymodel`));
// load model
const model = await tf.loadLayersModel(mmkvStorageIO(`mymodel`));
Too complicated to setup.