Transfer_learning_with_MobileNet_v1 alpaca_model ()

I’m stuck in exercise 2 making alpaca_model function

this is my code

{moderator edit: code removed}

and after running the test code :-
"
from test_utils import summary, comparator

alpaca_summary = [[‘InputLayer’, [(None, 160, 160, 3)], 0],
[‘Sequential’, (None, 160, 160, 3), 0],
[‘TensorFlowOpLayer’, [(None, 160, 160, 3)], 0],
[‘TensorFlowOpLayer’, [(None, 160, 160, 3)], 0],
[‘Functional’, (None, 5, 5, 1280), 2257984],
[‘GlobalAveragePooling2D’, (None, 1280), 0],
[‘Dropout’, (None, 1280), 0, 0.2],
[‘Dense’, (None, 1), 1281, ‘linear’]] #linear is the default activation

comparator(summary(model2), alpaca_summary)

for layer in summary(model2):
print(layer)
"
this error happens :-
"

AssertionError Traceback (most recent call last)
in
10 [‘Dense’, (None, 1), 1281, ‘linear’]] #linear is the default activation
11
—> 12 comparator(summary(model2), alpaca_summary)
13
14 for layer in summary(model2):

~/work/W2A2/test_utils.py in comparator(learner, instructor)
14 def comparator(learner, instructor):
15 if len(learner) != len(instructor):
—> 16 raise AssertionError(f"The number of layers in the model is incorrect. Expected: {len(instructor)} Found: {len(learner)}")
17 for a, b in zip(learner, instructor):
18 if tuple(a) != tuple(b):

AssertionError: The number of layers in the model is incorrect. Expected: 8 Found: 7
"

First, please do not post your code on the forum. That’s not allowed by the Code of Conduct.
I have edited your thread to remove the code.

Second, most of your code is incorrect, because it appears you made a lot of changes that were not asked for, made some changes in areas you should not have touched, and you did not follow most of the instructions.

I recommend you delete that notebook, get a fresh copy, and start over.

1 Like

Apologizes for typing full code , I got a fresh copy and solved it

That’s good news!