[docs]classProofWriterQACollator:def__init__(self,pretrained_t5_tokenizer:str)->None:""" Initializes the ProofWriterQACollator. Args: | pretrained_t5_tokenizer (str): The name or path of the pretrained T5 tokenizer. """
def__call__(self,batch)->Tuple[Dict[str,torch.Tensor],torch.Tensor]:""" Processes a batch of data. Args: | batch: The input batch. Returns: | Tuple[Dict[str, torch.Tensor], torch.Tensor]: The processed batch. """contexts=[]questions=[]labels=[]foriinbatch:sentences=[]fork,vini[0].items():sentences.append(f"{k}: {v}")fork,vini[1].items():sentences.append(f"{k}: {v}")contexts.append("".join(sentences))questions.append(i[2])labels.append(str(i[3]))batch_x=self.tokenizer(contexts,questions,padding=True,return_tensors="pt",)batch_y=self.tokenizer(labels,padding=True,return_tensors="pt")returnbatch_x,batch_y.input_ids
[docs]classProofWriterProofGenerationAllCollator:def__init__(self,pretrained_t5_tokenizer:str)->None:""" Initializes the ProofWriterProofGenerationAllCollator. Args: | pretrained_t5_tokenizer (str): The name or path of the pretrained T5 tokenizer. """