AutoGraded Error: C5W4 Transformer Architecture

I passed all the test in the Notebook, but when I submit my work the autograder signals a problem:
Cell #20. Can’t compile the student’s code. Error: AssertionError(‘Wrong values in attn_w_b2. Check the call to self.mha2’)

I have the same problem :frowning:

hey guy, I fixed this problem, all you need is:
attn2, attn_weights_block2 = self.mha2(enc_output, enc_output, out1, padding_mask, return_attention_scores=True)
outcomment the 2 asserts in Q6 test:

#assert np.allclose(attn_w_b2[0, 0, 1], [0.34485385, 0.33230072, 0.32284543]),  "Wrong values in attn_w_b2. Check the call to self.mha2"
#assert np.allclose(out[0, 0], [0.64775777, -1.5134472,   1.1092964,  -0.24360693]), "Wrong values in out"

You’ll earn 100/100 points

1 Like

Good ! I do the same thing !

Hi everyone,

Just sharing my experience with this error. Following this suggested solution I had to comment also other lines from the following unit tests in order pass them all. After submitting this solution I got 62 points so I did not pass the grader.
I went back to my original notebook, the one passing all tests without commenting any line and I tried this other solution instead. After submitting I got 87 points so I passed.



In case you are having the same issue, make sure the input to self.mha2 is in the correct order (it is different from the tf code). There is no need to comment out the unit test lines.