DLS Course 4 week 2 assignment 2 exercise 2 - alpaca model

Hello everyone!

I am having the following error:


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: 9

I have been trying for days but do not know what is wrong

In the layers you add for alpaca_model, you have one too-many layers. So there is something wrong with your code.

You’re given the code for the “base model” layer, so that should be OK as long as you added the correct value for “weights”.

Next you should have an Input layer, a data augmentation layer, a preprocessing layer, then the base_model, a pooling layer, a dropout layer, and a dense layer.

You could use model.summary() as a quick and dirty debugging tool. Here’s a link to the doc