    def _finalize_model(self) -> None:
        """If we have a moving average, we have to finalize the model at the end of training."""
        if self._moving_average is not None:
            self._moving_average.assign_average_value()
If we have a moving average, we have to finalize the model at the end of training.
allennlp/training/gradient_descent_trainer.py