C1W2 Cannot pass the grader even I have passed all the tests

Hi,
I have done the notebook according to the guidelines and have passed all the tests in the notebook. However, the grade of my notebook when I submit is 0 (having saved the notebook already) with the information of “There was a problem compiling the code from your notebook, please check that you saved before submitting. Details:
name ‘untrained_model’ is not defined”
Please help review, thank you.

To help me assist you,

Please click on my name to start a private message. Then, attach your notebook as a .ipynb file. Please note that mentors cannot access your Coursera Jupyter workspace, so sending the notebook in a .ipynb format is essential.

Please don’t use global variables in the assignment unless you absolutely have to. In the function train_mnist, invoke the function to create a new compiled model instead of relying on untrained_model

Thank you, I change my code and it works successfully. However, I am grateful if you can explain further why the global variable shouldn’t be used. I’m a non-tech person trying to learn new thing about technology so pardon if the question may seem obvious.

Hi,

I am having the same problem. All tests pass but the grader keeps failing.

It seems the grader even can’t run the first code cell with the imports, as I am seeing the following error-message.

There was a problem compiling the code from your notebook, please check that you saved before submitting. Details:
name 'tf' is not defined

check if you recalling any keras layer incompletely with just tf

@jishika5

To help me assist you,

Please click on my name to start a private message. Then, attach your notebook as a .ipynb file. Please note that mentors cannot access your Coursera Jupyter workspace, so sending the notebook in a .ipynb format is essential.

hi @jishika5

please refer the below link comment on how to get a fresh copy

Please confirm once your issue is resolved.

Make sure when you work on your new copy, don’t edited anything outside of the markers ###START AND END CODE HERE###

your codes are correct. chances are when you worked on your copy in breaks the changes you made might corrupted the file based on the submission image you shared with me.