C3_W1_Lab_2_TFX_Tuner_and_Trainer.ipynb - Can't run cell on SchemaGen

Hi,

I didn’t make any changes to the codes in C3_W1_Lab_2_TFX_Tuner_and_Trainer.ipynb, but I couldn’t run the cell on StatisticsGen. It kept giving me an error, and I would like to know if any others encountered this same issue, and if yes, how to solve it?

The error is as follow:

---------------------------------------------------------------------------
TypeCheckError                            Traceback (most recent call last)
<ipython-input-11-412d0fda3ef2> in <module>
      3     examples=example_gen.outputs['examples'])
      4 
----> 5 context.run(statistics_gen)

10 frames
/usr/local/lib/python3.7/dist-packages/apache_beam/transforms/ptransform.py in type_check_inputs_or_outputs(self, pvalueish, input_or_output)
    495                 hint=hint,
    496                 actual_type=pvalue_.element_type,
--> 497                 debug_str=type_hints.debug_str()))
    498 
    499   def _infer_output_coder(self, input_type=None, input_coder=None):

TypeCheckError: Output type hint violation at WriteStatsOutput[train]: expected <class 'apache_beam.pvalue.PDone'>, got <class 'str'>
Full type hint:
IOTypeHints[inputs=((<class 'tensorflow_metadata.proto.v0.statistics_pb2.DatasetFeatureStatisticsList'>,), {}), outputs=((<class 'apache_beam.pvalue.PDone'>,), {})]
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.7/dist-packages/tensorflow_data_validation/api/stats_api.py", line 113, in <module>
    class WriteStatisticsToBinaryFile(beam.PTransform):
File "/usr/local/lib/python3.7/dist-packages/apache_beam/typehints/decorators.py", line 776, in annotate_input_types
    *converted_positional_hints, **converted_keyword_hints)

based on:
  IOTypeHints[inputs=None, outputs=((<class 'apache_beam.pvalue.PDone'>,), {})]
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.7/dist-packages/tensorflow_data_validation/api/stats_api.py", line 113, in <module>
      class WriteStatisticsToBinaryFile(beam.PTransform):
  File "/usr/local/lib/python3.7/dist-packages/apache_beam/typehints/decorators.py", line 863, in annotate_output_types
      f._type_hints = th.with_output_types(return_type_hint)  # pylint: disable=protected-access

Hi Huang! We are reporting this to the TFX team. Will update you once the issue is resolved. Thank you!

Hello again! The TFX team has identified the issue and advised us to downgrade apache-beam to v2.39.0 . Will fix the notebooks in the classroom today and update this thread. If you’re in a hurry, you can install it with pip install apache-beam==2.39.0. Thank you!