From 3b309818e794cf6ff7fa79f34ea3e7b2386156da Mon Sep 17 00:00:00 2001 From: milyiyo Date: Wed, 4 Jan 2023 12:05:36 -0500 Subject: [PATCH] Refactor the function get_results (#20999) --- examples/flax/test_flax_examples.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/flax/test_flax_examples.py b/examples/flax/test_flax_examples.py index ffb1a4fc249..2fc2dcc16ad 100644 --- a/examples/flax/test_flax_examples.py +++ b/examples/flax/test_flax_examples.py @@ -60,14 +60,11 @@ def get_setup_file(): def get_results(output_dir, split="eval"): - results = {} path = os.path.join(output_dir, f"{split}_results.json") if os.path.exists(path): with open(path, "r") as f: - results = json.load(f) - else: - raise ValueError(f"can't find {path}") - return results + return json.load(f) + raise ValueError(f"can't find {path}") stream_handler = logging.StreamHandler(sys.stdout)