C5_W4_A1_Transformer_Subclass_v1- Exercise 8

Hello, I just finished my assignment for week 4 of course 5 on Transformer network. The unit tests for exercise 1~7 were all correct, but for exercise 8 I am getting “AssertionError: Wrong values in translation”. I don’t understand why this happened, especially since this exercise has only three lines of code and I only need to assign the appropriate arguments for Encoder and Decoder blocks and the final Dense layer. I hope I am not being too confusing.

Send me your notebook as private message.

I have the exact same issue! All the units test passed, shapes are correct. however, the values are slightly different. [line 288 of the test file]. Did you find a solution ? because I triple checked the whole code and it all seem well.
Please answer me soon [@jonaslalin or @thomaslim6793 ]. Good Luck!

Send me your notebook as private message

Where do you use the output_sentence?

For reference, this is the error you have encountered so that other students can use the search function and find the same issue:

AssertionError                            Traceback (most recent call last)
<ipython-input-24-a562b46d78e0> in <module>
      1 # UNIT TEST
----> 2 Transformer_test(Transformer, create_look_ahead_mask, create_padding_mask)

~/work/W4A1/public_tests.py in Transformer_test(target, create_look_ahead_mask, create_padding_mask)
    286     assert np.allclose(translation[0, 0, 0:8],
    287                        [0.017416516, 0.030932948, 0.024302809, 0.01997807,
--> 288                         0.014861834, 0.034384135, 0.054789476, 0.032087505]), "Wrong values in translation"
    290     keys = list(weights.keys())

AssertionError: Wrong values in translation

Oh Yeah! That fixed it! I was using the input_sentence instead of the output_sentence as for the first argument for the decoder in the 8th exercise. The decoder should have access, as said in the lesson video, to the words predicted so far in the sentence by the model, which I failed to notice in my debugging phase.
All unit tests passed now. Thank you for your help, @jonaslalin !