def _clean(self) -> Self:
        """Returns a cleaned model, keeping only the necessary attributes for prediction."""
        model = super()._clean()
        # Copy from super()._clean() call __getstate__ which removes model and trainer
        # a shallow copy is enough since we are only interested in removing pointers
        model.model = copy.copy(self.model)  # keep the model for prediction
        model._model_params = copy.copy(self._model_params)
        model._model_params["pl_trainer_kwargs"] = None
        model.trainer_params = {}
        return model
Returns a cleaned model, keeping only the necessary attributes for prediction.
darts/models/forecasting/torch_forecasting_model.py