提交 61ab9068 编写于 作者: L lujun

fix bug at py3, test=develop

上级 6c7d9817
...@@ -248,7 +248,8 @@ def train(args): ...@@ -248,7 +248,8 @@ def train(args):
print("device count %d" % dev_count) print("device count %d" % dev_count)
print("theoretical memory usage: ") print("theoretical memory usage: ")
print(fluid.contrib.memory_usage( print(
fluid.contrib.memory_usage(
program=train_program, batch_size=args.batch_size)) program=train_program, batch_size=args.batch_size))
exe = fluid.Executor(place) exe = fluid.Executor(place)
...@@ -318,7 +319,8 @@ def train(args): ...@@ -318,7 +319,8 @@ def train(args):
if (args.save_path is not None) and (step % save_step == 0): if (args.save_path is not None) and (step % save_step == 0):
save_path = os.path.join(args.save_path, "step_" + str(step)) save_path = os.path.join(args.save_path, "step_" + str(step))
print("Save model at step %d ... " % step) print("Save model at step %d ... " % step)
print(time.strftime('%Y-%m-%d %H:%M:%S', print(
time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time()))) time.localtime(time.time())))
fluid.io.save_persistables(exe, save_path, train_program) fluid.io.save_persistables(exe, save_path, train_program)
...@@ -358,7 +360,8 @@ def train(args): ...@@ -358,7 +360,8 @@ def train(args):
save_path = os.path.join(args.save_path, save_path = os.path.join(args.save_path,
"step_" + str(step)) "step_" + str(step))
print("Save model at step %d ... " % step) print("Save model at step %d ... " % step)
print(time.strftime('%Y-%m-%d %H:%M:%S', print(
time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(time.time()))) time.localtime(time.time())))
fluid.io.save_persistables(exe, save_path, train_program) fluid.io.save_persistables(exe, save_path, train_program)
...@@ -389,9 +392,11 @@ def train(args): ...@@ -389,9 +392,11 @@ def train(args):
global_step, last_cost = train_with_pyreader(global_step) global_step, last_cost = train_with_pyreader(global_step)
else: else:
global_step, last_cost = train_with_feed(global_step) global_step, last_cost = train_with_feed(global_step)
train_time += time.time() - begin_time
pass_time_cost = time.time() - begin_time
train_time += pass_time_cost
print("Pass {0}, pass_time_cost {1}" print("Pass {0}, pass_time_cost {1}"
.format(epoch, "%2.2f sec" % (time.time() - begin_time))) .format(epoch, "%2.2f sec" % pass_time_cost))
# For internal continuous evaluation # For internal continuous evaluation
if "CE_MODE_X" in os.environ: if "CE_MODE_X" in os.environ:
print("kpis train_cost %f" % last_cost) print("kpis train_cost %f" % last_cost)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册