I m not able to complete week 2 assignment 2 of deep learning speacialization

[CODE REMOVED FROM MODERATOR]

No description of error provided.

Hello,

You are not allowed to post code solution publicly in the forum.

From your screenshots though, it seems you are loading weights into a model wich does not have the proper size, it tell your your weights are for a 105 layers model and your model has only 104 weights.

I think what you are doing is loading the weights in the model after removing the top layer!

hi @dweepcode12

Based on the error image shared by you in the alpaca model, you have mentioned the weight as the description of weight, where the code need to be recalled by the assigned name for that weight.

like if you notice there must be base model path= Description of the imagenet weight.

you have added the description instead of the assigned recalled for weight path.

Regards
DP

Can you tell me how to proceed with it I am getting the same error time and again and not able to complete the assignment .

You probably have not recalled base weight where the only a part of weight from the base model is used and not from all the 104 layers, and this base weight path need to be assigned to the weights in the alpaca model codes.

Here’s the way that code was given to you in the clean notebook:

### START CODE HERE

base_model_path="imagenet_base_model/without_top_mobilenet_v2_weights_tf_dim_ordering_tf_kernels_1.0_160_no_top.h5"
    
base_model = tf.keras.applications.MobileNetV2(input_shape=None,
                                                   include_top=None, # <== Important!!!!
                                                   weights=base_model_path)

All you need to do is fill in the two “None” values with the correct values, but why did you modify the way that the pathname logic works? It may well be that your code is equivalent, but a) there was no need to do that and b) the evidence suggests that what you wrote is actually not equivalent.

I think the next logical step would be to get a clean notebook and start over again. You may be able to copy some of your work from the current version, but please use care in making those choices. Here’s a thread about how to get a clean copy.

Please try that and let us know if that helps or not.

1 Like