Data Science Asked by Nithin Reddy on January 3, 2021
I saved my keras model into .h5 format. Again I’ve loaded that .h5 file into my colab and tried to predict with that model.
model.save("/content/drive/My Drive/Datasets/sentiment_analysis.h5")
from keras.models import load_model
loaded_model = load_model("/content/drive/MyDrive/Datasets/sentiment_analysis.h5")
loaded_model.predict("i love machine learning and google")
It’s giving error list index out of range.
IndexError: list index out of range
Try these:
tf.keras.models.load_model("./saved_models/our_model.h5", compile=False)
(make sure you have model and weights both in the file)Answered by Akash on January 3, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP