Пример #1
0
 def create_and_check_dpr_reader(
     self, config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels
 ):
     model = DPRReader(config=config)
     model.to(torch_device)
     model.eval()
     result = model(input_ids, attention_mask=input_mask,)
     self.parent.assertListEqual(list(result["start_logits"].size()), [self.batch_size, self.seq_length])
     self.parent.assertListEqual(list(result["end_logits"].size()), [self.batch_size, self.seq_length])
     self.parent.assertListEqual(list(result["relevance_logits"].size()), [self.batch_size])
    def create_and_check_reader(
        self, config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels
    ):
        model = DPRReader(config=config)
        model.to(torch_device)
        model.eval()
        result = model(
            input_ids,
            attention_mask=input_mask,
        )

        self.parent.assertEqual(result.start_logits.shape, (self.batch_size, self.seq_length))
        self.parent.assertEqual(result.end_logits.shape, (self.batch_size, self.seq_length))
        self.parent.assertEqual(result.relevance_logits.shape, (self.batch_size,))