示例#1
0
 def create_and_check_openai_gpt_lm_head(self, config, input_ids, input_mask, head_mask, token_type_ids, *args):
     model = TFOpenAIGPTLMHeadModel(config=config)
     inputs = {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
     prediction_scores = model(inputs)[0]
     result = {
         "prediction_scores": prediction_scores.numpy(),
     }
     self.parent.assertListEqual(
         list(result["prediction_scores"].shape), [self.batch_size, self.seq_length, self.vocab_size]
     )
示例#2
0
 def create_and_check_openai_gpt_lm_head(self, config, input_ids,
                                         input_mask, head_mask,
                                         token_type_ids, *args):
     model = TFOpenAIGPTLMHeadModel(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.vocab_size))