I am stuck on the final assignment of the specialization. Exercises 1-6 are passing, but Exercise 7 is failing as follows:
# UNIT TEST
Decoder_test(Decoder, create_look_ahead_mask, create_padding_mask)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-63-dd4b65c051b4> in <module>
1 # UNIT TEST
----> 2 Decoder_test(Decoder, create_look_ahead_mask, create_padding_mask)
~/work/W4A1/public_tests.py in Decoder_test(target, create_look_ahead_mask, create_padding_mask)
221 assert tf.is_tensor(outd), "Wrong type for outd. It must be a dict"
222 assert np.allclose(tf.shape(outd), tf.shape(encoderq_output)), f"Wrong shape. We expected { tf.shape(encoderq_output)}"
--> 223 assert np.allclose(outd[1, 1], [-0.2715261, -0.5606001, -0.861783, 1.69390933]), "Wrong values in outd"
224
225 keys = list(att_weights.keys())
AssertionError: Wrong values in outd
Any suggestions? I have read a lot of forum posts and have double-checked Exercises 1-6 also (I found some little issues and corrected them). I don’t see how to debug this…
I added the below lines of code, at the relevant places:
print(f'x after word embeddings:{x}')
print(f'x after scale embeddings:{x}')
print(f'x after positional encodings:{x}')
print(f'x after dropout:{x}')
print(f'final x:{x}')
You may try this and see where your values are not matching with mines. That is the place to look out. But make sure you add these statements in the correct places. Do not add inside the loop.
I inserted the print statements and the 1st errors occurred in “x after dropout”. I had a look at my code for the dropout layer and compared it with the version from an earlier function. I made a tiny change to the starter code and I just got “All tests passed”. I replaced “+=” with “=”.
The starter code looks like this:
# apply a dropout layer to x
# use `training=training`
x += None
So maybe " +=" is incorrect?
Gary
PS: Just got this message: "Congratulations on completing Deep Learning from DeepLearning.AI. " Thanks again!