From 5f1491d3b366d19cc08832d09bcfe007a2643089 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Thu, 25 Mar 2021 20:28:17 +0800 Subject: [PATCH] run_glue_no_trainer: datasets -> raw_datasets (#10898) Use the correct variable (raw_datasets) instead of the module (datasets) where appropriate. --- examples/text-classification/run_glue_no_trainer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/text-classification/run_glue_no_trainer.py b/examples/text-classification/run_glue_no_trainer.py index 62700f2f93..f02fc0757c 100644 --- a/examples/text-classification/run_glue_no_trainer.py +++ b/examples/text-classification/run_glue_no_trainer.py @@ -222,13 +222,13 @@ def main(): num_labels = 1 else: # Trying to have good defaults here, don't hesitate to tweak to your needs. - is_regression = datasets["train"].features["label"].dtype in ["float32", "float64"] + is_regression = raw_datasets["train"].features["label"].dtype in ["float32", "float64"] if is_regression: num_labels = 1 else: # A useful fast method: # https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.unique - label_list = datasets["train"].unique("label") + label_list = raw_datasets["train"].unique("label") label_list.sort() # Let's sort it for determinism num_labels = len(label_list) @@ -249,7 +249,7 @@ def main(): sentence1_key, sentence2_key = task_to_keys[args.task_name] else: # Again, we try to have some nice defaults but don't hesitate to tweak to your use case. - non_label_column_names = [name for name in datasets["train"].column_names if name != "label"] + non_label_column_names = [name for name in raw_datasets["train"].column_names if name != "label"] if "sentence1" in non_label_column_names and "sentence2" in non_label_column_names: sentence1_key, sentence2_key = "sentence1", "sentence2" else: