logitorch.pl_models.prover¶
Classes¶
PyTorch Lightning module for the PRover model. |
Module Contents¶
- class logitorch.pl_models.prover.PLPRover(pretrained_model: str = 'roberta-base', learning_rate: float = 1e-05, weight_decay: float = 0.1, num_labels: int = 2)[source]¶
Bases:
lightning.pytorch.LightningModulePyTorch Lightning module for the PRover model.
- Args:
pretrained_model (str): Name of the pretrained model to use. Default is “roberta-base”. learning_rate (float): Learning rate for the optimizer. Default is 1e-5. weight_decay (float): Weight decay for the optimizer. Default is 0.1. num_labels (int): Number of labels for the model. Default is 2.
- configure_optimizers()[source]¶
Configure the optimizer and scheduler for training.
- Returns:
Tuple of optimizer and scheduler.
- forward(x, proof_offsets=None, node_labels=None, edge_labels=None, qa_labels=None, device: str = 'cpu')[source]¶
Forward pass of the PLPRover model.
- Args:
x: Input data. proof_offsets: Proof offsets. node_labels: Node labels. edge_labels: Edge labels. qa_labels: QA labels. device (str): Device to use for computation. Default is “cpu”.
- Returns:
Output of the model.
- predict(triples, rules, question, device: str = 'cpu')[source]¶
Make predictions using the PLPRover model.
- Args:
triples: Triples data. rules: Rules data. question: Question data. device (str): Device to use for computation. Default is “cpu”.
- Returns:
Predicted output.
- training_step(train_batch: Tuple[Dict[str, torch.Tensor], torch.Tensor], batch_idx: int) torch.Tensor[source]¶
Training step for the PLPRover model.
- Args:
train_batch: Batch of training data. batch_idx: Index of the batch.
- Returns:
Loss value.