@@ -301,6 +301,20 @@ class NeuralProphet:
301301 >>> m = NeuralProphet(collect_metrics=["MSE", "MAE", "RMSE"])
302302 >>> # use custorm torchmetrics names
303303 >>> m = NeuralProphet(collect_metrics={"MAPE": "MeanAbsolutePercentageError", "MSLE": "MeanSquaredLogError",
304+ scheduler : str, torch.optim.lr_scheduler._LRScheduler
305+ Type of learning rate scheduler to use.
306+
307+ Options
308+ * (default) ``OneCycleLR``: One Cycle Learning Rate scheduler
309+ * ``StepLR``: Step Learning Rate scheduler
310+ * ``ExponentialLR``: Exponential Learning Rate scheduler
311+ * ``CosineAnnealingLR``: Cosine Annealing Learning Rate scheduler
312+
313+ Examples
314+ --------
315+ >>> from neuralprophet import NeuralProphet
316+ >>> # Step Learning Rate scheduler
317+ >>> m = NeuralProphet(scheduler="StepLR")
304318
305319 COMMENT
306320 Uncertainty Estimation
@@ -975,6 +989,13 @@ def fit(
975989 Note: using multiple workers and therefore distributed training might significantly increase
976990 the training time since each batch needs to be copied to each worker for each epoch. Keeping
977991 all data on the main process might be faster for most datasets.
992+ scheduler : str
993+ Type of learning rate scheduler to use for continued training. If None, uses ExponentialLR as
994+ default as specified in the model config.
995+ Options
996+ * ``StepLR``: Step Learning Rate scheduler
997+ * ``ExponentialLR``: Exponential Learning Rate scheduler
998+ * ``CosineAnnealingLR``: Cosine Annealing Learning Rate scheduler
978999
9791000 Returns
9801001 -------
@@ -2796,7 +2817,8 @@ def _train(
27962817 checkpoint_path = self .metrics_logger .checkpoint_path
27972818 checkpoint = torch .load (checkpoint_path )
27982819
2799- previous_epoch = self .model .current_epoch
2820+ checkpoint_epoch = checkpoint ["epoch" ] if "epoch" in checkpoint else 0
2821+ previous_epoch = max (self .model .current_epoch , checkpoint_epoch )
28002822
28012823 # Set continue_training flag in model to update scheduler correctly
28022824 self .model .continue_training = True
0 commit comments