Assigment 1: log_perplexity: There was an error grading your submission. Details: operands could not be broadcast together with shapes (2,7) (2,)

Hello. I need help with Assignment 1, Exercise 5: log_perplexity. I’m able to pass all the tests for that function correctly. However, when I submit my assignment, I get 0 points for log_perplexity and I see the following message below the grade of log_perplexity: "There was an error grading your submission. Details:
operands could not be broadcast together with shapes (2,7) (2,) ". Please see screenshot.

Can someone please help me with this? I think the error is coming in the code line after “# Apply non-padding mask to log probabilities to exclude padding”. Thanks!

Hi @Erika_Petersen

Kindly refer the below comment by @arvyzukai to check if you have passed the correct axis value of -1.

Let me know if it still confuses you, you can send a screenshot of the log_perplexity codes via personal DM.

Regards
DP

Hi @Deepti_Prasad , thanks for your answer! I was about to send you a screenshot of my code when I realized something weird. Though yesterday I saw I was getting 0 points for log_perplexity, giving me a grade of 80%, when I now see my assignment, it says I got a grade of 100%. I’ll send you my code in private message nonetheless.

I’m not a mentor for this course, but this kind of change can be due to the state of your notebook being different than you think. For example if you make a change to your code, run the local test and it now works. But then you hit “Submit” without first clicking “Save” and it’s possible the grader is still seeing the previous version of your code without your most recent change. In some of the courses hitting “Submit” seems to do an autosave, but not in all of them. You could try some scientific experiments to confirm or deny this theory in this course.

@Erika, you submitted without any changes and cleared the assignment? or you did make changes after referring the linked comment?

Hi @paulinpaloalto! Thank you. As far as I remember, I did click on Save before clicking on Submit. However, I’ll take this into account in the future. Many thanks!

Hi @Deepti_Prasad, I didn’t make changes after referring the linked comment!

Hi! I have the same issue. I did pay attention to the axis setting but still couldn’t figure out the mistake in my code. Any advices? Thanks!

Did you try the Restart the kernel and then re-run all the cell one by one? @goldfish

Although your issue can be different from the post creator, so kindly share error screenshot to have a relative response to your issue.

Regards
DP

Hi @Erika_Petersen

I checked your codes for log_perplexity which is completely correct, what I could guess here for your submission to fail before could be related to a recent bug issue reported for this assignment which I guess when you reopened must have got updated. Otherwise, it could also be related kernel being disconnect and probably one of the cell didn’t run down before you submitted the first time as you reopening and submit cleared your assignment submission.

regards
DP

Thank you very much for checking my code, @Deepti_Prasad! I really appreciate it. Thanks also for the possible explanations regarding why I was not passing the grader.

Best,

Erika

1 Like

Just to be more sure, I am tagging L.T of this course so if any bug issue still exist can be looked upon for this issue or to know what really could be issue for the error to resolve on its own.

@lucas.coutinho can you check with this post, learner had a value error of mismatch input shape which resolved on reopening and submitting. does the metadata still need to be checked upon?

Regards
DP

Thank you, @Deepti_Prasad!

Thanks @Deepti_Prasad for tagging me!

This is actually weird. We indeed recently changed some parts of this function and updated the autograder accordingly. I’m not sure what may have happened as you didn’t change anything and later it worked. My guess is that for some reason the autograder version in your environment wasn’t updated, but I have never seen this happening.

Let’s monitor for now as the issue is resolved. @goldfish, please share with us your grading output.

Cheers,
Lucas

Don’t post codes here. DM Lucas your codes.

OK, I deleted the message that included my code.

let me know if your issue still persists, you can share with me also codes as L.T sometimes are busy because of their numerous responsibility. You also haven’t confirmed if resubmitting solved your issue or not. Also you didn’t share any screenshot of the error here in the post. @goldfish

Hi, Deepti! I revised my code as suggested by LT and then submitted my solution. Then I got 10/10 for this question. Thank you for your help!

1 Like