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

Accumulate grads ( Larger batch size for low gpu memory) #560

Closed
joseluismoreira opened this issue Jun 9, 2021 · 1 comment
Closed

Accumulate grads ( Larger batch size for low gpu memory) #560

joseluismoreira opened this issue Jun 9, 2021 · 1 comment
Labels
feature request feature requests for making TTS better.

Comments

@joseluismoreira
Copy link

joseluismoreira commented Jun 9, 2021

Is your feature request related to a problem? Please describe.
When training with low hardware resources (GPU memory), may be useful to accumulate gradients, since the batch size cannot be increased, due to the low memory available. It doesnt help the model to be faster, but since we have convergence concerns with very small batch size, this can be very useful.

Describe the solution you'd like
It has to accumulate the grads for some batchs before to perform the wieghts update (opt.step ) . More references can be found here:

https://pytorch-lightning.readthedocs.io/en/stable/common/trainer.html#accumulate-grad-batches

https://kozodoi.me/python/deep%20learning/pytorch/tutorial/2021/02/19/gradient-accumulation.html

Describe alternatives you've considered

  • It is implementation is pretty straightfoward. Just, perform opt.step not after each step, but after each N steps to simulate a batch size N times larger.

  • Adapt the code for pytorch lightning can be a fruitful direction for so many engineering reasons, but it would be harder and it up to the core CoquiTTS developers to decide, but IMHO it would be great.
    Additional context

@joseluismoreira joseluismoreira added the feature request feature requests for making TTS better. label Jun 9, 2021
@joseluismoreira joseluismoreira changed the title [Feature request] Accumulate grads ( Larger batch, even for low gpu memory) Jun 9, 2021
@joseluismoreira joseluismoreira changed the title Accumulate grads ( Larger batch, even for low gpu memory) Accumulate grads ( Larger batch size for low gpu memory) Jun 9, 2021
@stale stale bot added the wontfix This will not be worked on but feel free to help. label Jul 9, 2021
@erogol erogol removed the wontfix This will not be worked on but feel free to help. label Jul 11, 2021
@coqui-ai coqui-ai deleted a comment from stale bot Jul 11, 2021
@stale stale bot added the wontfix This will not be worked on but feel free to help. label Aug 10, 2021
@coqui-ai coqui-ai deleted a comment from stale bot Aug 10, 2021
@stale stale bot removed the wontfix This will not be worked on but feel free to help. label Aug 10, 2021
@erogol erogol mentioned this issue Aug 10, 2021
58 tasks
@stale stale bot added the wontfix This will not be worked on but feel free to help. label Sep 9, 2021
@erogol erogol removed the wontfix This will not be worked on but feel free to help. label Sep 10, 2021
@coqui-ai coqui-ai deleted a comment from stale bot Sep 10, 2021
@stale stale bot added the wontfix This will not be worked on but feel free to help. label Oct 10, 2021
@coqui-ai coqui-ai deleted a comment from stale bot Oct 11, 2021
@stale stale bot removed the wontfix This will not be worked on but feel free to help. label Oct 11, 2021
@erogol
Copy link
Member

erogol commented Oct 11, 2021

This is implemented in the new Trainer API which will be integrated into 🐸TTS soon.

@erogol erogol closed this as completed Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature requests for making TTS better.
Projects
None yet
Development

No branches or pull requests

2 participants