Variable is initialized once

#6
Files changed (1) hide show
  1. new_test_saved_finetuned_model.py +2 -1
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