LTSMConfig
module.py.LTSMConfig
Configuration dataclass for the LagLlama Transformer architecture.
__init__(self, feature_size: int = 9, block_size: int = 2048, n_layer: int = 32, n_head: int = 32, n_embd_per_head: int = 128, rope_scaling: Optional[dict] = None, dropout: float = 0.0)
| Parameter | Type | Default | Description |
|---|---|---|---|
| feature_size | int | 9 | target + loc + scale + time features |
| block_size | int | 2048 | (undocumented) |
| n_layer | int | 32 | (undocumented) |
| n_head | int | 32 | (undocumented) |
| n_embd_per_head | int | 128 | (undocumented) |
| rope_scaling | Optional[dict] | None | (undocumented) |
| dropout | float | 0.0 | (undocumented) |
RMSNorm
module.py.RMSNorm
Root Mean Square Layer Normalization.
__init__(self, size: int, dim: int = -1, eps: float = 1e-5) -> None
| Parameter | Type | Default | Description |
|---|---|---|---|
| size | int | - | (undocumented) |
| dim | int | -1 | (undocumented) |
| eps | float | 1e-5 | (undocumented) |
LagLlamaModel
module.py.LagLlamaModel
(No prose description found in class docstring.)
__init__(self, context_length: int, max_context_length: int, scaling: str, input_size: int, n_layer: int, n_embd_per_head: int, n_head: int, lags_seq: List[int], distr_output: DistributionOutput, rope_scaling=None, num_parallel_samples: int = 100, time_feat: bool = True, dropout: float = 0.0) -> None
| Parameter | Type | Default | Description |
|---|---|---|---|
| context_length | int | - | (undocumented) |
| max_context_length | int | - | (undocumented) |
| scaling | str | - | (undocumented) |
| input_size | int | - | (undocumented) |
| n_layer | int | - | (undocumented) |
| n_embd_per_head | int | - | (undocumented) |
| n_head | int | - | (undocumented) |
| lags_seq | List[int] | - | (undocumented) |
| distr_output | DistributionOutput | - | (undocumented) |
| rope_scaling | None | None | (undocumented) |
| num_parallel_samples | int | 100 | (undocumented) |
| time_feat | bool | True | (undocumented) |
| dropout | float | 0.0 | (undocumented) |
prepare_input(self, past_target: torch.Tensor, past_observed_values: torch.Tensor, past_time_feat: Optional[torch.Tensor] = None, future_time_feat: Optional[torch.Tensor] = None, future_target: Optional[torch.Tensor] = None)
(No prose summary found.)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| past_target | torch.Tensor | - | (undocumented) |
| past_observed_values | torch.Tensor | - | (undocumented) |
| past_time_feat | Optional[torch.Tensor] | None | (undocumented) |
| future_time_feat | Optional[torch.Tensor] | None | (undocumented) |
| future_target | Optional[torch.Tensor] | None | (undocumented) |
forward(self, past_target: torch.Tensor, past_observed_values: torch.Tensor, past_time_feat: Optional[torch.Tensor] = None, future_time_feat: Optional[torch.Tensor] = None, future_target: Optional[torch.Tensor] = None, use_kv_cache: bool = False) -> torch.Tensor
(No prose summary found.)
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| past_target | torch.Tensor | - | (undocumented) |
| past_observed_values | torch.Tensor | - | (undocumented) |
| past_time_feat | Optional[torch.Tensor] | None | (undocumented) |
| future_time_feat | Optional[torch.Tensor] | None | (undocumented) |
| future_target | Optional[torch.Tensor] | None | (undocumented) |
| use_kv_cache | bool | False | (undocumented) |
Returns: torch.Tensor.
reset_cache(self) -> None
Resets all cached key-values in attention. Has to be called after prediction loop in predictor
Returns: None.