Skip to content

Commit

Permalink
Merge branch 'PaddlePaddle:develop' into modify_docs_1129
Browse files Browse the repository at this point in the history
  • Loading branch information
jie-z-0607 authored Nov 29, 2024
2 parents 36b23e1 + 741785a commit 3ff735e
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 3ff735e

Please sign in to comment.