Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Fix different results filenames locally and in the Hub
#19
by
albertvillanova
HF staff
- opened
src/backend/run_eval_suite_harness.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import json
|
2 |
import logging
|
3 |
-
import os
|
4 |
from datetime import datetime
|
|
|
5 |
from typing import Union
|
6 |
|
7 |
from lm_eval import evaluator, utils
|
@@ -72,16 +72,15 @@ def run_evaluation(
|
|
72 |
dumped = json.dumps(results, indent=2)
|
73 |
logger.info(dumped)
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
f.write(dumped)
|
79 |
|
80 |
logger.info(evaluator.make_table(results))
|
81 |
|
82 |
API.upload_file(
|
83 |
-
path_or_fileobj=
|
84 |
-
path_in_repo=
|
85 |
repo_id=results_repo,
|
86 |
repo_type="dataset",
|
87 |
)
|
|
|
1 |
import json
|
2 |
import logging
|
|
|
3 |
from datetime import datetime
|
4 |
+
from pathlib import Path
|
5 |
from typing import Union
|
6 |
|
7 |
from lm_eval import evaluator, utils
|
|
|
72 |
dumped = json.dumps(results, indent=2)
|
73 |
logger.info(dumped)
|
74 |
|
75 |
+
results_path = Path(local_dir, eval_request.model, f"results_{datetime.now()}.json")
|
76 |
+
results_path.parent.mkdir(exist_ok=True, parents=True)
|
77 |
+
results_path.write_text(dumped)
|
|
|
78 |
|
79 |
logger.info(evaluator.make_table(results))
|
80 |
|
81 |
API.upload_file(
|
82 |
+
path_or_fileobj=results_path,
|
83 |
+
path_in_repo=results_path.relative_to(local_dir).as_posix(),
|
84 |
repo_id=results_repo,
|
85 |
repo_type="dataset",
|
86 |
)
|