Beispiel #1
0
 def create_and_check_xlm_for_token_classification(
     self,
     config,
     input_ids,
     token_type_ids,
     input_lengths,
     sequence_labels,
     token_labels,
     is_impossible_labels,
     input_mask,
 ):
     config.num_labels = self.num_labels
     model = TFXLMForTokenClassification(config=config)
     inputs = {
         "input_ids": input_ids,
         "attention_mask": input_mask,
         "token_type_ids": token_type_ids
     }
     (logits, ) = model(inputs)
     result = {
         "logits": logits.numpy(),
     }
     self.parent.assertListEqual(
         list(result["logits"].shape),
         [self.batch_size, self.seq_length, self.num_labels])
 def create_and_check_xlm_for_token_classification(
     self,
     config,
     input_ids,
     token_type_ids,
     input_lengths,
     sequence_labels,
     token_labels,
     is_impossible_labels,
     choice_labels,
     input_mask,
 ):
     config.num_labels = self.num_labels
     model = TFXLMForTokenClassification(config=config)
     inputs = {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
     result = model(inputs)
     self.parent.assertEqual(result.logits.shape, (self.batch_size, self.seq_length, self.num_labels))