Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training After Switch to SGD is Flat #2

Open
noiran78 opened this issue Dec 25, 2019 · 4 comments
Open

Training After Switch to SGD is Flat #2

noiran78 opened this issue Dec 25, 2019 · 4 comments

Comments

@noiran78
Copy link

Hi,

Thanks for the implementation of SWATS in this repository. However, when I used it on VGG-16 running for 100 epochs with initial learning rate 0.001, after switching to SGD on epoch 15, the learning curve fell significantly and it stays flat. The updated learning rate is 0.34.

Is this an expected behavior or is there any problem here?

Looking to hear from you.

Best Regards

@Mrpatekful
Copy link
Owner

Sorry for the late response, I haven't received notification of this issue. SGD generally requires some kind of lr scheduling, which is not included in this implementation. I tried adding it, however I couldnt find a nice solution to handle the SGD and Adam phase differently, which is desirable for any kind of scheduling.

@jonathan016
Copy link

jonathan016 commented Jan 15, 2020

Oh I see. So in my case, what do you think should be done?

I'm facing similar issue (flat accuracy after switching)

@Mrpatekful
Copy link
Owner

You could try writing some kind of custom lr scheduling, since the optimizer stores the current phase in the param group with the key phase and apply different behavior based on that.

def custom_schedule(optimizer, compute_adam_lr, compute_sgd_lr):
    for param_group in optimizer.param_groups:
        if param_group['phase'] == 'SGD':
            param_group['lr'] = compute_sgd_lr()
        elif param_group['phase'] == 'ADAM':
            param_group['lr'] = compute_adam_lr()

@jonathan016
Copy link

I see. Thanks a lot, will try that and hopefully the problem does not occur again. Thank you @Mrpatekful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants