logitorch.models.prover

Classes

PRover

Initializes the PRover model.

Module Contents

class logitorch.models.prover.PRover(pretrained_roberta_model: str, num_labels: int = 2)[source]

Bases: torch.nn.Module

Initializes the PRover model.

Args:

pretrained_roberta_model: The path or name of the pretrained RoBERTa model. num_labels: The number of labels for classification.

forward(x, proof_offsets=None, node_labels=None, edge_labels=None, qa_labels=None, max_node_length=None, max_edge_length=None, device: str = 'cpu')[source]

Forward pass of the PRover model.

Args:

x: The input tensor. proof_offsets: The proof offsets. node_labels: The node labels. edge_labels: The edge labels. qa_labels: The QA labels. max_node_length: The maximum node length. max_edge_length: The maximum edge length. device: The device to run the model on.

Returns:

The model outputs.

predict(triples, rules, question, device: str = 'cpu')[source]

Predicts the label for a given question.

Args:

triples: The triples. rules: The rules. question: The question. device: The device to run the model on.

Returns:

The predicted label.

classifier[source]
classifier_edge[source]
classifier_node[source]
config[source]
encoder[source]
naf_layer[source]
num_labels = 2[source]
num_labels_edge = 2[source]
proofwriter_collator[source]