From 27b79501b2db36f674e4468a52a0874662bc2af7 Mon Sep 17 00:00:00 2001 From: calpt <36051308+calpt@users.noreply.github.com> Date: Wed, 23 Nov 2022 11:29:29 +0100 Subject: [PATCH] Fix issues in example scripts: - GLUE script with STS-B - UDP script evaluation --- examples/pytorch/dependency-parsing/utils_udp.py | 4 ++-- examples/pytorch/text-classification/run_glue.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/pytorch/dependency-parsing/utils_udp.py b/examples/pytorch/dependency-parsing/utils_udp.py index f315e95d29..0f2d3e4849 100644 --- a/examples/pytorch/dependency-parsing/utils_udp.py +++ b/examples/pytorch/dependency-parsing/utils_udp.py @@ -210,7 +210,7 @@ def __init__( def evaluate( self, eval_dataset: Optional[Dataset] = None, - prediction_loss_only: Optional[bool] = None, + ignore_keys: Optional[List[str]] = None, metric_key_prefix: str = "eval", ) -> Dict[str, float]: """ @@ -232,7 +232,7 @@ def evaluate( output = self._prediction_loop( eval_dataloader, description="Evaluation", - prediction_loss_only=prediction_loss_only, + prediction_loss_only=True if self.compute_metrics is None else None, metric_key_prefix=metric_key_prefix, ) diff --git a/examples/pytorch/text-classification/run_glue.py b/examples/pytorch/text-classification/run_glue.py index 629ef0b4c4..cc9fe3a80e 100644 --- a/examples/pytorch/text-classification/run_glue.py +++ b/examples/pytorch/text-classification/run_glue.py @@ -381,7 +381,7 @@ def main(): model.add_classification_head( data_args.task_name or "glue", num_labels=num_labels, - id2label={i: v for i, v in enumerate(label_list)} if num_labels > 0 else None, + id2label={i: v for i, v in enumerate(label_list)} if not is_regression else None, ) # Setup adapters