如何调用ExampleValidator分析拆分数据集?

问题描述

使用:

Tensorflow version: 2.3.1
TFX version: 0.23.1
TFDV version: 0.24.0
TFMA version: 0.24.0

具有这样的交互式上下文:

from tfx.orchestration.experimental.interactive.interactive_context import \
    InteractiveContext
context = InteractiveContext(
    pipeline_root=os.path.join(os.getcwd(),"pipeline")
)

我使用以下方法创建了ExampleGen:

output = example_gen_pb2.Output(
             split_config=example_gen_pb2.SplitConfig(splits=[
                 example_gen_pb2.SplitConfig.Split(name='train',hash_buckets=7),example_gen_pb2.SplitConfig.Split(name='test',hash_buckets=2),example_gen_pb2.SplitConfig.Split(name='eval',hash_buckets=1)
             ]))

example_gen = CsvExampleGen(input_base=os.path.join(base_dir,data_dir),output_config=output)
context.run(example_gen)

在随后的代码中,我尝试使用ExampleValidator评估数据,但是ExampleValidator似乎无法解析拆分数据集的正确路径。

创建验证器的工作符合预期:

example_validator = ExampleValidator(
             statistics=statistics_gen.outputs['statistics'],schema=schema_gen.outputs['schema'])
context.run(example_validator)

没有警告或错误,但是试图显示结果,路径上的错误不正确:

context.show(example_validator.outputs['anomalies'])

NotFoundError:/home/jovyan/pipeline/ExampleValidator/anomalies/16/anomalies.pbtxt;没有这样的文件或目录

实际的目录结构如下:

.
└── anomalies
    └── 16
        ├── eval
        │   └── anomalies.pbtxt
        ├── test
        │   └── anomalies.pbtxt
        └── train
            └── anomalies.pbtxt

5 directories,3 files

但是代码似乎期望:

└── anomalies
    └── 16
        └── anomalies.pbtxt

如何调用ExampleValidator分析拆分数据集?

解决方法

感谢@Lorin S.,分享解决方案参考。为了社区的利益,我在此处提供github中1025KB给出的解决方案(答案部分)。

在TFX 0.23版本中添加了拆分,但Colab在0.23中未更新。 Colab已在0.24 here

中修复

问题已解决,方法是将tfx升级到0.24

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...