Skip to content
Snippets Groups Projects
Commit 9f71f19b authored by Franck Dary's avatar Franck Dary
Browse files

Added script to parse train.log

parent c6826190
No related branches found
No related tags found
No related merge requests found
view.py 0 → 100755
#! /usr/bin/env python3
# EXAMPLE : ./view.py bin/*/*log
import sys
import subprocess
cmd = 'for f in %s; do echo $f; grep "SAVED" $f | tail -1; echo ""; done'%" ".join(sys.argv[1:-1])
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
models = []
model = []
for line in p.stdout :
line = line.decode("utf-8").strip()
if len(line) == 0 :
epoch = model[1].split(',')[0].split(' ')[-1]
name = model[0].split('/')[-2]
scores = model[1].split(':')[-1].replace(' SAVED', '')
score = sum([float(val.split('=')[-1]) for val in scores.split()])
models.append([score, "%s\t%s\t%s"%(epoch, scores, name)])
model = []
continue
model.append(line)
models = sorted(models)[::-1]
print("\n".join([m[1] for m in models]))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment