Closed barkincavdaroglu closed 1 year ago
Since Lightning doesn't yet allow automatic optimization with multiple optimizers, I had to switch to manual optimization, which doesn't allow for gradient clipping.
torch.nn.utils.clip_grad_value_( model.parameters(), self.gradient_clip_val )
When we use the code above before stepping and after calling backward on the loss, there is a significant overhead that slows down the training.
Removed GAN and enabled automatic_optimization. So there is no need for manually clipping grads.
Since Lightning doesn't yet allow automatic optimization with multiple optimizers, I had to switch to manual optimization, which doesn't allow for gradient clipping.
When we use the code above before stepping and after calling backward on the loss, there is a significant overhead that slows down the training.