C5W1 Assignment 3 Attribute error during Unit Test of music_inference_model()


I’m getting this error when running the UNIT TEST cell for the music_inference_model()

AttributeError                            Traceback (most recent call last)
<ipython-input-34-c395f100af16> in <module>
      1 # UNIT TEST
----> 2 inference_summary = summary(inference_model)
      3 comparator(inference_summary, music_inference_model_out)

~/work/W1A3/test_utils.py in summary(model)
     29 # extracts the description of a given model
     30 def summary(model):
---> 31     model.compile(optimizer='adam',
     32                   loss='categorical_crossentropy',
     33                   metrics=['accuracy'])

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

After reading related blog posts, I have tried restarting the kernel and running the cells in the right order.

Can anyone help me with this?

Thanks in advance!

Hi @Aagneyan_Namboodiri

Please check the following line is at the top of your file:

from test_utils import *

Make sure that line of code has not been corrupted, then refresh the kernel and clear all output, rerun the code from start.

1 Like

I followed your steps, but it was still giving me the same error.

I rechecked the code and found out that I had not specified a value for the axis in the argmax function call in the music_inference_model() function.

That fixed the error!

Great to hear that you have got it sorted. Thanks.

1 Like