Load the model parameters from EMA model. Useful for inference or fine-tuning from the EMA model.
(self, model)
| 134 | self._step_internal(new_model) |
| 135 | |
| 136 | def reverse(self, model): |
| 137 | """ |
| 138 | Load the model parameters from EMA model. |
| 139 | Useful for inference or fine-tuning from the EMA model. |
| 140 | """ |
| 141 | d = self.model.state_dict() |
| 142 | if "_ema" in d: |
| 143 | del d["_ema"] |
| 144 | |
| 145 | model.load_state_dict(d, strict=False) |
| 146 | return model |
no test coverage detected