Unverified Commit 70fc197b authored by Vincent QB's avatar Vincent QB Committed by GitHub
Browse files

remove print-freq option and compute validation loss at each epoch. (#997)

parent 076052f1
...@@ -83,13 +83,6 @@ def parse_args(): ...@@ -83,13 +83,6 @@ def parse_args():
parser.add_argument( parser.add_argument(
"--start-epoch", default=0, type=int, metavar="N", help="manual epoch number" "--start-epoch", default=0, type=int, metavar="N", help="manual epoch number"
) )
parser.add_argument(
"--print-freq",
default=10,
type=int,
metavar="N",
help="print frequency in epochs",
)
parser.add_argument( parser.add_argument(
"--reduce-lr-valid", "--reduce-lr-valid",
action="store_true", action="store_true",
...@@ -615,8 +608,6 @@ def main(rank, args): ...@@ -615,8 +608,6 @@ def main(rank, args):
not args.reduce_lr_valid, not args.reduce_lr_valid,
) )
if not (epoch + 1) % args.print_freq or epoch == args.epochs - 1:
loss = evaluate( loss = evaluate(
model, model,
criterion, criterion,
...@@ -628,6 +619,9 @@ def main(rank, args): ...@@ -628,6 +619,9 @@ def main(rank, args):
not_main_rank, not_main_rank,
) )
if args.reduce_lr_valid and isinstance(scheduler, ReduceLROnPlateau):
scheduler.step(loss)
is_best = loss < best_loss is_best = loss < best_loss
best_loss = min(loss, best_loss) best_loss = min(loss, best_loss)
save_checkpoint( save_checkpoint(
...@@ -643,9 +637,6 @@ def main(rank, args): ...@@ -643,9 +637,6 @@ def main(rank, args):
not_main_rank, not_main_rank,
) )
if args.reduce_lr_valid and isinstance(scheduler, ReduceLROnPlateau):
scheduler.step(loss)
logging.info("End time: %s", datetime.now()) logging.info("End time: %s", datetime.now())
if args.distributed: if args.distributed:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment