Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
300225b
1
Parent(s):
7ad315c
Variable is initialized once
Browse files
new_test_saved_finetuned_model.py
CHANGED
|
@@ -179,7 +179,8 @@ class BERTFineTuneTrainer:
|
|
| 179 |
# true_labels = torch.argmax(data["label"], dim=-1)
|
| 180 |
plabels.extend(predicted_labels.cpu().numpy())
|
| 181 |
tlabels.extend(data['label'].cpu().numpy())
|
| 182 |
-
positive_class_probs = [prob[1] for prob in probabs]
|
|
|
|
| 183 |
# Compare predicted labels to true labels and calculate accuracy
|
| 184 |
correct = (data['label'] == predicted_labels).sum().item()
|
| 185 |
|
|
|
|
| 179 |
# true_labels = torch.argmax(data["label"], dim=-1)
|
| 180 |
plabels.extend(predicted_labels.cpu().numpy())
|
| 181 |
tlabels.extend(data['label'].cpu().numpy())
|
| 182 |
+
# positive_class_probs = [prob[1] for prob in probabs]
|
| 183 |
+
positive_class_probs.append(probs.detach().cpu().numpy().tolist()[1])
|
| 184 |
# Compare predicted labels to true labels and calculate accuracy
|
| 185 |
correct = (data['label'] == predicted_labels).sum().item()
|
| 186 |
|