lightning-flash icon indicating copy to clipboard operation
lightning-flash copied to clipboard

Add `weight_decay_filter` and `lars_adaptation_filter` to LARS

Open turian opened this issue 3 years ago • 9 comments

🚀 Feature

Add weight_decay_filter and lars_adaptation_filter to LARS

Motivation

weight decay typically shouldn't be applied to BatchNorm. See fast.ai and this pytorch discuss thread.

The facebook vicreg code has parameters weight_decay_filter and lars_adaptation_filter which they set to True for any parameter that has ndim 1.

Pitch

There should be a simple way to disable weight decay and LARS adaptation on ndim==1 parameters.

Alternatives

Port Facebook LARS code and use it instead of lightning flash LARS code.

turian avatar Aug 29 '22 09:08 turian

Hi, @turian - Thank you for creating the issue. Just to let you know, I have this on my list to take a look at, and I'll try to get back by this weekend. A bit occupied, apologies for the delay.

krshrimali avatar Sep 01 '22 07:09 krshrimali

Hi, @turian - Thank you for giving the context, I went through the discussion on the PyTorch forum. I think it's fair to give an option to the user to disable this based on the condition (ndim == 1). Would you like to create a PR to add this? If not, I'll be able to take a look, hopefully soon. Thank you! ⚡

krshrimali avatar Sep 04 '22 17:09 krshrimali

@krshrimali I am not sure that I would able to create a PR that covers all corner cases. :(

turian avatar Sep 04 '22 19:09 turian

@krshrimali I am not sure that I would able to create a PR that covers all corner cases. :(

No worries at all! I will try to take a look, we are working towards a release tomorrow, so I will need some time but I have added this to my list. Thank you again!!

krshrimali avatar Sep 04 '22 19:09 krshrimali

@krshrimali Great! I am following this issue.

turian avatar Sep 12 '22 12:09 turian

@krshrimali Great! I am following this issue.

I'll try to pick this up over the coming weekend. 🤞🏻 Thanks for your patience, @turian 🚀

krshrimali avatar Sep 12 '22 12:09 krshrimali

@krshrimali Thanks! And I am happy to help with code review if you tag me in the PR

turian avatar Sep 12 '22 12:09 turian

@krshrimali Thanks! And I am happy to help with code review if you tag me in the PR

Thanks! I'll make sure to request your review :)

krshrimali avatar Sep 12 '22 12:09 krshrimali

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 18 '23 16:03 stale[bot]