Skip to content

Commit

Permalink
support pp accuracy calculation (#9379)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wtmlon authored Nov 29, 2024
1 parent 020a25f commit 741785a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3197,7 +3197,9 @@ def evaluation_loop(

# Metrics!
if self.compute_metrics is not None and all_preds is not None and all_labels is not None:
metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=all_labels))
# all_labels maybe is a tuple when prediction_steps output label_mask
batch_labels = all_labels[0] if isinstance(all_labels, (list, tuple)) else all_labels
metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=batch_labels))
else:
metrics = {}

Expand Down

0 comments on commit 741785a

Please # to comment.