Copy of model_params
# Website: www.continualai.org #
################################################################################
+import copy
+
from torch import Tensor
from avalanche.evaluation import PluginMetric
@@ -75,7 +77,8 @@ class WeightCheckpoint(PluginMetric[Tensor]):
self.get_global_counter())]
def after_eval_exp(self, strategy: 'BaseStrategy') -> 'MetricResult':
- self.update(strategy.model.parameters())
+ model_params = copy.deepcopy(strategy.model.parameters())
+ self.update(model_params)
def __str__(self):
return "WeightCheckpoint"
