Skip to content

Commit 21605b5

Browse files
authored
chore: overwrite sota exp stat in summary page (#1146)
* overwrite sota exp stat in summary page * remove unused import
1 parent fe762cd commit 21605b5

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

rdagent/log/mle_summary.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,21 @@
2424
def save_grade_info(log_trace_path: Path):
2525
test_eval = get_test_eval()
2626

27-
is_mle = isinstance(test_eval, MLETestEval)
2827
trace_storage = FileStorage(log_trace_path)
29-
for msg in trace_storage.iter_msg():
30-
if "competition" in msg.tag:
31-
competition = msg.content
28+
for msg in trace_storage.iter_msg(tag="competition"):
29+
competition = msg.content
3230

33-
if "running" in msg.tag:
34-
if isinstance(msg.content, DSExperiment):
35-
# TODO: mle_score.txt is not a general name now.
36-
# Please use a more general name like test_score.txt
37-
try:
38-
mle_score_str = test_eval.eval(competition, msg.content.experiment_workspace)
39-
trace_storage.log(
40-
mle_score_str, tag=f"{msg.tag}.mle_score.pid", save_type="pkl", timestamp=msg.timestamp
41-
)
42-
except Exception as e:
43-
print(f"Error in {log_trace_path}: {e}", traceback.format_exc())
31+
for msg in trace_storage.iter_msg(tag="running"):
32+
if isinstance(msg.content, DSExperiment):
33+
# TODO: mle_score.txt is not a general name now.
34+
# Please use a more general name like test_score.txt
35+
try:
36+
mle_score_str = test_eval.eval(competition, msg.content.experiment_workspace)
37+
trace_storage.log(
38+
mle_score_str, tag=f"{msg.tag}.mle_score.pid", save_type="pkl", timestamp=msg.timestamp
39+
)
40+
except Exception as e:
41+
print(f"Error in {log_trace_path}: {e}", traceback.format_exc())
4442

4543

4644
def save_all_grade_info(log_folder: str | Path) -> None:

rdagent/log/ui/utils.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,22 @@ def get_summary_df(log_folders: list[str], hours: int | None = None) -> tuple[di
313313
v["coding_time"] = str(coding_time).split(".")[0]
314314
v["running_time"] = str(running_time).split(".")[0]
315315

316-
sota_exp, v["sota_loop_id_new"], sota_report, v["sota_exp_stat_new"] = get_sota_exp_stat(
316+
# overwrite sota_exp_stat in summary.pkl because it may not be correct in multi-trace
317+
_, _, sota_report, v["sota_exp_stat"] = get_sota_exp_stat(Path(lf) / k, to_submit=False)
318+
v["sota_exp_score"] = sota_report["score"] if sota_report else None
319+
320+
sota_exp_submit, v["sota_loop_id_new"], sota_submit_report, v["sota_exp_stat_new"] = get_sota_exp_stat(
317321
Path(lf) / k, to_submit=True
318322
)
319-
if sota_exp is not None:
323+
if sota_exp_submit is not None:
320324
try:
321-
sota_result = sota_exp.result
325+
sota_submit_result = sota_exp_submit.result
322326
except AttributeError: # Compatible with old versions
323-
sota_result = sota_exp.__dict__["result"]
324-
v["sota_exp_score_valid_new"] = sota_result.loc["ensemble"].iloc[0] if sota_result is not None else None
325-
v["sota_exp_score_new"] = sota_report["score"] if sota_report else None
327+
sota_submit_result = sota_exp_submit.__dict__["result"]
328+
v["sota_exp_score_valid_new"] = (
329+
sota_submit_result.loc["ensemble"].iloc[0] if sota_submit_result is not None else None
330+
)
331+
v["sota_exp_score_new"] = sota_submit_report["score"] if sota_submit_report else None
326332
# change experiment name
327333
if "amlt" in lf:
328334
summary[f"{lf[lf.rfind('amlt')+5:].split('/')[0]} - {k}"] = v

0 commit comments

Comments
 (0)