C2W2 Lab Error - 'Transform' is not defined

Not able to run C2W2 lab. Getting the following error:

There was a problem compiling the code from your notebook. Details:
name ‘Transform’ is not defined

Has anyone encountered the same?

Hi @Ree_Chatterjee

Welcome to the community.

What course are you referring to?

Notice that you posted on the general category. The only way you got a proper support is posting on the right category. That is how the mentors be aware of the issues.

Don’t forget to check our Guidelines.

I hope you understand.

Best regards

Machine Learning Data Lifecycle in Production

Thank you.

I’ll move your post to the right category so you can receive a proper support.

Best regards

1 Like

Appreciated

1 Like

Regards the issue, looks like some code wasn’t running correctly.

The error message suggests that you are try to run/execute a code that doesn’t exists.

In simple terms, you have to import/run/execute/instantiate a transform package/function/class before use it

It was defined and executed.

transform = Transform(
examples=example_gen.outputs[‘examples’],
schema=schema_gen.outputs[‘schema’],
module_file=os.path.abspath(_traffic_transform_module_file))

context.run(transform, enable_cache=False)

Hi Ree. It’s likely that the Transform method isn’t imported. You will only see something similar to import tfx at the top. If so, you may want to use the prefix with the string tfx.v1... so it will know how to find the Transform method. Please refer to the ungraded labs that only imports tfx and not the Transform, CsvExampleGen, etc for reference. Hope this helps.

1 Like