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

How to use it in pytorch-lightning? #12

Open
Devoe-97 opened this issue May 23, 2022 · 5 comments
Open

How to use it in pytorch-lightning? #12

Devoe-97 opened this issue May 23, 2022 · 5 comments

Comments

@Devoe-97
Copy link

Hi, I would like to know how to use pytorch-ema for training in pytorh-lightning?

@Linux-cpp-lisp
Copy link
Collaborator

Hi @Devoe-97,

I think you'd want to implement a Lightning Callback that runs the appropriate ema.update(), ema.store(); ema.copy_to(), and ema.restore() operations at the right points in the training loop. Which callback methods that is I don't know, I'm not super familiar with Lightning. You might be able to take some inspiration from their StochasticWeightAveraging callback, which is somewhat similar of an idea to the EMA implemented in this package. (That callback may also work for you depending on what you are trying to achieve.)

If you have any luck with this, please share your work if you are willing!

@Devoe-97
Copy link
Author

Hi @Devoe-97,

I think you'd want to implement a Lightning Callback that runs the appropriate ema.update(), ema.store(); ema.copy_to(), and ema.restore() operations at the right points in the training loop. Which callback methods that is I don't know, I'm not super familiar with Lightning. You might be able to take some inspiration from their StochasticWeightAveraging callback, which is somewhat similar of an idea to the EMA implemented in this package. (That callback may also work for you depending on what you are trying to achieve.)

If you have any luck with this, please share your work if you are willing!

Thanks!

@Devoe-97
Copy link
Author

Hi @Devoe-97,

I think you'd want to implement a Lightning Callback that runs the appropriate ema.update(), ema.store(); ema.copy_to(), and ema.restore() operations at the right points in the training loop. Which callback methods that is I don't know, I'm not super familiar with Lightning. You might be able to take some inspiration from their StochasticWeightAveraging callback, which is somewhat similar of an idea to the EMA implemented in this package. (That callback may also work for you depending on what you are trying to achieve.)

If you have any luck with this, please share your work if you are willing!

Hi, could you provide a demo in ddp mode? I encountered an OOM error while broadcasting in the validation step.

@amorehead
Copy link
Contributor

I second this original question. I think having this functionality working within PyTorch Lightning could greatly increase the visibility of this awesome repository!

@malbergo
Copy link

A demo would be great!

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

4 participants