【发布时间】:2017-08-14 17:00:34
【问题描述】:
我想在我的输入函数中执行基本的预处理和标记化。我的数据包含在我无法修改的谷歌云存储桶位置 (gs://) 的 csv 中。此外,我将对我的 ml-engine 包中的输入文本进行任何修改,以便可以在服务时复制行为。
我的输入函数遵循以下基本结构:
filename_queue = tf.train.string_input_producer(filenames)
reader = tf.TextLineReader()
_, rows = reader.read_up_to(filename_queue, num_records=batch_size)
text, label = tf.decode_csv(rows, record_defaults = [[""],[""]])
# add logic to filter special characters
# add logic to make all words lowercase
words = tf.string_split(text) # splits based on white space
是否有任何选项可以避免提前对整个数据集执行此预处理?这个post 建议 tf.py_func() 可以用来进行这些转换,但是他们建议“缺点是因为它没有保存在图中,我无法恢复我保存的模型”所以我不相信这在服务时很有用。如果我定义自己的 tf.py_func() 来进行预处理,并且它是在我上传到云的培训师包中定义的,我会遇到任何问题吗?有没有我没有考虑的其他选择?
【问题讨论】:
标签: python tensorflow google-cloud-platform google-cloud-ml google-cloud-ml-engine