大查询到TF记录

时间:2019-02-15 11:32:34

标签: python-2.7 tensorflow apache-beam tfrecord

我的目标是使用针对我的机器学习环境的tensorflow-data-validation在BQ中验证我的数据。因此,作为第一步,我试图根据我的BQ查询结果生成tfrecord文件。

我正在尝试使用Apache-Beam执行此操作。但是编码存在一些问题。

 **Apache-Beam Code**     
(pipeline | 'Read Input Data' >> beam.io.Read(beam.io.BigQuerySource(
    query=input_query,
    use_standard_sql=True,
    coder=coders.BytesCoder()
))
 | 'Generate TF Record' >> beam.io.WriteToTFRecord('path/to/output/',
   coder=coders.BytesCoder(),                                                   
   file_name_suffix='.tfrecord.gz'))

**Tensorflow-Data-Validation-Code:**
tfdv.generate_statistics_from_tfrecord(
    data_location='path/to/output/',
    pipeline_options=pipeline_options
)

引发的错误为 DecodeError:[运行'DecodeData'时]解析消息出错。可以帮我解决这个问题

0 个答案:

没有答案