[英]Tensorflow taking too long to read a tfrecord file
我有tfrecord文件,該文件具有五列-context,context_len,話語,uuterance_len和label。 tfrecord文件的來源是Ubuntu Dialog Corpus。 問題是它花費的時間太長而無法讀取文件
filename_queue = tf.train.string_input_producer(['data/samples/train.tfrecords'], num_epochs = 1)
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
features = tf.parse_single_example(serialized_example,
features = {
"context" : tf.FixedLenFeature([], tf.int64),
"context_len" : tf.FixedLenFeature([], tf.int64),
"utterance" : tf.FixedLenFeature([], tf.int64),
"utterance_len" : tf.FixedLenFeature([], tf.int64),
"label" : tf.FixedLenFeature([], tf.int64)
})
contexts = features['context']
context_lens = features['context_len']
utterances = features['utterance']
utterance_lens = features['utterance_len']
labels = features['label']
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
sess.run(contexts)
當代碼讀取文件的時間太長時,我認為一定是由於文件大小所致。 因此,我將原始的csv文件細分為10條記錄,並將其轉換為tfrecords文件,但沒有區別。 我仍然面臨着同樣的問題。 因此,現在我確信它與我的代碼有關。 我的目標是解析一個示例,以后再用它來訓練RNN。
您需要在首次運行調用之前啟動隊列運行器
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.