Evaluate the model
Getting all together
model = BertForSequenceClassification.from_pretrained("bert-base-uncased",
num_labels=len(label_dict),
output_attentions=False,
output_hidden_states=False)
model.to(device)
pass
model.load_state_dict(
torch.load('Models/finetuned_bert_epoch_1_gpu_trained.model',
map_location = torch.device('cpu')
)
)
_, predictions, true_vals = evaluate(dataloader_val)
accuracy_per_class(predictions, true_vals)Last updated