MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / restore

Method restore

ldm/modules/ema.py:68–80  ·  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

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

Callers 2

ema_scopeMethod · 0.80
ema_scopeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected