[scripts] Minor fix to nnet3 training scripts RE log parsing/time-reporting (#1926) master
authorGaofeng Cheng <770579626@qq.com>
Tue, 10 Oct 2017 03:24:49 +0000 (11:24 +0800)
committerDaniel Povey <dpovey@gmail.com>
Tue, 10 Oct 2017 03:24:49 +0000 (23:24 -0400)
egs/wsj/s5/steps/libs/nnet3/report/log_parse.py

index d21578baecb3f89c65e8b20cccd3980039c0ba57..1341ae2e936c75fedaf9b4fd792a46ee4a108de2 100755 (executable)
@@ -309,10 +309,11 @@ def parse_progress_logs_for_param_diff(exp_dir, pattern):
             'max_iter': max_iter}
 
 
             'max_iter': max_iter}
 
 
-def parse_train_logs(exp_dir):
-    train_log_files = "%s/log/train.*.log" % (exp_dir)
+def get_train_times(exp_dir):
+    train_log_files = "%s/log/" % (exp_dir)
+    train_log_names = "train.*.log"
     train_log_lines = common_lib.get_command_stdout(
     train_log_lines = common_lib.get_command_stdout(
-        'grep -e Accounting {0}'.format(train_log_files))
+        'find {0} -name "{1}" | xargs grep -H -e Accounting'.format(train_log_files,train_log_names))
     parse_regex = re.compile(".*train\.([0-9]+)\.([0-9]+)\.log:# "
                              "Accounting: time=([0-9]+) thread.*")
 
     parse_regex = re.compile(".*train\.([0-9]+)\.([0-9]+)\.log:# "
                              "Accounting: time=([0-9]+) thread.*")
 
@@ -394,7 +395,7 @@ def parse_prob_logs(exp_dir, key='accuracy', output="output"):
 
 def generate_acc_logprob_report(exp_dir, key="accuracy", output="output"):
     try:
 
 def generate_acc_logprob_report(exp_dir, key="accuracy", output="output"):
     try:
-        times = parse_train_logs(exp_dir)
+        times = get_train_times(exp_dir)
     except:
         tb = traceback.format_exc()
         logger.warning("Error getting info from logs, exception was: " + tb)
     except:
         tb = traceback.format_exc()
         logger.warning("Error getting info from logs, exception was: " + tb)