def _infer_metadata_from_saved_model_v2(
    saved_model_dir: str) -> dataset_metadata.DatasetMetadata:
  """Infers a DatasetMetadata for outputs of a TF2 SavedModel."""

  metadata_path = os.path.join(saved_model_dir, impl_helper.METADATA_DIR_NAME)
  return metadata_io.read_metadata(metadata_path)
Infers a DatasetMetadata for outputs of a TF2 SavedModel.
tensorflow_transform/beam/impl.py