San*_*ani 5 python tensorflow tensorflow-estimator
我有一个来自 github 的基于 tensorflow 的代码,它非常慢。它甚至不打印(即使在为 tf.logging 启用调试模式之后)打印以下内容后发生的事情
信息:tensorflow:完成运行local_init_op。 --> 此行代码执行后需要 20 分钟 INFO:tensorflow:prediction_loop 标记为完成
有人可以告诉在哪里查看和优化吗?
已经检查了以下事项:
估算器代码:
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)
Run Code Online (Sandbox Code Playgroud)
预测代码:
results = estimator.predict(
predict_input_fn, yield_single_examples=True, checkpoint_path='/content/ckpt/model.ckpt-10949')
Run Code Online (Sandbox Code Playgroud)
执行这段代码所用的时间:
results = list(results)
Run Code Online (Sandbox Code Playgroud)