class_docstr: PyTorch Lightning module for the meta models.
class_docstr_tok: ["PyTorch","Lightning","module","for","the","meta","models","."]
code: def __init__(
      self,
      model: MetaModel,
      val_dataset_names: List[str],
      test_dataset_names: List[str],
      lr_scheduler_monitor: str,
      loss: Metric,
      crps: Metric,
      crps_scaled: Optional[Metric] = None,
      lr: float = 1e-3,
      lr_on_plateau_patience: int = 5,
      lr_on_plateau_factor: float = 0.3,
      quantile_width: Metric = None,
      **kwargs,
  ):
      super().__init__(**kwargs)
      self.model = model
      self.train_loss = loss.clone()
      self.lr = lr
      self.lr_on_plateau_patience = lr_on_plateau_patience
      self.lr_on_plateau_factor = lr_on_plateau_factor
      self.lr_scheduler_monitor = lr_scheduler_monitor
      self.quantile_width = quantile_width
  
      # validation
      self.val_loss = nn.ModuleList(
          [loss.clone() for _ in range(len(val_dataset_names))]
      )
      self.val_loss_macro = sum(self.val_loss) / len(self.val_loss)
  
      if quantile_width is not None:
          self.val_quantile_width = nn.ModuleList(
              [
                  quantile_width.clone()
                  for _ in range(len(val_dataset_names))
              ]
          )
          self.test_quantile_width = nn.ModuleList(
              [
                  quantile_width.clone()
                  for _ in range(len(test_dataset_names))
              ]
          )
  
      self.val_dataset_names = val_dataset_names
      (
          self.val_crps,
          self.val_crps_macro,
          self.val_crps_scaled,
          self.val_crps_scaled_macro,
      ) = _init_metrics(val_dataset_names, crps, crps_scaled)
  
      # test
      self.test_dataset_names = test_dataset_names
      (
          self.test_crps,
          self.test_crps_macro,
          self.test_crps_scaled,
          self.test_crps_scaled_macro,
      ) = _init_metrics(test_dataset_names, crps, crps_scaled)
  
file_path: gluonts/src/gluonts/nursery/few_shot_prediction/src/meta/models/module.py
imports: from typing import Any, Dict, Optional, List
  import pytorch_lightning
  import torch
  import torch.optim
  from torch import nn
  from torchmetrics import Metric
  from torch.optim.lr_scheduler import ReduceLROnPlateau
  from meta.data.batch import TripletBatch
  from meta.models.model import MetaModel
  from meta.common.torch import get_mask
label_desc: Use image node_id 1 to create a new MetaLightningModule object from inherited base classes: pl with example: obj = MetaLightningModule(model, val_dataset_names, test_dataset_names, lr_scheduler_monitor, loss, crps, crps_scaled, lr, lr_on_plateau_patience, lr_on_plateau_factor, quantile_width)