import re


def find_acc(fname):
  """ Find the Top1 and Top5 accuracy """
  with open(fname, 'r') as f:
    for l in f:
      m = re.search("==> Top1: ([\d|.]+)\W*Top5: ([\d|.]+)", l)
      if m:
        return float(m.group(1)), float(m.group(2))
    return None