glue-factory icon indicating copy to clipboard operation
glue-factory copied to clipboard

Possibly faster training

Open ducha-aiki opened this issue 2 years ago • 4 comments
trafficstars

This curves are with SuperPoint-Open I have been experimenting with faster training and it seems that OneCycle policy with max_lr=3e-4 provides the same results (based on training and val metrics) than standard, but 2x faster. Maybe that could help others, who would be training on other types of features. image image

    lr_schedule:
        max_lr: 3e-4
        epochs: 20
        steps_per_epoch: 782
        type: OneCycleLR

ducha-aiki avatar Nov 04 '23 14:11 ducha-aiki

Hi @ducha-aiki,

This is a valuable finding in my opinion! Thanks for it 😊

iago-suarez avatar Nov 04 '23 14:11 iago-suarez

One can go even faster, but here the final pertaining quality is 1pp lower, so don't recommend image

ducha-aiki avatar Nov 06 '23 08:11 ducha-aiki

@ducha-aiki Did you update train.py, and in particular get_lr_scheduler, in order for these parameters to be successfully consumed by gluefactory?

mattiasmar avatar Dec 27 '23 23:12 mattiasmar

Yes, I did:

def get_lr_scheduler(optimizer, conf):
    """Get lr scheduler specified by conf.train.lr_schedule."""
    if conf.type == 'OneCycleLR':
        max_lr = conf.max_lr
        epochs = conf.epochs
        steps_per_epoch = conf.steps_per_epoch
        max_lr = conf.max_lr
        del conf.max_lr
        del conf.epochs
        del conf.steps_per_epoch
        return getattr(torch.optim.lr_scheduler, conf.type)(optimizer, max_lr, epochs=epochs, steps_per_epoch=steps_per_epoch, **conf.options)
    if conf.type not in ["factor", "exp", None]:
        return getattr(torch.optim.lr_scheduler, conf.type)(optimizer, **conf.options)

ducha-aiki avatar Dec 28 '23 10:12 ducha-aiki