After I've created my model using keras sequential, I tried to start predicting on a small sample to see if it would work however I get this error and I have no idea why.

error : AttributeError Traceback (most recent call last) in () ----> 1 example_results = model.predict(example_batch) AttributeError: 'NoneType' object has no attribute 'predict'

The code for my model can be found here :


I've done it using this method before but it refuses to work this time around.


In cell 10 of your notebook you write:

model = build_model() #Perfect

In cell 11 you write:

model = model.summary() #Uh oh!!

later you call

example_result = model.predict(example_batch) #model.summary() returns None

and python tells you

AttributeError: 'NoneType' object has no attribute 'predict'

This is because you reassigned model in cell 11 to, well, nothing. You should remove the model = in cell 11 and your code will run perfectly!

redo cell 11 to read:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.