Skip to content

Why accumulate_grad_batches cannot be used with manual optimization? #10998

Discussion options

You must be logged in to vote

Hey @NathanGodey,

manual optimization was built to provide full control optimization control to the user while abstracting distributed training and precision.

There is no way Lightning can automate properly accumulate grad batches for all the possible use cases and therefore isn't supported.

However, you can easily implement it by not calling zero_grad, step every n batches.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@NathanGodey
Comment options

@NathanGodey
Comment options

Comment options

You must be logged in to vote
1 reply
@NathanGodey
Comment options

Answer selected by NathanGodey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment