W4 A2 - Submission Error - "Can't Compile Student Code"

Hi All (and, hopefully, Moderators!),

All of my code has had the tests pass but when I try to submit my assignment I get the following error:

Cell #5. Can’t compile the student’s code. Error: TypeError(‘cannot unpack non-iterable NoneType object’)

Any thoughts on how to get around this?

Thanks!

After some problem solving with @Mubsi (who, by the way, is awesome) we found a solution.

If you get this error, you need to totally reboot your session (help > reboot) and start with a fresh notebook. I downloaded my finished script as an html and copy & pasted all of my work.

I hope this helps if you run into this.

2 Likes

Thank you for the kind words.

Happy learning!

Hi,
Thank you for the solution.
May I ask how to start a fresh notebook? because even if I reboot, it shows the saved version of my work. I don’t know how to go to the initial state.

I’m quoting @Mubsi here because I think he was a bit more clear…

"
go to “File–>Open…”, SAVE YOUR WORK ON YOUR LOCAL MACHINE, or rename the file. Then delete all the ipynb files and .py files (not the file you have renamed), then get a fresh copy of the assignment using the “Help” section on top right. Once you get the new copy try filling the new assignment using your previous and try submitting then.
"

I hope this helps.

1 Like

That worked. Thank you so much!

1 Like

I have passes all test got output but i am not being graded
it shows
Cell #3. Can’t compile the student’s code. Error: SyntaxError(‘EOF while scanning triple-quoted string literal’, (’/tmp/student_solution_cells/cell_3.py’, 31, 1295, ‘’’’\ntf.random.set_seed(10)\nbox_confidence = tf.random.normal([19, 19, 5, 1], mean=1, stddev=4, seed = 1)\nboxes = tf.random.normal([19, 19, 5, 4], mean=1, stddev=4, seed = 1)\nbox_class_probs = tf.random.normal([19, 19, 5, 80], mean=1, stddev=4, seed = 1)\nscores, boxes, classes = yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold = 0.5)\nprint("scores[2] = " + str(scores[2].numpy()))\nprint("boxes[2] = " + str(boxes[2].numpy()))\nprint("classes[2] = " + str(classes[2].numpy()))\nprint("scores.shape = " + str(scores.shape))\nprint(“boxes.shape = " + str(boxes.shape))\nprint(“classes.shape = " + str(classes.shape))\n\nassert type(scores) == EagerTensor, “Use tensorflow functions”\nassert type(boxes) == EagerTensor, “Use tensorflow functions”\nassert type(classes) == EagerTensor, “Use tensorflow functions”\n\nassert scores.shape == (1789,), “Wrong shape in scores”\nassert boxes.shape == (1789, 4), “Wrong shape in boxes”\nassert classes.shape == (1789,), “Wrong shape in classes”\n\nassert np.isclose(scores[2].numpy(), 9.270486), “Values are wrong on scores”\nassert np.allclose(boxes[2].numpy(), [4.6399336, 3.2303846, 4.431282, -2.202031]), “Values are wrong on boxes”\nassert classes[2].numpy() == 8, “Values are wrong on classes”\n\nprint(”\033[92m All tests passed!”)\n# END UNIT TESt\n’))

@TMosh and @paulinpaloalto can u please help?i did restart the kernal and updated my notebook but still same thing

I am currently off duty, and you would do better starting a new thread and not requesting specific mentors.

This didn’t work for me removed all files. Tried to reboot. Close Assignment. Re Launch but now get: 404 : Not Found You are requesting a page that does not exist!

Use the “Help → Get latest version” tool.
Then refresh the page.

Did that and all the files got restored but still get “Cell #21. Can’t compile the student’s code.” when submitting Assignement.

The unit test I changed following advice in the forum to deal with my “don’t undestand” are gone and file reverted to “3months ago” version.

My changes to the C5_W4_A1_Transformer_Subclass_v1.ipynb still there

Tried reboot but same issue.

Please how can I submit without this issue?

Do not modify any of the unit tests. If you saw a forum post that said to do this, please post back a link to it.

“Get latest version” will give you a fresh copy of the notebook. Your original notebook was already gone when you started getting the 404 error. Unless you renamed it, then it would have saved a copy.

Undoubtedly, the error is due to something in your notebook that makes the grader angry.

Please post a screen capture image (not a text copy-and-paste) that shows the grader’s detailed feedback. Please include your entire screen (I want to see the URL and notebook file name).

Read about comment test here: Course 5: Week 4 Transformer DecoderLayers - #7 by marcus-waldman

This is the submission error

and public_tests.py is the file I modified today. Date (and content) indicates it reverted to original as I only open this lab today.

Thanks for the link, I’ll review that thread.

Do not in any case modify the public_tests.py file.

“Wrong values in attn_w_b2” means your code doesn’t work correctly.

Passing the tests in the notebook does not prove your code is perfect.

I’ll contact you with further instructions via a personal message.

Note: That thread is 2 and a half years old. The entire assignment has been updated since then. Many bugs have already been fixed.

That advice is no longer appropriate (and probably was never a good idea).

I’ll update that thread or delete it, so it doesn’t snag any further students.

What assignment are you working on? Because you’re using a thread that was for C4 W2, but your error message appears to be from C5 W4.

And the “self.mha2” reference seems to be from C5 W4 Transformer notebook, in the “DecoderLayer()”.

Update for those who find this thread later:

  • It’s important to use the correct mask for the second self-attention layer.
  • It’s important to identify the correct variable for the output of the 1st block.

Reminder:
Do not modify the .py utility files.