Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keras.js Error: [Model] Model configuration does not contain any layers. #134

Open
hmhwe opened this issue Jan 5, 2019 · 1 comment
Open

Comments

@hmhwe
Copy link

hmhwe commented Jan 5, 2019

I tried to run keras model on a browser using keras.js , but I got the following error while loading it

Error: [Model] Model configuration does not contain any layer
The kera model is

from keras.models import Sequential
from keras.layers import Dense, LSTM, InputLayer, Bidirectional, TimeDistributed, Embedding, Activation
from keras.optimizers import Adam
model = Sequential()
model.add(InputLayer(input_shape=(MAX_LENGTH, )))
model.add(Embedding(len(word2index), 128))
model.add(Bidirectional(LSTM(256, return_sequences=True)))
model.add(TimeDistributed(Dense(len(tag2index))))
model.add(Activation('softmax'))
 
model.compile(loss='categorical_crossentropy',
              optimizer=Adam(0.001),
              metrics=['accuracy', ignore_class_accuracy(0)])
 
model.summary()

Then I have converted with encoder.py as

python encoder.py model.hdf5
And load it with keras.js as

cconst model= new KerasJS.Model({
        filepath: {
          model: 'model.json',
          weights: 'model_weights.buf',
          metadata: 'model_metadata.json'
        },

          gpu: false
        })

I have tried with keras version 2.2.4 , 2.1.4, 2.2.2, 2.1.5 and 2.1.4 .

Any help would be appreciated.

@avyabansal
Copy link

2.0.6 version removed this error for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants