Skip to content

Commit

Permalink
fix: change logits to sigmoid
Browse files Browse the repository at this point in the history
  • Loading branch information
monologg committed Jan 14, 2021
1 parent 47f5afb commit d47dfed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions run_goemotions.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ def evaluate(args, model, eval_dataset, mode, global_step=None):
eval_loss += tmp_eval_loss.mean().item()
nb_eval_steps += 1
if preds is None:
preds = logits.detach().cpu().numpy()
preds = 1 / (1 + np.exp(-logits.detach().cpu().numpy())) # Sigmoid
out_label_ids = inputs["labels"].detach().cpu().numpy()
else:
preds = np.append(preds, logits.detach().cpu().numpy(), axis=0)
preds = np.append(preds, 1 / (1 + np.exp(-logits.detach().cpu().numpy())), axis=0) # Sigmoid
out_label_ids = np.append(out_label_ids, inputs["labels"].detach().cpu().numpy(), axis=0)

eval_loss = eval_loss / nb_eval_steps
Expand Down

0 comments on commit d47dfed

Please sign in to comment.