Refactor the function get_results (#20999)

This commit is contained in:
milyiyo 2023-01-04 12:05:36 -05:00 committed by GitHub
parent 926452298d
commit 3b309818e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)