예제 #1
0
 def create_and_check_mobilebert_for_next_sequence_prediction(
         self, config, input_ids, token_type_ids, input_mask,
         sequence_labels, token_labels, choice_labels):
     model = MobileBertForNextSentencePrediction(config=config)
     model.to(torch_device)
     model.eval()
     result = model(
         input_ids,
         attention_mask=input_mask,
         token_type_ids=token_type_ids,
         labels=sequence_labels,
     )
     self.parent.assertEqual(result.logits.shape, (self.batch_size, 2))
 def create_and_check_mobilebert_for_next_sequence_prediction(
         self, config, input_ids, token_type_ids, input_mask,
         sequence_labels, token_labels, choice_labels):
     model = MobileBertForNextSentencePrediction(config=config)
     model.to(torch_device)
     model.eval()
     result = model(
         input_ids,
         attention_mask=input_mask,
         token_type_ids=token_type_ids,
         next_sentence_label=sequence_labels,
     )
     self.parent.assertListEqual(list(result["logits"].size()),
                                 [self.batch_size, 2])
     self.check_loss_output(result)