LagLlamaLightningModule
lightning_module.LagLlamaLightningModule
A pl.LightningModule class that can be used to train a LagLlamaLightningModule with PyTorch Lightning. This is a thin layer around a (wrapped) LagLlamaLightningModule object, that exposes the methods to evaluate training and validation loss.
__init__(self, model_kwargs: dict, context_length: int, prediction_length: int, loss: DistributionLoss = NegativeLogLikelihood(), lr: float = 0.001, weight_decay: float = 1e-08, aug_prob: float = 0.1, freq_mask_rate: float = 0.1, freq_mixing_rate: float = 0.1, jitter_prob: float = 0.0, jitter_sigma: float = 0.03, scaling_prob: float = 0.0, scaling_sigma: float = 0.1, rotation_prob: float = 0.0, permutation_prob: float = 0.0, permutation_max_segments: int = 5, permutation_seg_mode: str = 'equal', magnitude_warp_prob: float = 0.0, magnitude_warp_sigma: float = 0.2, magnitude_warp_knot: int = 4, time_warp_prob: float = 0.0, time_warp_sigma: float = 0.2, time_warp_knot: int = 4, window_slice_prob: float = 0.0, window_slice_reduce_ratio: float = 0.9, window_warp_prob: float = 0.0, window_warp_window_ratio: float = 0.1, window_warp_scales: list = [0.5, 2.0], data_id_to_name_map: dict = {}, use_cosine_annealing_lr: bool = False, cosine_annealing_lr_args: dict = {}, track_loss_per_series: bool = False, nonnegative_pred_samples: bool = False, use_kv_cache: bool = True, use_single_pass_sampling: bool = False)
| Parameter | Type | Default | Description |
|---|---|---|---|
model_kwargs |
dict |
- | (undocumented) |
context_length |
int |
- | (undocumented) |
prediction_length |
int |
- | (undocumented) |
loss |
DistributionLoss |
NegativeLogLikelihood() |
Loss function to be used for training. |
lr |
float |
1e-3 |
Learning rate. |
weight_decay |
float |
1e-8 |
Weight decay regularization parameter. |
aug_prob |
float |
0.1 |
(undocumented) |
freq_mask_rate |
float |
0.1 |
(undocumented) |
freq_mixing_rate |
float |
0.1 |
(undocumented) |
jitter_prob |
float |
0.0 |
(undocumented) |
jitter_sigma |
float |
0.03 |
(undocumented) |
scaling_prob |
float |
0.0 |
(undocumented) |
scaling_sigma |
float |
0.1 |
(undocumented) |
rotation_prob |
float |
0.0 |
(undocumented) |
permutation_prob |
float |
0.0 |
(undocumented) |
permutation_max_segments |
int |
5 |
(undocumented) |
permutation_seg_mode |
str |
'equal' |
(undocumented) |
magnitude_warp_prob |
float |
0.0 |
(undocumented) |
magnitude_warp_sigma |
float |
0.2 |
(undocumented) |
magnitude_warp_knot |
int |
4 |
(undocumented) |
time_warp_prob |
float |
0.0 |
(undocumented) |
time_warp_sigma |
float |
0.2 |
(undocumented) |
time_warp_knot |
int |
4 |
(undocumented) |
window_slice_prob |
float |
0.0 |
(undocumented) |
window_slice_reduce_ratio |
float |
0.9 |
(undocumented) |
window_warp_prob |
float |
0.0 |
(undocumented) |
window_warp_window_ratio |
float |
0.1 |
(undocumented) |
window_warp_scales |
list |
[0.5, 2.0] |
(undocumented) |
data_id_to_name_map |
dict |
{} |
(undocumented) |
use_cosine_annealing_lr |
bool |
False |
(undocumented) |
cosine_annealing_lr_args |
dict |
{} |
(undocumented) |
track_loss_per_series |
bool |
False |
(undocumented) |
nonnegative_pred_samples |
bool |
False |
(undocumented) |
use_kv_cache |
bool |
True |
(undocumented) |
use_single_pass_sampling |
bool |
False |
(undocumented) |
forward(self, *args, **kwargs)
Performs greedy prediction/sampling.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
*args |
- | - | (undocumented) |
**kwargs |
- | - | (undocumented) |
training_step(self, batch, batch_idx: int)
Execute training step.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
batch |
- | - | (undocumented) |
batch_idx |
int |
- | (undocumented) |
on_train_epoch_end(self)
(undocumented)
validation_step(self, batch, batch_idx: int)
Execute validation step.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
batch |
- | - | (undocumented) |
batch_idx |
int |
- | (undocumented) |
on_validation_epoch_end(self)
(undocumented)
configure_optimizers(self)
Returns the optimizer to use.