I was following the huggingface tutorial on training a multiple choice QA model and trained my model with
training_args = TrainingArguments(
output_dir="./results",
evaluation_strategy="epoch",
learning_rate=5e-5,
per_device_train_batch_size=8,
per_device_eval_batch_size=8,
num_train_epochs=1,
weight_decay=0.01,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=tokenized_qa["train"],
eval_dataset=tokenized_qa["validation"],
tokenizer=tokenizer,
data_collator=DataCollatorForMultipleChoice(tokenizer=tokenizer),
compute_metrics=compute_metrics
)
trainer.train()
Afterwards I can load the model with:
# load trained model for testing
model = AutoModelForMultipleChoice.from_pretrained('results/checkpoint-1000')
But how can I test it on the testing dataset?
The dataset looks like:
DatasetDict({
train: Dataset({
features: ['id', 'sent1', 'sent2', 'ending0', 'ending1', 'ending2', 'ending3', 'label', 'input_ids', 'attention_mask'],
num_rows: 10178
})
test: Dataset({
features: ['id', 'sent1', 'sent2', 'ending0', 'ending1', 'ending2', 'ending3', 'label', 'input_ids', 'attention_mask'],
num_rows: 1273
})
validation: Dataset({
features: ['id', 'sent1', 'sent2', 'ending0', 'ending1', 'ending2', 'ending3', 'label', 'input_ids', 'attention_mask'],
num_rows: 1272
})
})
I have quite a bit of code so if there's more information needed please do let me know.