c++ - CTF Reader 对 CNTK 中的大文件抛出错误

标签 c++ nlp deep-learning cntk

我正在按照 Github 上的 CNTK 教程使用 CTF 阅读器功能。

def create_reader(path, is_training, input_dim, label_dim):
    return MinibatchSource(CTFDeserializer(path, StreamDefs(
        features = StreamDef(field='x', shape=input_dim, is_sparse=True),
        labels = StreamDef(field='y', shape=label_dim, is_sparse=False)
    )), randomize=is_training, epoch_size= INFINITELY_REPEAT if is_training else FULL_DATA_SWEEP)

除非输入文件大小大于特定大小(未知),否则这完全可以正常工作。然后它会抛出这样的错误:

WARNING: Sparse index value (269) at offset 8923303 in the input file (C:\local\CNTK-2-0-beta6-0-Windows-64bit-CPU-Only\cntk\Examples\common\data_pos_train_balanced_ctf.txt) exceeds the maximum expected value (268).
attempt: Reached the maximum number of allowed errors while reading the input file (C:\local\CNTK-2-0-beta6-0-Windows-64bit-CPU-Only\cntk\Examples\common\data_pos_train_balanced_ctf.txt)., retrying 2-th time out of 5...
.
.
.

RuntimeError: Reached the maximum number of allowed errors while reading the input file (C:\local\CNTK-2-0-beta6-0-Windows-64bit-CPU-Only\cntk\Examples\common\data_pos_train_balanced_ctf.txt).

我发现文件 TextParser.cpp 中抛出了这种错误 https://github.com/Microsoft/CNTK/blob/5633e79febe1dc5147149af9190ad1944742328a/Source/Readers/CNTKTextFormatReader/TextParser.cpp

这个问题的解决方案或解决方法是什么?

最佳答案

您需要知道输入的维度,还需要知道索引从 0 开始。因此,如果您创建了一个将词汇表映射到 1 到 20000 范围的输入文件,则维度为 20001。

关于c++ - CTF Reader 对 CNTK 中的大文件抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41339649/

相关文章:

machine-learning - SkipGram 中上下文词的表示矩阵是什么意思?

php - 如何根据 'similar' 和 'title' 列在 MySQL 表中查找 'description' 记录?

machine-learning - sklearn中的层次分类

image-processing - 是否有相当于 word2vec 的图像?

c++ - for循环c++中的“冒号”和 'auto'?需要一些帮助来理解语法

c++ - boost 程序选项: Read required parameter from config file

python - 如何加载带有自定义损失的模型?

python - 结合 Keras 功能模型

c++ - 枚举作为 C++ 中函数的返回类型

c++ - pthread_cond_wait() 之前的检查标志