Unverified Commit 5f1491d3 authored by Jethro Kuan's avatar Jethro Kuan Committed by GitHub
Browse files

run_glue_no_trainer: datasets -> raw_datasets (#10898)

Use the correct variable (raw_datasets) instead of the module (datasets)
where appropriate.
parent 1c06240e
...@@ -222,13 +222,13 @@ def main(): ...@@ -222,13 +222,13 @@ def main():
num_labels = 1 num_labels = 1
else: else:
# Trying to have good defaults here, don't hesitate to tweak to your needs. # 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: if is_regression:
num_labels = 1 num_labels = 1
else: else:
# A useful fast method: # A useful fast method:
# https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.unique # 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 label_list.sort() # Let's sort it for determinism
num_labels = len(label_list) num_labels = len(label_list)
...@@ -249,7 +249,7 @@ def main(): ...@@ -249,7 +249,7 @@ def main():
sentence1_key, sentence2_key = task_to_keys[args.task_name] sentence1_key, sentence2_key = task_to_keys[args.task_name]
else: else:
# Again, we try to have some nice defaults but don't hesitate to tweak to your use case. # 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: if "sentence1" in non_label_column_names and "sentence2" in non_label_column_names:
sentence1_key, sentence2_key = "sentence1", "sentence2" sentence1_key, sentence2_key = "sentence1", "sentence2"
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment