C1M1 Assignment [Programming Assignment: Deeper Regression, Smarter Features] Error

Dear Community,

For the C1M1 assignment of The PyTorch Fundamentals course, I am getting an error in Exercise 4. The exact text of the error is as follows:

Failed test case: train_model raised an exception. Expected: The model to train., but got: Training ran into an error: “name ‘optimizer’ is not defined”.

However, when running the script prior to testing, the model works fine and passes all tests. Not sure about the error. The screenshot is given below for greater clarity.

Any input is appreciated. Thank you.

Regards

Swanand

Hi @swanand83,

From the screenshot you shared, on the right side, you can see all of the exercises. If you click the “down arrow” next to the Exercise 4, it will reveal the error it gives for the failure.

If that error is:

The model to train., but got: Training ran into an error: “name ‘optimizer’ is not defined”

Then it means that you have defined the “optimizer” variable in a way that is part of the assignment environment (which is why your assignment test passes), but not of the grader environment (there is some global variable involvement which shouldn’t be).

Please follow the exercise instruction for exercise 4 to make sure your implementation is how it should be.

Best,
Mubsi

1 Like