I am using the Keras library to create a neural network in python. I downloaded the training data (txt file), initiated the network and “customized” the scales of the neural network. Then I wrote code to generate the output text. Here is the code:
filename = "weights-improvement-19-2.0810.hdf5"
model.load_weights(filename)
model.compile(loss='categorical_crossentropy', optimizer='adam')
My problem: during execution, the following error appears:
model.load_weights(filename)
NameError: name 'model' is not defined
I added the following, but the error still persists:
from keras.models import Sequential
from keras.models import load_model
Any help would be appreciated.
source
share