model state manipulation #1448
-
Suppose we have two model #[derive(Module, Debug)] let model1: crate::model::RegressionModel = let model2: crate::model::RegressionModel = How can we compute the average of the parameters of two models and then load these averaged parameters into a new model? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think #1245 will fix this, once it's merged you can use |
Beta Was this translation helpful? Give feedback.
-
I think the question is a bit different. You can create functions that work for each parameter of the module. There is the |
Beta Was this translation helpful? Give feedback.
I think the question is a bit different. You can create functions that work for each parameter of the module. There is the
map
andvisit
functions that exist onModule
. You could useburn::tensor::container::TensorContainer
to aggregate each parameter and then update the module in question. This is the strategy used inburn-train
for gradients accumulation, but this can be used to merge modules as well.