gluonts.torch.model.deepar.lightning_module module#

class gluonts.torch.model.deepar.lightning_module.DeepARLightningModule(model_kwargs: dict, lr: float = 0.001, weight_decay: float = 1e-08, patience: int = 10)[source]#

Bases: lightning.pytorch.core.module.LightningModule

A pl.LightningModule class that can be used to train a DeepARModel with PyTorch Lightning.

This is a thin layer around a (wrapped) DeepARModel object, that exposes the methods to evaluate training and validation loss.

Parameters
  • model_kwargs – Keyword arguments to construct the DeepARModel to be trained.

  • loss – Loss function to be used for training.

  • lr – Learning rate.

  • weight_decay – Weight decay regularization parameter.

  • patience – Patience parameter for learning rate scheduler.

configure_optimizers()[source]#

Returns the optimizer to use.

forward(*args, **kwargs)[source]#

Same as torch.nn.Module.forward().

Parameters
  • *args – Whatever you decide to pass into the forward method.

  • **kwargs – Keyword arguments are also possible.

Returns

Your model’s output

training_step(batch, batch_idx: int)[source]#

Execute training step.

validation_step(batch, batch_idx: int)[source]#

Execute validation step.