Skip to content

Commit 741785a

Browse files
authored
support pp accuracy calculation (#9379)
* support pp accuracy calculation * add pp accuracy ci * add comment * update * mv logits accumulation to cpu * refactor code * code refactor * remove ci, not support yet * update
1 parent 020a25f commit 741785a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

paddlenlp/trainer/trainer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3197,7 +3197,9 @@ def evaluation_loop(
31973197

31983198
# Metrics!
31993199
if self.compute_metrics is not None and all_preds is not None and all_labels is not None:
3200-
metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=all_labels))
3200+
# all_labels maybe is a tuple when prediction_steps output label_mask
3201+
batch_labels = all_labels[0] if isinstance(all_labels, (list, tuple)) else all_labels
3202+
metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=batch_labels))
32013203
else:
32023204
metrics = {}
32033205

0 commit comments

Comments
 (0)