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

about grad freezing #3

Open
scirocc opened this issue Mar 17, 2023 · 1 comment
Open

about grad freezing #3

scirocc opened this issue Mar 17, 2023 · 1 comment

Comments

@scirocc
Copy link

scirocc commented Mar 17, 2023

paper says:where φ are the parameters of the value network, θ the parameters of the policy network, and η and α
are Lagrange multipliers. In practice, the policy and value networks share most of their parameters in
the form of a shared convolutional network (a ResNet) and recurrent LSTM core, and are optimized
together (Fig. 5b in the Appendix) (Mnih et al., 2016). We note, however, that the value network
parameters φ are considered fixed for the policy improvement loss, and gradients are not propagated

@scirocc
Copy link
Author

scirocc commented Mar 17, 2023

so maybe like this?
`self.optim_4_pi = torch.optim.AdamW([
{'params': self.eta, 'lr': self.lr},
{'params': self.alpha_mean, 'lr': self.lr},
{'params': self.alpha_cov, 'lr': self.lr},
{'params': self.actor.nn_avg.parameters(), 'lr': self.lr},
{'params': self.actor.diag_cholesky_factor, 'lr': self.lr},
])
self.optim_4_phi = torch.optim.AdamW([
{'params': self.shared_net.parameters(), 'lr': self.lr},
{'params': self.critic.net.parameters(), 'lr': self.lr},
])
loss.backward()
self.optim_4_pi.step()
self.optim_4_pi.zero_grad()
self.optim_4_phi.step()
self.optim_4_phi.zero_grad()

`
?

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

1 participant