close

[Solved] AttributeError: module ‘keras.utils.generic_utils’ has no attribute ‘populate_dict_with_module_objects’

Hello Guys, How are you all? Hope You all Are Fine. Today when I import keras library I got AttributeError: module ‘keras.utils.generic_utils’ has no attribute ‘populate_dict_with_module_objects’ in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: module ‘keras.utils.generic_utils’ has no attribute ‘populate_dict_with_module_objects’ Error Occurs ?

I am trying to import the keras library but I got following error

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

Here is my code

from keras.models import Sequential
from keras.layers import Dense, LSTM

How To Solve AttributeError: module ‘keras.utils.generic_utils’ has no attribute ‘populate_dict_with_module_objects’ Error ?

  1. How To Solve AttributeError: module ‘keras.utils.generic_utils’ has no attribute ‘populate_dict_with_module_objects’ Error ?

    To Solve AttributeError: module ‘keras.utils.generic_utils’ has no attribute ‘populate_dict_with_module_objects’ Error Try this way with Tensorflow 2.4.1. from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, LSTM.

Solution 1

By Downgrading Tensorflow My issue was solved Successfully I am just using Tensorflow 2.1.0 You can install this version with this command.

pip install tensorflow==2.1.0

Solution 2

Just change this line

from keras import models

to 

from tensorflow.keras import models

Solution 3

Try this way with Tensorflow 2.4.1

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, LSTM

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment