From 4bb950c12b8852f3c190622e79e2ed824686e55c Mon Sep 17 00:00:00 2001 From: Shane Li Date: Fri, 12 Jan 2018 21:42:00 +0800 Subject: [PATCH] Correct batch size pattern used on lmdb dataset benchmarking and make the error log more clear --- scripts/run_benchmark.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/run_benchmark.py b/scripts/run_benchmark.py index 93d68ba4d..3da1f5434 100755 --- a/scripts/run_benchmark.py +++ b/scripts/run_benchmark.py @@ -97,7 +97,7 @@ def obtain_model_file(self, model): src_model_file = "/".join([self.model_path, model, prototxt_file]) if not os.path.isfile(src_model_file): logging.exception("template model file {} doesn't exist.".format(src_model_file)) - batch_size_pattern = re.compile(".*shape:.*") if self.dummy_data_use else re.compile(".*batch size:.*") + batch_size_pattern = re.compile(".*shape:.*") if self.dummy_data_use else re.compile("^\s+batch_size:.*") # we only care about train phase batch size for benchmarking batch_size_cnt = 2 if self.dummy_data_use else 1 if model not in self.bkm_batch_size or self.cpu_model not in self.bkm_batch_size[model]: @@ -200,7 +200,7 @@ def obtain_average_fwd_bwd_time(self): if re.match(average_fwd_bwd_time_pattern, line): average_time = line.split()[-2] if average_time == "": - logging.exception("Error: running intelcaffe failed, please check logs under: {}".format(result_file)) + logging.exception("Error: can't find average forward-backward time within logs, please check logs under: {}".format(result_file)) average_time = float(average_time) else: start_iteration = 100 @@ -228,7 +228,7 @@ def obtain_batch_size(self): with open(log_file, 'r') as f: batch_size_pattern_time = re.compile(".*SetMinibatchSize.*") batch_size_pattern_dummy = re.compile(".*dim:.*") - batch_size_pattern_real = re.compile(".*batch_size:.*") + batch_size_pattern_real = re.compile("^\s+batch_size:.*") batch_size = '' for line in f.readlines(): if re.match(batch_size_pattern_time, line) or re.match(batch_size_pattern_real, line) or re.match(batch_size_pattern_dummy, line):