AttributeError: module 'tensorflow.python.keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'

Solution 1:

change from keras import models to from tensorflow.keras import models
this solved the problem for me with tensorflow 2.5.0

Solution 2:

I had the same problem, and I have successfully solved this issue with downgrading tensorflow version to 2.1.0.

pip install tensorflow==2.1.0

Solution 3:

Changed from keras.utils import _____

to from tensorflow.python.keras.utils import _____

This worked for me while using TensorFlow 2.5.0

Solution 4:

I encountered the same problem using Python 3.9 and Tensorflow 2.5. The problem for me was that those two are not yet compatible, and as such, the solution is to install python 3.8 instead, and possibly also downgrade Tensorflow 2.5 to Tensorflow 2.4.