You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use manual_backward ,this bug appear 。
I know the new version may fix this, but for some reasons I can only use version 1.2.4, what should I do?
I wish I could do this, but due to some version conflict issues, I can only use version 1.2
What I want to do is optimize center Loss, so there will be two optimizers,I've tried many other solutions
Optimization of Center Loss requires a coefficient multiplication of the gradient, and an error-free approach is:
def optimizer_step(.......):
## optimize model
if optimizer_idx == 0:
optimizer.step(closure=optimizer_closure)
## optimize center loss
else:
optimizer_closure()
for param in center_loss.parameters():
param.grad.data*=weight
optimizer.step()
But this will propagate forward twice, which is obviously not necessary,So I tried the following:
def optimizer_step(.......):
if optimizer_idx == 0:
optimizer,optimizer_center=self.optimizers()
optimizer_closure()
for param in center_loss.parameters():
param.grad.data*=weight
optimizer.step()
optimizer_center.step()
But the error will show that param.grad is None
So I guess I'll just have to use manual optimization
This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!
🐛 Bug
When I use manual_backward ,this bug appear 。
I know the new version may fix this, but for some reasons I can only use version 1.2.4, what should I do?
Environment
- GPU:
- available: True
- version: 11.1
- numpy: 1.21.2
- pyTorch_debug: False
- pyTorch_version: 1.8.1+cu111
- pytorch-lightning: 1.2.4
- tqdm: 4.62.3
- OS: Linux
- architecture:
- 64bit
-
- processor: x86_64
- python: 3.7.11
- version: ModuleNotFoundError: No module named 'demo' #4 SMP Mon Mar 30 12:42:28 HKT 2020
Thanks for your help!!
The text was updated successfully, but these errors were encountered: