patlevin / tfjs-to-tf

A TensorFlow.js Graph Model Converter
MIT License
136 stars 19 forks source link

tenslrflow.GraphDef has no field named "keras_version" #5

Closed PuddingPengChen closed 4 years ago

PuddingPengChen commented 4 years ago

hi,patlevin! Thank you for sharing your project,it was very useful. but when I test the model here https://github.com/google/tfjs-mnist-workshop/tree/master/model It export error: Message type"tensorflow.GraphDef" has no field named "keras_version". I test many models, such as: ml5js-model here: https://github.com/ml5js/ml5-data-and-models all models has the same problem.

patlevin commented 4 years ago

The problem is that these models aren't graph models. The converter only supports TFJS graph models (hence the name 😉). The models you tried to convert are layer models. You don't need this converter to load layer models - tfjs can load them out-of-the-box like so:

import tensorflowjs as tfjs

model = tfjs.converters.load_keras_model('path-to-model.json')
PuddingPengChen commented 4 years ago

Thank you very much! Your advice if of great help to me :smile: :+1:

patlevin commented 4 years ago

Glad I could help😃