Unable to load model using asyncStorageIO API in react-native
See original GitHub issueTo get help from the community, we encourage using Stack Overflow and the tensorflow.js
tag.
TensorFlow.js version
0.3.0
Browser version
React Native: v0.61.5
Describe the problem or feature request
I am getting the following error while loading a model using AsyncStorageIO API.
Row too big to fit into CursorWindow requiredPos=0, totalRows=1
* http://192.168.1.7:19001/index.bundle?platform=android&dev=true&minify=false&hot=false:203062:24 in convertError
* [native code]:null in map
- node_modules/@react-native-community/async-storage/src/AsyncStorage.native.js:97:32 in RCTAsyncStorage.multiGet$argument_1
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:483:4 in __invokeCallback
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:28 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:17 in __guard$argument_0
* [native code]:null in invokeCallbackAndReturnFlushedQueue
In my project, I have a model with json and weights which I have loaded using bundleResourceIO API. Then, I am updating the model using the given code and saving it with asyncStorageIO API. This flow goes well and good. But, I try to load the model using asyncStorageIO API, I get the previously described error.
const optimizer = tf.train.adam();
model.compile({
optimizer: optimizer,
loss: "categoricalCrossentropy",
metrics: ["accuracy"],
});
model
.trainOnBatch(
tf
.tensor2d(imageTensors, [numOfElems, 784])
.reshape([numOfElems, 28, 28, 1]),
tf.tensor2d(labelTensors, [numOfElems, 10]).reshape([numOfElems, 10])
)
.then((d) => {
console.log("Model updated");
model
.save(asyncStorageIO("mnist-model"))
.then((res) => console.log("Model Saved", res))
.catch((e) => console.log(e));
});
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
asyncstorage not working in build mode in react native
in debug mode asyncstorage working perfectly fine but when build apk with this command. gradlew assembleRelease -x bundleReleaseJsAndAssets ...
Read more >AsyncStorage - React Native
The AsyncStorage JavaScript code is a facade that provides a clear JavaScript API, real Error objects, and non-multi functions.
Read more >How To Use React Native AsyncStorage - JScrambler Blog
AsyncStorage is a simple, asynchronous, unencrypted by default module that allows you to persist data offline in React Native apps.
Read more >A guide to React Native's AsyncStorage - LogRocket Blog
AsyncStorage is an unencrypted and asynchronous data storage system in React Native that allows users to persist data offline.
Read more >Storing and Getting Data from Async Storage in React Native
In this video, we look at storing and getting data from async storage in react native for our todo app. Part 2. GET...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, thanks for your responses 😊. Currently due to time constraint, I created a different model with less layers that can work with the project, so reducing the size to 172 KB. But, when I will get time, I will try to incorporate the above suggested solutions and will respond back.
Exact same for me, my model is 12MB