Skip to content

Commit

Permalink
tiny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga committed Jun 30, 2024
1 parent 8c41a0a commit 73280b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/llamafactory/train/sft/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def compute_accuracy(eval_preds: "EvalPrediction") -> Dict[str, float]:
preds, labels = eval_preds.predictions, eval_preds.label_ids
accuracies = []
for i in range(len(preds)):
pred, label = preds[i, 1:], labels[i, :-1]
pred, label = preds[i, :-1], labels[i, 1:]
label_mask = label != IGNORE_INDEX
accuracies.append(np.mean(pred[label_mask] == label[label_mask]))

Expand Down

0 comments on commit 73280b7

Please sign in to comment.