I am using tensorflow js to load a model from keras following This Guideline However on this line of code
const model = await tf.loadModel('https://foo.bar/tfjs_artifacts/model.json');
I am getting the error
Error: Sequential.fromConfig called without an array of configs
at new t (app.js:26972)
at t.fromConfig (app.js:26972)
at deserializeKerasObject (app.js:26972)
at deserialize (app.js:26972)
at app.js:26972
at app.js:26972
at Object.next (app.js:26972)
at o (app.js:26972)
What can I do to fix it . What can be the possible reasons for this error ? Thanks for the help .
Note:I have enabled cors in my server so I don't think its a problem related to my server . I am using a localhost(Not the one mentioned in guideline) Also as mentioned in the docs I have used
tfjs.keras.converters.save_keras_model()
I'd double check your
model.json
. I got this exact same error when I converted just my Keras model weights to Tensorflow.js json format (rather than my entire model). i.e. I was saving my Keras model withmodel.save_weights(filepath)
rather thanmodel.save()
.Your problem may not be the same as mine, but it's probably something to do with your actual model rather than anything to do with the loading of said model.