titu1994 / MLSTM-FCN

Multivariate LSTM Fully Convolutional Networks for Time Series Classification
492 stars 180 forks source link

Serving in Production #14

Closed bneelon85 closed 5 years ago

bneelon85 commented 5 years ago

Hi!

I was able to get my data to run through Model 2 and had excellent luck. I am trying to get this ready to run in a mock production environment. I ran the model and in keras_utils turned save_weights_only = False to get the full model, but I am getting the error: ValueError: Unknown layer: AttentionLSTM When I run:

weightfile ='./MLSTM-FCN/weights/stage_10epoch_weights.h5'
my_file = Path(weightfile)
if my_file.is_file():
  print("Weight file exisits")
  model = load_model(weightfile)  #THIS IS THE LINE THROWING THE ERROR
else:
  print("Weight file do not exist")
  # train the model and save it
  history =model.fit(X_train, Y_train,batch_size=32, epochs=20, 
                   callbacks=[plot],
                   validation_data=(X_test, Y_test),
                   verbose=1)
  model.save(weightfile)

Have you deployed these models in a "production" environment, and if so, do you have any suggestions? Thanks!

bneelon85 commented 5 years ago

Nevermind. Just needed to add custom_objects={"AttentionLSTM" : AttentionLSTM} to the load_model method.