MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / restore

Method restore

sat/sgm/modules/ema.py:70–82  ·  view source on GitHub ↗

Restore the parameters stored with the `store` method. Useful to validate the model with EMA parameters without affecting the original optimization process. Store the parameters before the `copy_to` method. After validation (or model saving), use this to rest

(self, parameters)

Source from the content-addressed store, hash-verified

68 self.collected_params = [param.clone() for param in parameters]
69
70 def restore(self, parameters):
71 """
72 Restore the parameters stored with the `store` method.
73 Useful to validate the model with EMA parameters without affecting the
74 original optimization process. Store the parameters before the
75 `copy_to` method. After validation (or model saving), use this to
76 restore the former parameters.
77 Args:
78 parameters: Iterable of `torch.nn.Parameter`; the parameters to be
79 updated with the stored parameters.
80 """
81 for c_param, param in zip(self.collected_params, parameters):
82 param.data.copy_(c_param.data)

Callers 1

ema_scopeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected