def test_prediction_loaded_custom_trainer(self, tmpdir_module):
        """validate manual save with automatic save files by comparing output between the two"""
        auto_name = "test_save_automatic"
        model = RNNModel(
            12,
            "RNN",
            10,
            10,
            model_name=auto_name,
            work_dir=tmpdir_module,
            save_checkpoints=True,
            random_state=42,
            **tfm_kwargs,
        )

        # fit model with custom trainer
        trainer = pl.Trainer(
            max_epochs=1,
            enable_checkpointing=True,
            logger=False,
            callbacks=model.trainer_params["callbacks"],
            **tfm_kwargs["pl_trainer_kwargs"],
        )
        model.fit(self.series, trainer=trainer)

        # load automatically saved model with manual load_model() and load_from_checkpoint()
        model_loaded = RNNModel.load_from_checkpoint(
            model_name=auto_name,
            work_dir=tmpdir_module,
            best=False,
            map_location="cpu",
        )

        # compare prediction of loaded model with original model
        assert model.predict(n=4) == model_loaded.predict(n=4)
validate manual save with automatic save files by comparing output between the two
darts/tests/models/forecasting/test_ptl_trainer.py