ai-simulator / tfjs-react-native-mmkv-storage

MMKV storage IO for tfjs-react-native based on react-native-mmkv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tfjs-react-native-mmkv-storage

NPM version npm

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:

Versions

  • 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

Install:

$ yarn add tfjs-react-native-mmkv-storage

Usage

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`));

Testing

Too complicated to setup.

About

MMKV storage IO for tfjs-react-native based on react-native-mmkv

License:Apache License 2.0


Languages

Language:TypeScript 95.9%Language:JavaScript 4.1%