I trained a DNN using Keras. However, I am unable to save and load the model.
from keras.models import load_model
model.save('/home/ubuntu/pynb/savedmodel.tfl')
#model.load('/home/ubuntu/pynb/savedmodel.tfl')
But I find that instead of savedmodel.tfl file, I find 3 files with .meta, .index and .data.00000-of-00001 extensions. So, when I try to load using model.load, it says that the file is not found.
I also tried other alternatives suggested on SO
model_json = model.to_json()
But I get an error AttributeError: 'DNN' object has no attribute 'to_json'
I'm using Keras version 2.0.4.
Please suggest how to save correctly and how to load from 3 files situation ?
Edit: (I'm adding code related to building the model)
net = tflearn.input_data([None, size_of_each_vector])
net = tflearn.embedding(net, input_dim=vocab_size, output_dim=128)
net = tflearn.lstm(net, 128, dropout=0.6) # Set the dropout to 0.6
net = tflearn.fully_connected(net, no_of_unique_y_labels, activation='softmax') # relu or softmax
net = tflearn.regression(net,
optimizer='adam',
learning_rate=1e-4,
loss='categorical_crossentropy')
model = tflearn.DNN(net, tensorboard_verbose=0)
model.fit(X_train_padded_seqs, y_train,
validation_set=(X_test_padded_seqs, y_test),
n_epoch=n_epoch,
show_metric=True,
batch_size=100)