0

Complete Error:

Using TensorFlow backend.
Traceback (most recent call last):
  File "file.py", line 32, in <module>
    pickled_model = pickle.load(open('model.pkl', 'rb'))
ModuleNotFoundError: No module named 'keras.saving'

I am not able to solve this error. Thanks for the help:)

ChillGod
  • 43
  • 1
  • 7
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jun 19 '22 at 00:48
  • Please see this answer, which talks about the constraints around using pickle https://stackoverflow.com/questions/2121874/python-pickling-after-changing-a-modules-directory – Randy Zwitch Jun 24 '22 at 17:42

2 Answers2

0

I am getting the same error while compiling the following code

import tensorflow
import pickle
import streamlit as st
from streamlit_option_menu import option_menu
from tensorflow import keras

pickle_in = open("C:/Users/zahir/Desktop/Heart_Disease_prediction/Saved_model/classifier.pkl", 'rb')
tb_model = pickle.load(pickle_in)

I saved model using pickle library and trying to open.

0

I came up with this problem with Keras 2.3 and TensorFlow 2.5. After I upgrade to Keras 2.9 and TensorFlow 2.9, the problem was solved.

DanielT
  • 63
  • 7