Melp c2 , week 2 , assignment not working , excercise 6

i did same error

START CODE HERE

tfx.v1.components.ImportSchemaGen(
schema_file)

Use ImportSchemaGen to put the curated schema to ML M

schema_gen = ImportSchemaGen(new_schema)

Run the component

context.run(schema_gen, enable_cache=False)

END CODE HERE

context.show(schema_gen.outputs[‘schema’])

grader-required-cell

START CODE HERE

tfx.v1.components.ImportSchemaGen(
schema_file)

Use ImportSchemaGen to put the curated schema to ML M

schema_gen = ImportSchemaGen(new_schema)


Run the component

context.run(schema_gen, enable_cache=False)

END CODE HERE


context.show(schema_gen.outputs[‘schema’])

AttributeError Traceback (most recent call last)
in
2
3 ### START CODE HERE ###
----> 4 tfx.v1.components.ImportSchemaGen(
5 schema_file)
6

AttributeError: module ‘tfx.v1’ has no attribute ‘v1’

Hi @Yomna_Mohamed,
If you re-read the assignment, you should notice in 1. Import there is:

from tfx import v1 as tfx

So you don’t need to import v1 anymore, i.e it should be:

user_schema_importer = tfx.components.ImportSchemaGen(schema_file=schema_file)

And you don’t need schema_gen = ImportSchemaGen(new_schema) either

The purpose of the assignment is for you to understand how to use different tfx modules and not blindly copy codes from other sources.

Please create a new topic if you have errors with a new assignment.