mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-15 10:38:23 +06:00
Refactor the function get_results (#20999)
This commit is contained in:
parent
926452298d
commit
3b309818e7
@ -60,14 +60,11 @@ def get_setup_file():
|
|||||||
|
|
||||||
|
|
||||||
def get_results(output_dir, split="eval"):
|
def get_results(output_dir, split="eval"):
|
||||||
results = {}
|
|
||||||
path = os.path.join(output_dir, f"{split}_results.json")
|
path = os.path.join(output_dir, f"{split}_results.json")
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
with open(path, "r") as f:
|
with open(path, "r") as f:
|
||||||
results = json.load(f)
|
return json.load(f)
|
||||||
else:
|
|
||||||
raise ValueError(f"can't find {path}")
|
raise ValueError(f"can't find {path}")
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
stream_handler = logging.StreamHandler(sys.stdout)
|
stream_handler = logging.StreamHandler(sys.stdout)
|
||||||
|
Loading…
Reference in New Issue
Block a user