Spaces:
Running
Running
Create directory if it doesn't exists
Browse files
eval.py
CHANGED
@@ -7,6 +7,7 @@ import torch
|
|
7 |
import json
|
8 |
import argparse
|
9 |
import numpy as np
|
|
|
10 |
|
11 |
|
12 |
def get_dataloader(pred_path: str, gold_path: str, batch_size: int):
|
@@ -100,6 +101,8 @@ def eval_files(
|
|
100 |
result_dictionary["bert_score"] = inference()
|
101 |
|
102 |
if output_path is not None:
|
|
|
|
|
103 |
with open(output_path, "w") as f:
|
104 |
json.dump(result_dictionary, f, indent=4)
|
105 |
|
|
|
7 |
import json
|
8 |
import argparse
|
9 |
import numpy as np
|
10 |
+
import os
|
11 |
|
12 |
|
13 |
def get_dataloader(pred_path: str, gold_path: str, batch_size: int):
|
|
|
101 |
result_dictionary["bert_score"] = inference()
|
102 |
|
103 |
if output_path is not None:
|
104 |
+
if not os.path.exists(os.path.dirname(output_path)):
|
105 |
+
os.makedirs(os.path.dirname(output_path))
|
106 |
with open(output_path, "w") as f:
|
107 |
json.dump(result_dictionary, f, indent=4)
|
108 |
|