To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.
"@tensorflow/tfjs": "^1.6.0",
"@tensorflow/tfjs-converter": "^1.7.2",
"@tensorflow/tfjs-react-native": "^0.2.3",
"react-native": "~0.61.4",
Load sharded models or group sharded models to ship with react native bundle.
I'm seeing the following error when trying to load a converted saved model into my react native app using bundleResourceIO:
[Error: Based on the provided shape, [1,1,160,960], the tensor should have 153600 values but has 107172]
I noticed that bundleResourceIO requires a single weights file, and cannot load sharded weights. I believe this is the source of my problem, as the model isn't even finishing loading when the error is thrown. Is there away to convert a python saved model without sharding the weights?
Yes sharded weights are not supported in the bundlerResource loader. You can use the --weight_shard_size_bytes option in the converter to adjust the shard size, set it to a value larger than your model and you should get one shard.
@tafsiri that worked. Thank you for pointing me to that....I would've been searching all day otherwise!
Most helpful comment
Yes sharded weights are not supported in the bundlerResource loader. You can use the
--weight_shard_size_bytesoption in the converter to adjust the shard size, set it to a value larger than your model and you should get one shard.