From b62ac4d240fb4d6d1b4040faf0ec168577b9f093 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:21:19 -0400 Subject: [PATCH] Fix example test and test_fetcher for examples (#16478) --- examples/pytorch/text-classification/run_glue.py | 4 ++-- utils/tests_fetcher.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pytorch/text-classification/run_glue.py b/examples/pytorch/text-classification/run_glue.py index 92c4d2b379..5f7ba4ca48 100755 --- a/examples/pytorch/text-classification/run_glue.py +++ b/examples/pytorch/text-classification/run_glue.py @@ -519,11 +519,11 @@ def main(): if task == "mnli-mm": metrics = {k + "_mm": v for k, v in metrics.items()} - if "mnli" in task: + if task is not None and "mnli" in task: combined.update(metrics) trainer.log_metrics("eval", metrics) - trainer.save_metrics("eval", combined if "mnli" in task else metrics) + trainer.save_metrics("eval", combined if task is not None and "mnli" in task else metrics) if training_args.do_predict: logger.info("*** Predict ***") diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index dae4fa4218..5ad7b4b1f7 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -465,9 +465,9 @@ def infer_tests_to_run(output_file, diff_with_last_commit=False, filters=None): test_files_to_run.append(f) # Example files are tested separately elif f.startswith("examples/pytorch"): - test_files_to_run.append("examples/pytorch/test_examples.py") + test_files_to_run.append("examples/pytorch/test_pytorch_examples.py") elif f.startswith("examples/flax"): - test_files_to_run.append("examples/flax/test_examples.py") + test_files_to_run.append("examples/flax/test_flax_examples.py") else: new_tests = module_to_test_file(f) if new_tests is not None: