logitorch.pl_models.proofwriter =============================== .. py:module:: logitorch.pl_models.proofwriter Classes ------- .. autoapisummary:: logitorch.pl_models.proofwriter.PLProofWriter Module Contents --------------- .. py:class:: PLProofWriter(pretrained_model: str = 'google/t5-v1_1-large', learning_rate: float = None, weight_decay=0.1) Bases: :py:obj:`lightning.pytorch.LightningModule` Initializes a PLProofWriter object. Args: pretrained_model (str, optional): The name or path of the pretrained model to use. Defaults to "google/t5-v1_1-large". learning_rate (float, optional): The learning rate for the optimizer. Defaults to None. weight_decay (float, optional): The weight decay for the optimizer. Defaults to 0.1. .. py:method:: configure_optimizers() Configures the optimizer and scheduler for training. Returns: Tuple[List[Optimizer], List[Dict[str, Any]]]: The optimizer and scheduler. .. py:method:: forward(x, y) -> transformers.modeling_outputs.SequenceClassifierOutput Performs a forward pass of the model. Args: x: The input data. y: The target data. Returns: SequenceClassifierOutput: The output of the model. .. py:method:: predict(context: str, question: str, num_beams: int = 5, max_length: int = 120, device: str = 'cpu') Generates predictions for the given context and question. Args: context (str): The context for the prediction. question (str): The question for the prediction. num_beams (int, optional): The number of beams for beam search decoding. Defaults to 5. max_length (int, optional): The maximum length of the generated sequence. Defaults to 120. device (str, optional): The device to use for prediction. Defaults to "cpu". Returns: The generated predictions. .. py:method:: training_step(train_batch: Tuple[Dict[str, torch.Tensor], torch.Tensor], batch_idx: int) -> torch.Tensor Performs a training step. Args: train_batch (Tuple[Dict[str, torch.Tensor], torch.Tensor]): The batch of training data. batch_idx (int): The index of the batch. Returns: torch.Tensor: The loss value. .. py:method:: validation_step(val_batch: Tuple[Dict[str, torch.Tensor], torch.Tensor], batch_idx: int) -> None Performs a validation step. Args: val_batch (Tuple[Dict[str, torch.Tensor], torch.Tensor]): The batch of validation data. batch_idx (int): The index of the batch. .. py:attribute:: learning_rate :value: None .. py:attribute:: model .. py:attribute:: pretrained_model :value: 'google/t5-v1_1-large' .. py:attribute:: weight_decay :value: 0.1