【问题标题】:Tensorflow Transform debug and iterative development best practices?Tensorflow Transform 调试和迭代开发的最佳实践?
【发布时间】:2021-05-25 17:15:30
【问题描述】:

我现在已经在多个项目中使用 TFX,并且发现调试 tf.transform 极具挑战性。我最初的几个管道是在 Airflow 中组成的,这需要我提交代码、推送到 Airflow、运行 Dag 以获得对代码的反馈。这非常糟糕,因为它在迭代开发循环中至少延迟了 2 分钟。在示例中提供的笔记本中使用 tfx 有很大帮助,因为它将时间缩短到大约一分钟。

如果代码有效,您可以使用这样的代码挖掘生成的 protobuf 以获取输出

%%skip_for_export
import tensorflow as tf

train_transform_uri = os.path.join(transform.outputs['transformed_examples'].get()[0].uri, 'train')

# Get the list of files in this directory (all compressed TFRecord files)
tfrecord_filenames = [os.path.join(train_transform_uri, name)
                      for name in os.listdir(train_transform_uri)]

# Create a `TFRecordDataset` to read these files
dataset = tf.data.TFRecordDataset(tfrecord_filenames, compression_type="GZIP")

# Iterate over the first few tfrecords and decode them.
for tfrecord in dataset.take(5):
    serialized_example = tfrecord.numpy()
    example = tf.train.Example()
    example.ParseFromString(serialized_example)
    pprint.pprint(example)

人们还有其他方法可以用来解决这种痛苦吗?我做错事了吗?我确实看到了使用 Transform 来避免训练/服务偏差的好处,但我觉得 Transform 的痛苦实际上可能更糟......

【问题讨论】:

    标签: tensorflow tfx tensorflow-transform


    【解决方案1】:

    我在寻找完全相同问题的解决方案时遇到了这个问题。我开始研究已经两周了,但我仍然没有发现比打印解码示例更好的方法。所以“有没有其他方法”问题的答案是:很可能没有。

    【讨论】:

    • 这并不能真正回答问题。如果您有其他问题,可以点击 提问。要在此问题有新答案时收到通知,您可以follow this question。一旦你有足够的reputation,你也可以add a bounty 来引起更多的关注。
    猜你喜欢
    • 2011-03-07
    • 1970-01-01
    • 1970-01-01
    • 2010-09-06
    • 1970-01-01
    • 2012-02-19
    • 1970-01-01
    • 2012-11-09
    • 2010-10-01
    相关资源
    最近更新 更多