[Week 4] Assignment 1 >> Decoder class error

Same issue and still not fixed, hacked this around.

1 Like

I have the same problem , what can I do ? My abonnement will end 20/5 .
I have one mistake but i have 0/100

Hi, are there any updates on this yet? It affects the final assignment of a specialization and has been open for approaching a full billing cycle of that specialization… Thanks.

Hello, I just run though the same pb,
even though I used argument keywords:

self.mha2(query=out1, value=enc_output, key=enc_output, attention_mask=padding_mask, training=training, return_attention_scores=True)

it doesn’t work, it got errors in outd

Had to set query=enc_output, value=enc_output, key=out1 for those tests to work, which is wrong…

Is there an update on how to score full marks on this assignment without having to mess with the assertions? My subscription is close to running out and im in a bit of a time cruch and i have already spent long enough on this one assignment

Hi All,

Indeed. You are all right. We have fixed the tests and the graders. Soon you will get officially notified of the change. Thank you all for keeping reporting.

1 Like

Please, try the grading process again tomorrow Saturday. It should give you the full score now.

Hi,
Please refresh your workspace to get updated assignment. Both unit tests and grader are fixed in the new version by course staffs.
Thanks for your patience.

1 Like

i did it but it still gives me the same error

Hey guys , im still have this problem even after refreshing my workshop , anyone can help me please ?

This is my code

And this is the error

Also i tried to comment out this lines , and it worked and the test said all passed but im still getting 75/100 in the grader , Anyone can help me please ?

Hey @Mostafa.Ahmed,

Check parameters you pass to the encoder/decoder attention layer. You can find the documentation on MultiHeadAttention layer here. The layer expects query, value, and key – in that order.

Please, remove your code. That’s against the rules.

2 Likes

Hi, I’ve been struggling with this assignment all afternoon and still only have 75/100 from the autograder. All of the tests are passing except 7 & 8, where I’m getting the dreaded “Wrong values in outd” error. My DecoderLayers tests pass in 6 so I believe I have the correct Q, V, K order there, and I’ve made sure I have the latest version of the assignment. What else am I missing here?

I have the same problem. Excise 7 & 8 should be quite straight forward and I can’t see where problem can occur. I have struggled for two evenings, but still can’t get E7 and 8 passed.

the output values of outd[1,1] are similar but still not close enough:

I was facing the same problem 75/100 score and now I managed to get 100/100 so:

Exercice 6: set → self.mha2(out1,enc_output, enc_output …) in this order query, key, value (keras API order), and comment out
#assert np.allclose(attn_w_b2[0, 0, 1], [0.34485385, 0.3323007, 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.24360701]), “Wrong values in out”

Exercice 7: comment out
#assert np.allclose(outd[1, 1], [-0.26879537, -0.9024167, -0.51610225, 1.6873143]), “Wrong values in outd”

Exercice 8: comment out
#assert np.allclose(translation[0, 0, 0:8],
# [[0.02664799, 0.02222014, 0.01641812, 0.02407483,
# 0.04251551, 0.02240461, 0.01556584, 0.03741234]]), “Wrong values in outd”

I hope this will help you , best of luck

2 Likes

There order in which multihead attention block accepts inputs is (query, value, key) . I think that’s the key. The multihead attention documentation has further information.
We shouldn’t be beating ourselves up for this, would have loved it such information was provided. But I guess the implicit message is “read the documentation” which is a good practice.

thanks, Abdou.
I found a small error in Decoder class at scaling the embedding when copy/paste from encoder class. After correction the test of E7 passed, but not the final transformer test E8. I have to comment out two assert np.allclose(translation[0,0,0:8] and assert np.allclose(weights[keys[0]][0, 0, 1] to get autograder passed.
all in all, I am quite frustrated by this last assignment, which had inconsistencies causing lots of confusions

Can you elaborate what that small error in the scaling of the embedding layer is? I can get my E6 to pass perfectly, with no need to comment out any of the asserts, however I can not get E7 and E8 to pass still stuck at 75/100.

NVM, I figured it out! A small hint to others struggling on this issue, pay attention carefully to what number your using in your square root!

However Exercise 8 is definitely still broken as of 6/5, just comment out the asserts, they mean nothing…

scaling with self.embedding_dim, I guess you found it out by yourself

Can anyone provide the correct numerical values for out1 in the unit test for the Decoder? I am using keywords to call mha2 but the weights that come back still do not pass the assertions, so I am forced to suspect that what I am passing in does not have the correct value.

1 Like