-
Notifications
You must be signed in to change notification settings - Fork 23
Updating the trainable_params variable when write_trainables method #710
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks Kartik! I think the more elegant solution would be to delete the cell.make_trainable("gNa")
cell.set("gNa", 2.0)
params = cell.get_parameters()and it would return the updated params from I might be missing something though, so if you see a reason for why this does not work, then let me know! |
|
I agree this is a hacky solution and having the logic moved to I checked the code block you have pointed out to it seems the code under init_val condition can be dropped (since we don't initialize anything when we fetch existing values of trainables) and lines 1455 and 1474 should suffice while we still keep track of the trainable parameter names. But I will think more carefully about it and get back to update the PR! |
… underlying dataframe where the values are being updated in write_trainables and set methods
|
I have updated the PR for However, the PR is still incomplete. I have few doubts,
|
|
Hi Kartik,
You can remove these bits of code.
I think we should just get rid of the option to provide an net.make_trainable("HH_gNa", 0.2) |
|
Hello there, yes I initialize trainable parameters using make_trainable() currently everywhere, and I think it's a major API change that could at least go to the v1 release. Maybe there is a way to still delete |
|
Okay, then let us not remove the However, maybe the easiest option is the one that @Kartik-Sama had originally implemented: to just write to |
|
I see that trainable parameters values are being stored in two places 1) dataframe corresponding to the module's base 2) Having both of them is fine as long as both these places are consistently updated whenever changes happen. But the cleaner way would be to just have one place to store this information and retrieve it in the format necessary. We can still get rid of I also have doubts with a test though. Here the params are being fetched from get_params twice (at lines 98 and 120). However in between these lines I see no writing or setting of |
How? Where will the |
|
In that way we can always call For instance the |
When the
write_trainablesfunction is invoked, the parameters of the module are being changed in the lines in thewrite_trainablesmethod.However when the method
get_parametersis called (which is supposed to return only the trainable parameters) the class memberself.trainable_paramsis being accessed. Which is populated in themake_trainablemethod, but is never updated in the flow of thewrite_trainablesmethod.The code changes address Issue 709 - it updates the stale values being returned by
get_parametersmethod when changes to trainable parameters are made through thewrite_trainablesmethod. This done by maintaining the correct state of trainable parameters in the class memberself.trainable_params.