tfrecord 文件的最佳大小

optimal size of a tfrecord file

根据您的经验,在各种设备(硬盘、固态硬盘、nvme)和存储位置(本地计算机、带网络的 hpc 集群)上运行最佳的 .tfrecord 文件的理想大小是多少坐骑)?

如果我在云中技术更强大的计算机上的性能比在我的本地 PC 上慢,tfrecord 数据集的大小是否是瓶颈的根本原因?

谢谢

Tensorflow 官网推荐~100MB (https://docs.w3cub.com/tensorflow~guide/performance/performance_guide/)

Reading large numbers of small files significantly impacts I/O performance. One approach to get maximum I/O throughput is to preprocess input data into larger (~100MB) TFRecord files. For smaller data sets (200MB-1GB), the best approach is often to load the entire data set into memory.

目前 (19-09-2020) Google 推荐以下经验法则:

“一般来说,您应该将数据分片到多个文件中,以便可以并行化 I/O(在单个主机内或跨多个主机)。经验法则至少是 10 倍许多文件,因为会有主机读取数据。同时,每个文件应该足够大(至少 10+MB,理想情况下 100MB+),以便您受益于 I/O 预取。例如,假设您有 X GB 的数据,你计划在最多 N 台主机上训练。理想情况下,你应该将数据分片到 ~10N 个文件,只要~X/(10N) 是 10+ MB(最好是 100+ MB)。如果小于此值,您可能需要创建更少的分片来权衡并行性优势和 I/O 预取优势。“

来源:https://www.tensorflow.org/tutorials/load_data/tfrecord