我从github获取了一个基于tensorflow的代码,它非常慢。它甚至不打印(即使在为启用调试模式之后tf.测井)打印以下内容后发生了什么
-->此行代码执行后需要20分钟
信息:tensorflow:prediction_循环标记为已完成
已经检查了以下内容:
-
model_-fn:在local-init\u-op之前执行
-
本地文件:从本地文件系统保存和加载检查点文件。所以文件传输延迟不应该是原因
-
热启动:已尝试。对预测时间没有影响
估计器代码:
estimator = tf.contrib.tpu.TPUEstimator(
use_tpu=FLAGS.use_tpu,
model_fn=model_fn,
config=run_config,
warm_start_from = tf.estimator.WarmStartSettings(
ckpt_to_initialize_from='/content/ckpt',
),
train_batch_size=FLAGS.train_batch_size,
predict_batch_size=FLAGS.predict_batch_size)
results = estimator.predict(
predict_input_fn, yield_single_examples=True, checkpoint_path='/content/ckpt/model.ckpt-10949')
results = list(results)