C2W3_Assignment code compiling issue


I received error " There was a problem compiling the code from your notebook. Details: name ‘Transform’ is not defined" for all questions and got 0 points. However, I was able to excute all cells and get expected output in C2W3 assignment when I ran it locally.

Did anyone encounter the same problem and knows how to solve this?


Perhaps the “Transform” object is a global variable in the notebook, but the grader doesn’t provide it.

Using global variables is usually a mistake.

Is there a way to fix it on my side? :thinking:

Perhaps. Look at your code and see if you are using any global variables.

no. I didn’t use any global variables in the assignment :smiling_face_with_tear:

Hopefully a mentor for your course will be able to assist. I have not seen the materials for that course.

Most of the issues with assignment grading are common across all courses, though.

I have also not seen any of the course materials for MLOPS, so don’t know the details of that assignment. But have you tried searching the notebook for Transform? Is that defined anywhere? Is the definition in any way conditional? E.g. would it not get executed if some conditions are not met?

Debugging always starts from the error message, right? In this case, it seems pretty clear what to look for. :nerd_face:

Please click my name and message your notebook as an attachment.

Please note that you’ve not written the code for the cell containing:
%%writefile {_cover_transform_module_file}

As a result, cells that follow it will fail.
The symbol Transform isn’t directly imported. This is the location: tfx.v1.components.Transform
Given that we’ve imported from tfx import v1 as tfx, accessing Transform should be easy now.
Note that a compilation error will fail the grader and award you a 0. See if #grade-up-to-here helps.

ah I see. #grade-up-to-here helps to get the partial grade. Thank you for the help!!!