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

Freeze network parameters #166

Open
gwario opened this issue Jan 28, 2023 · 3 comments
Open

Freeze network parameters #166

gwario opened this issue Jan 28, 2023 · 3 comments

Comments

@gwario
Copy link
Contributor

gwario commented Jan 28, 2023

Hi!

As I need to freeze some of my network's parameters, i was trying to implement Network.params to return only the parameters i actually want to be optimized.

However this seems to not do what i thought since Network.train! does call (in the case of Flux) Flux.params on the network and not my version of Network.params so if this is the intended behavior, I need to override network.train!... if it is a mistake, the fix is probably to replace Flux.params with Network.params for Flux, for Knet I'm not sure how to do it though.

Could you please clarify
Thanks!
Regards GW

@jonathan-laurent
Copy link
Owner

I think this is a bug indeed and Network.train! should not be calling Flux directly.
Feel free to submit a PR, especially if you can figure out how to implement params for Knet!

@gwario
Copy link
Contributor Author

gwario commented Feb 3, 2023

Hm i it works for flux when changing it to Network.params .. for knet i don't know sadly... think it is good to change that behavior for both network libs at the same time... what do you think? or should i just submit the change for flux?

@jonathan-laurent
Copy link
Owner

Does this mean that the Knet backend is currently broken?
I have a hard time imagining things going well if Flux.params is called on a Knet network.

Honestly though, supporting both Flux and Knet is a maintenance nightmare and the cause of much useless complexity in the codebase. I wish there was a better story for compatibility between ML frameworks (and I know Deniz Yuret has been doing some work toward this) but this should not be AlphaZero.jl's responsibility.

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

2 participants