From 57a988df3090eabfbde45a4d31996a229576bb05 Mon Sep 17 00:00:00 2001 From: han Date: Fri, 6 May 2022 13:14:43 +0900 Subject: [PATCH] fix: multistep lr decay epoch bugs - add milestones arguments - change decay_epochs to milestones variable --- timm/scheduler/scheduler_factory.py | 2 +- train.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/timm/scheduler/scheduler_factory.py b/timm/scheduler/scheduler_factory.py index 72a979c2..2f5a49fa 100644 --- a/timm/scheduler/scheduler_factory.py +++ b/timm/scheduler/scheduler_factory.py @@ -71,7 +71,7 @@ def create_scheduler(args, optimizer): elif args.sched == 'multistep': lr_scheduler = MultiStepLRScheduler( optimizer, - decay_t=args.decay_epochs, + decay_t=args.milestones, decay_rate=args.decay_rate, warmup_lr_init=args.warmup_lr, warmup_t=args.warmup_epochs, diff --git a/train.py b/train.py index cc2b2b4d..ec8778d9 100755 --- a/train.py +++ b/train.py @@ -171,6 +171,8 @@ parser.add_argument('--epoch-repeats', type=float, default=0., metavar='N', help='epoch repeat multiplier (number of times to repeat dataset epoch per train epoch).') parser.add_argument('--start-epoch', default=None, type=int, metavar='N', help='manual epoch number (useful on restarts)') +parser.add_argument('--milestones', default=[30, 60], type=int, nargs='+', metavar="MILESTONES", + help='list of epoch indices for multistep lr. must be increasing') parser.add_argument('--decay-epochs', type=float, default=100, metavar='N', help='epoch interval to decay LR') parser.add_argument('--warmup-epochs', type=int, default=3, metavar='N',