fix: duplicate model names test in pipeline coder & runner (#763)

* add model name duplicate test in pipeline costeer

* fix ci
This commit is contained in:
XianBW
2025-04-07 19:06:42 +08:00
committed by GitHub
parent 0dcc990bd4
commit dee11fbd9c
3 changed files with 16 additions and 8 deletions
@@ -71,11 +71,14 @@ class PipelineCoSTEEREvaluator(CoSTEEREvaluator):
model_set_in_scores = set(score_df.index)
# Check model names (index)
if "ensemble" not in model_set_in_scores:
score_check_text += (
f"\n[Error] The score dataframe doesn't contain the ensemble model.\nscore_df is:\n{score_df}"
)
if not score_df.index.is_unique:
score_check_text += "\n[Error] The score dataframe contains duplicate model names."
score_ret_code = 1
if "ensemble" not in model_set_in_scores:
score_check_text += "\n[Error] The score dataframe doesn't contain the ensemble model."
score_ret_code = 1
if score_ret_code != 0:
score_check_text += f"The score_df is:\n{score_df}"
# Check metric name (columns)
if score_df.columns.tolist() != [self.scen.metric_name]:
+2 -2
View File
@@ -435,8 +435,8 @@ def summarize_data():
df.loc[loop, "End Time (UTC+8)"] = state.times[loop][-1].end + timedelta(hours=8)
if "running" in loop_data and "no_tag" in loop_data["running"]:
try:
df.loc[loop, "Running Score (valid)"] = round(
loop_data["running"]["no_tag"].result.loc["ensemble"].iloc[0], 5
df.loc[loop, "Running Score (valid)"] = str(
round(loop_data["running"]["no_tag"].result.loc["ensemble"].iloc[0], 5)
)
except:
df.loc[loop, "Running Score (valid)"] = ""
@@ -67,9 +67,14 @@ class DSCoSTEERCoSTEEREvaluator(CoSTEEREvaluator):
# Check model names (index)
# in Pipeline task, we only check ensemble in scores.csv
if DS_RD_SETTING.coder_on_whole_pipeline:
if "ensemble" not in model_set_in_scores:
score_check_text += f"\n[Error] The score dataframe doesn't contain the ensemble model.\nscore_df is:\n{score_df}"
if not score_df.index.is_unique:
score_check_text += "\n[Error] The score dataframe contains duplicate model names."
score_ret_code = 1
if "ensemble" not in model_set_in_scores:
score_check_text += "\n[Error] The score dataframe doesn't contain the ensemble model."
score_ret_code = 1
if score_ret_code != 0:
score_check_text += f"The score_df is:\n{score_df}"
else:
if model_set_in_scores != model_set_in_folder.union({"ensemble"}):
score_check_text += f"\n[Error] The scores dataframe does not contain the correct model names as index.\ncorrect model names are: {model_set_in_folder.union({'ensemble'})}\nscore_df is:\n{score_df}"