NLP specialization C3W2 lab assignment

I have submitted my assignment 9 times
and i have been getting error related to masked_loss function
in the notebook, all testcases are being cleared however in the submission it gives error. I cannot comprehend the problem. Someone please help


and on submission tab I am getting this comment: There was an error grading your submission. Details:
{{function_node _wrapped__SparseSoftmaxCrossEntropyWithLogits_device/job:localhost/replica:0/task:0/device:CPU:0}} Received a label value of -1 which is outside the valid range of [0, 17). Label values: 9 10 15 15 9 9 9 9 9 9 9 9 9 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 [Op:SparseSoftmaxCrossEntropyWithLogits] name:

Hi @cysiddiqui ,

Passing unit test does not mean your code is correct. The grader uses different test parameters/values for a more thorough testing. As the error message reported that the valid range of the label is between 0 and 17, however, a label value of -1 is received. So you need to trace where the error might be. Have you used a global variable instead of using the input parameters passed in when calling the Keras loss function? One useful way to check is put a print statement to print out the values of parameters pass to the loss function before making the call.

1 Like

Hi @cysiddiqui

The error clearly indicates because you are using value of -1, your test is failing as the error mentions it is looking for valid range of [0, 17]

I am also suspecting there is an issue with your assignment copy as the expected output shown in your pic is incorrect for exercise 4 unit test. I am sharing my assignment screenshot for the same exercise

Kindly get a fresh copy of the assignment and re-do the assignment. I am sharing a link on how to get a fresh copy.

Regards
DP

1 Like

Share the error screenshot here @cysiddiqui without mentioning the codes

This is the new submission error I have been facing:

Failed test case: Invalid output value for test case 0.
Expected:
None,
but got:
5.337115287780762.

Failed test case: Invalid output value for test case 1.
Expected:
None,
but got:
3.809471845626831.

Failed test case: Invalid output value for test case 2.
Expected:
None,
but got:
3.543313980102539.

Failed test case: Invalid output value for test case 3.
Expected:
None,
but got:
3.6340713500976562.

Failed test case: Invalid output value for test case 4.
Expected:
None,
but got:
3.5949389934539795.

This is related to Exercise 5 or exercise 4?

this submission error is related to exercise 4

Hi @cysiddiqui

You still need to get a fresh copy as I still suspect the way you got fresh copy might have created some confusion.

You have mixed up codes of Exercise of 4 and exercise 5, as exercise 4 requires you to only write two lines codes, I am sharing a screenshot of the same for you to have better understanding.

Exercise 4 grade cell

The codes and pic shared by you DM still shows incorrect expected output, so you are still using an incorrect or obsolete copy of assignment.

So get a fresh copy, re-read the instructions mentioned in comment before, then re-do from starting. Also kindly don’t DM codes until mentor asks you for codes. Follow community guidelines, refer FAQ section.

Regards
DP

1 Like