Autograder cannot compile student's code

Can’t compile the student’s code. unexpected indent (, line 8)


I’m stuck with the autograder on wk2 of this course, even though the code runs fine.

The autograder fails to grade my work properly. It says that it cannot compile my code because of an unexpected indent.

But on line 8 this is where I implement the on_epoch_end method:

class myCallback(tf.keras.callbacks.Callback):
    def on_epoch_end(self, epoch, logs={}):
        if(logs.get('acc') >= 0.99):
            print("Reached 99% accuracy so cancelling training!")
            self.model.stop_training = True

Again the code runs fine. I’ve tried the autograder 8 times already. I’m not sure what to do.

Any help is greatly appreciated. Many thanks!

Hi @bingfeng93,
can you send me your code somewhere, so I can take a look at it?

Exercise2-Question_Bingfeng.ipynb (6.6 KB)

Hi Maurizio,

Of course, please see the attached for the notebook.

Many thanks for the help :slight_smile:



Try cancelling the 2nd cell where you replicated the code:

mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data(path=path)

If you notice carefully, the first line is slightly indented. Anyway you don’t need these 2 lines, because you have them later.

This should help.


1 Like