Exemplo n.º 1
0
 def create_and_check_model(self, config, input_ids, input_mask):
     model = CLIPTextModel(config=config)
     model.to(torch_device)
     model.eval()
     result = model(input_ids, attention_mask=input_mask)
     result = model(input_ids)
     self.parent.assertEqual(result.last_hidden_state.shape, (self.batch_size, self.seq_length, self.hidden_size))
     self.parent.assertEqual(result.pooler_output.shape, (self.batch_size, self.hidden_size))
Exemplo n.º 2
0
 def test_model_from_pretrained(self):
     for model_name in CLIP_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         model = CLIPTextModel.from_pretrained(model_name)
         self.assertIsNotNone(model)