提交 9eed1788 编写于 作者: G guochaorong

fix bug and refine smoke models for supporting CE

上级 955f5ad4
# this file is copied from CE
# it can also shared to models from CE in some other ways, such as wget.
# it can only take effect in CE environment.
#!/bin/bash
cd $mnist_model_in_models
./.run_ce.sh
......@@ -35,11 +35,13 @@ def parse_log(log):
train_acc\t1.2
"
'''
for line in log.split():
#kpi_map = {}
for line in log.split('\n'):
fs = line.strip().split('\t')
if len(fs) == 2:
kpi_name = fs[0]
kpi_value = float(fs[1])
print (fs)
if len(fs) == 3 and fs[0] == 'kpis':
kpi_name = fs[1]
kpi_value = float(fs[2])
yield kpi_name, kpi_value
......@@ -49,7 +51,9 @@ def log_to_ce(log):
kpi_tracker[kpi.name] = kpi
for (kpi_name, kpi_value) in parse_log(log):
print (kpi_name, kpi_value)
kpi_tracker[kpi_name].add_record(kpi_value)
kpi_tracker[kpi_name].persist()
if __name__ == '__main__':
......
......@@ -181,15 +181,10 @@ def run_benchmark(model, args):
"pass=%d, train_avg_acc=%f,train_avg_loss=%f, test_avg_acc=%f, elapse=%f"
% (pass_id, train_avg_acc, train_avg_loss, test_avg_acc,
(pass_end - pass_start)))
with open("train_acc_factor.txt", 'a+') as f:
f.write("%s\n" % train_avg_acc)
with open("train_cost_factor.txt", 'a+') as f:
f.write('%s\n' % [train_avg_loss])
with open("test_acc_factor.txt", 'a+') as f:
f.write("%s\n" % test_avg_acc)
with open("train_duration_factor.txt", 'a+') as f:
f.write('%s\n' % [pass_end - pass_start])
print ("kpis train_acc %f" % train_avg_acc)
print ("kpis train_cost %f" % train_avg_loss)
print ("kpis test_acc %f" % test_avg_acc)
print ("kpis train_duration %f" % (pass_end - pass_start))
if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册