Scaled Dot Product Attention: Test Passed, but Grader Failed?

Grader Output showed: cell_UNQ_C3 function scaled_dot_product_attention failed test 2(with mask)

But when I run the cell (and test) for this particular function, I get:
I’ve tried restarting kernel and clearing output before submitting; same issue still persists.

This exercise is being updated, because the unit tests to not catch all of the most common possible errors in the scaled_dot_product_attention() function.

Check that you implemented the correct code for when the mask is not “None”.

when the mask is not none, the instruction said to

The boolean mask parameter can be passed in as none or as either padding or look-ahead. Multiply it by -1e9 before applying the softmax.

This is how I interpreted the instruction: the multiplication by -1e9 is supposed to be applied to the mask, not to the entire quantity (before softmax is applied)

 if mask is not None:
        scaled_attention_logits += (mask*(-1e9))

Did I misunderstood the hint?

See this part of the instructions. You need to use (1-mask) there:

2 Likes

So I tried this:

if mask is not None:
        scaled_attention_logits += ((1-mask)*(-1.0e9))

and received this error:

Similarly, I actually have this as my instruction (after looking up the instruction in your picture. I accessed the programming assignment on June 30th, so I thought I was supposed to have the latest version.

If you have different instructions, it means you’re using an old copy of the notebook. That copy won’t pass the grader.

I recommend you open up the new notebook (use the File menu), and copy your code over to the new notebook.

If you don’t have a newer notebook in your File menu, then you should re-name your current notebook (so it doesn’t get overwritten), and use the Help menu to see if there is a new version available.

I see, thankyou! I just re-updated the notebook. Strange that it gave me the old version even though I have never opened this assignment prior to June 30th and that the last update to the assignment was on June 21st.

I got the correct version now and will copy all my code over. Thanks again for the help!

I’m getting same error messages. I’ve updated notebook several times but still I’m facing same issue. Kindly help.


Hi Team, I started a new notebook and got the above error, when following the discord community it is said that the above instructions are old, but I just started a new one (latest version notebook) and got these, what do I do now? any help possible

Hello Kailash,

Sorry for this late response, were you able to resolve this error?

If not then try checking the instructions provided in the notebook. It’s asking you to:

Multiply (1. - mask) by -1e9 before applying the softmax.

Hi team, I am facing similar issues. In my case all the test cases are passing in jupiter notebook but still nbgrader is not passing the assignment. Please check the same it has been several weeks I am trying over this assignment.
image

Hello.
How did you solve this problem?