def test_load_weights_params_check(self, tmpdir_fn):
        """
        Verify that the method comparing the parameters between the saved model and the loading model
        behave as expected, used to return meaningful error message instead of the torch.load ones.
        """
        model_name = "params_check"
        ckpt_path = os.path.join(tmpdir_fn, f"{model_name}.pt")
        # barebone model
        model = DLinearModel(
            input_chunk_length=4, output_chunk_length=1, n_epochs=1, **tfm_kwargs
        )
        model.fit(self.series[:10])
        model.save(ckpt_path)

        # identical model
        loading_model = DLinearModel(
            input_chunk_length=4, output_chunk_length=1, **tfm_kwargs
        )
        loading_model.load_weights(ckpt_path)

        # different optimizer
        loading_model = DLinearModel(
            input_chunk_length=4,
            output_chunk_length=1,
            optimizer_cls=torch.optim.AdamW,
            **tfm_kwargs,
        )
        loading_model.load_weights(ckpt_path)

        model_summary_kwargs = {
            "pl_trainer_kwargs": dict(
                {"enable_model_sumamry": False}, **tfm_kwargs["pl_trainer_kwargs"]
            )
        }
        # different pl_trainer_kwargs
        loading_model = DLinearModel(
            input_chunk_length=4,
            output_chunk_length=1,
            **model_summary_kwargs,
        )
        loading_model.load_weights(ckpt_path)

        # different input_chunk_length (tfm parameter)
        loading_model = DLinearModel(
            input_chunk_length=4 + 1, output_chunk_length=1, **tfm_kwargs
        )
        with pytest.raises(ValueError) as error_msg:
            loading_model.load_weights(ckpt_path)
        assert str(error_msg.value).startswith(
            "The values of the hyper-parameters in the model and loaded checkpoint should be identical.\n"
            "incorrect"
        )

        # different kernel size (cls specific parameter)
        loading_model = DLinearModel(
            input_chunk_length=4,
            output_chunk_length=1,
            kernel_size=10,
            **tfm_kwargs,
        )
        with pytest.raises(ValueError) as error_msg:
            loading_model.load_weights(ckpt_path)
        assert str(error_msg.value).startswith(
            "The values of the hyper-parameters in the model and loaded checkpoint should be identical.\n"
            "incorrect"
        )

        Verify that the method comparing the parameters between the saved model and the loading model
        behave as expected, used to return meaningful error message instead of the torch.load ones.
        
darts/tests/models/forecasting/test_torch_forecasting_model.py