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

Optimize all parameters in Pytorch module that require gradient #1602

Open
JackCaster opened this issue Mar 18, 2024 · 3 comments
Open

Optimize all parameters in Pytorch module that require gradient #1602

JackCaster opened this issue Mar 18, 2024 · 3 comments

Comments

@JackCaster
Copy link

I would like to optimize a Pytorch neural network with Nevergrad. How can I tell Nevergrad to optimize all parameters in the module that require grad (e.g., params_to_optimize = filter(lambda p: p.requires_grad, model.parameters()))?

@changdaeoh
Copy link

@JackCaster Hi

It's been a while, so you've probably resolved it on your own, but I found the tutorial below useful.

https://medium.com/@joragasy/optimize-neural-network-with-gradient-free-methods-using-pytorch-and-nevergrad-399a9f4a5c21

@JackCaster
Copy link
Author

Any additional (official) inputs about this?

@teytaud
Copy link
Contributor

teytaud commented Dec 1, 2024

I think we need something for conveniently optimizing a subset of a model parameters.
I do it everyday, but manually each time.
A convenient interface with Pytorch models would be great.
I will investigate. This will take some time though.

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

3 participants