Converting a sharded Tesorflow Model

258 views Asked by At

I want to use a tensorflow.js model in a react native app locally as asset. the problem is that the web optimized model uses sharded weights in multiple files. But the react native bundleResourceIO handler expects only one file. I have tried to convert the model with the tensorflowjs_converter. Unfortunately without success because I do not know exactly what the command expects for parameters. I have for example tried the following:

tensorflowjs_converter --weight_shard_size_bytes 60000000 --input_format tfjs_layers_model --output_format tfjs_layers_model model.json unsharded_model

anyone converted a model succesfully?

1

There are 1 answers

0
Heiko Plümer On

the answer is found here: https://stackoverflow.com/a/64213104/1886202

if you have multiple sharded weight files just concat them in your console

cat file1.bin file2.bin file3.bin > newfile.bin