예제 #1
0
 def test_default_regression(self):
     MODEL_ID = "distilroberta-base"
     tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
     data_args = GlueDataTrainingArguments(
         task_name="sts-b", data_dir="./tests/fixtures/tests_samples/STS-B", overwrite_cache=True
     )
     dataset = GlueDataset(data_args, tokenizer=tokenizer, evaluate=True)
     data_collator = DefaultDataCollator()
     batch = data_collator.collate_batch(dataset.features)
     self.assertEqual(batch["labels"].dtype, torch.float)
예제 #2
0
 def test_default_classification(self):
     MODEL_ID = "bert-base-cased-finetuned-mrpc"
     tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
     data_args = GlueDataTrainingArguments(
         task_name="mrpc", data_dir="./tests/fixtures/tests_samples/MRPC", overwrite_cache=True
     )
     dataset = GlueDataset(data_args, tokenizer=tokenizer, evaluate=True)
     data_collator = DefaultDataCollator()
     batch = data_collator.collate_batch(dataset.features)
     self.assertEqual(batch["labels"].dtype, torch.long)