code: def infer_last_epoch_num(data_dir):
    
    names = os.listdir(data_dir)
    epochs_str = [re.findall(pattern=r".*\.(-?\d+)$", string=name)
                  for name in names]
    epochs_str = sum(epochs_str, [])
    return max([int(epoch_str) for epoch_str in epochs_str])
docs: Infer highest epoch number from file names in data_dir.