I have build and trained the model in kaggle and have downloaded it's output. How can I now run the trained model locally in jupyter notebook to make prediction ?
Asked
Active
Viewed 936 times
0
-
Possible duplicate of [Make predictions using a tensorflow graph from a keras model](https://stackoverflow.com/questions/44274701/make-predictions-using-a-tensorflow-graph-from-a-keras-model) – David Parks May 06 '19 at 15:57
2 Answers
1
You can save your model in a file using:
model.save('model.hdf5')
Then you can run this in your kaggle kernel:
from IPython.display import FileLink
FileLink(r'model.h5')
It will then generate a link so you can download your hdf5 file.
In your local jupyter notebook run the following:
from keras.models import load_model
model = load_model('model.h5')

Bruno Mello
- 4,448
- 1
- 9
- 39
0
I guess you're trying to say How to load pretrained model weights in jupyter.
All you want to do is make a new model in jupyter as the same pretrained model layers and parameters from kaggle. Then use loadweights method. You're ready now to predict now cheers :D
for exmaple:
weights_path="donwloaded_weights.hdf5"
model = YourModel()
model.loadweights(weights_path)
model.predict(your_data)

Jamal Alkelani
- 606
- 7
- 19