question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The tf.loadModel() does not works for tensorflow keras models

See original GitHub issue

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) I think this happens only with keras model .

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() in the python side

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
davidsoergelcommented, Oct 15, 2018

Just want to point out here that although tensorflow/tfjs-layers#332 now allows reading the new format produced by TF 1.11 (Sequential config is a dict containing a ‘layers’ array), we are still writing the old format (Sequential config is itself the layers array).

At some point we should consider whether Sequential.getConfig() should also write the new format (ideally as part of a clear version compatibility story).

0reactions
cbasavarajcommented, Nov 27, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

tf.keras.models.load_model | TensorFlow v2.11.0
A Keras model instance. If the original model was compiled, and saved with the optimizer, then the returned model will be compiled. Otherwise,...
Read more >
Can't load TF transformer model with keras. ...
It is the incompatibility of TensorFlow versions between the trained model and the TensorFlow version you are loading the model.
Read more >
Model saving & serialization APIs
Saves the model to Tensorflow SavedModel or a single HDF5 file. Please see tf.keras.models.save_model or the Serialization and Saving guide for details.
Read more >
Training a model in Python and loading in TensorFlow.js
You may still want to save your keras model too, just in case you want to ... The above only works if you're...
Read more >
TensorFlow.js - Loading the model into a neural network ...
In other libraries, like Keras, preprocessing functions for specific models are included in the API. Currently, though, TensorFlow.js does not have these ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found