No module named tf
Please I need helpMy appHereis giving an error of no module named tf which I quite weird since I already installed tensorflow
2022-10-10T07:52:37Z
ValueError: Unknown layer: FunctionalFile "/home/user/app/app.py", line 31, in <module>
    model = load_model('cat_and_dog_classifier.h5')File "/home/user/.local/lib/python3.8/site-packages/tensorflow/python/keras/saving/save.py", line 184, in load_model
    return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)the reason for this error is cause of use of different versions of Keras & TensorFlow… like in for training the model the version might have ‘2.3.0’ for Tensorflow & ‘2.4.3’ for Keras and now while accessing the saved model(.h5) are using another version of Keras & TensorFlow.So for the solution it is best to re-trained model from scratch with upgraded versions or downgrades your TF&Keras to the same version as on which model is trained.
2022-10-10T07:56:34Z
You may even use following code if you are using older TF and trying to unpack h5 file packed by newer TFyour_model = tf.keras.models.load_model(
    path_to_h5,
    custom_objects={'Functional':tf.keras.models.Model})Follow below discussion for more details (hope it would be helpful):stackoverflow.comValueError: Unknown layer: Functionalpython, tensorflow, kerasasked byLobstaBoyon07:14AM - 24 Jul 20 UTC