logitorch.data_collators.prover_collator¶
Classes¶
A collator class for processing data in the PRoverProofWriter format. |
Module Contents¶
- class logitorch.data_collators.prover_collator.PRoverProofWriterCollator(pretrained_roberta_tokenizer: str)[source]¶
A collator class for processing data in the PRoverProofWriter format.
- Args:
- pretrained_roberta_tokenizer (str): The name or path of the pretrained RoBERTa tokenizer.
- Attributes:
- tokenizer (RobertaTokenizer): The pretrained RoBERTa tokenizer.
- Methods:
- get_proof_graph_with_fail(proof_str: str) -> Tuple[List[str], List[str]]: Extracts the proof graph and edges from a proof string with a “FAIL” node.get_proof_graph(proof_str: str) -> Tuple[List[str], List[Tuple[str, str]]]: Extracts the proof graph and edges from a proof string.get_node_edge_label_constrained(x: str) -> Tuple[List[int], List[np.ndarray]]: Generates node and edge labels for a given input.__call__(batch) -> Tuple[Dict[str, torch.Tensor], torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]: Collates a batch of data into tokenized tensors.
- get_node_edge_label_constrained(x: str) Tuple[List[int], List[numpy.ndarray]][source]¶
Generates node and edge labels for a given input.
- Args:
- x (str): The input.
- Returns:
- Tuple[List[int], List[np.ndarray]]: A tuple containing the list of node labels and the list of edge labels.
- get_proof_graph(proof_str: str) Tuple[List[str], List[Tuple[str, str]]][source]¶
Extracts the proof graph and edges from a proof string.
- Args:
- proof_str (str): The proof string.
- Returns:
- Tuple[List[str], List[Tuple[str, str]]]: A tuple containing the list of nodes and the list of edges.