    def test_from_params(self):
        """Make sure `from_params` initializes an instance properly."""
        optim = self._get_optimizer()
        sched = LearningRateScheduler.from_params(
            optimizer=optim, params=Params({"type": "cosine", "t_initial": 5})
        )

        assert sched.t_initial == 5
        assert sched.last_epoch == -1

        # Learning should be unchanged after initializing scheduler.
        assert optim.param_groups[0]["lr"] == 1.0

        with pytest.raises(ConfigurationError):
            # t_initial is required.
            LearningRateScheduler.from_params(optimizer=optim, params=Params({"type": "cosine"}))
Make sure `from_params` initializes an instance properly.
tests/training/learning_rate_schedulers/cosine_test.py