Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
infwinston committed Oct 14, 2024
1 parent a7c99d1 commit 3a8ea6d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fastchat/serve/monitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def arena_hard_process(leaderboard_table_file, filepath):


def get_arena_table(
arena_df, model_table_df, arena_subset_df=None, hidden_models=None, use_delta=True
arena_df, model_table_df, arena_subset_df=None, hidden_models=None, is_overall=False
):
arena_df = arena_df.sort_values(
by=["final_ranking", "rating"], ascending=[True, False]
Expand All @@ -297,18 +297,22 @@ def get_arena_table(
arena_df["final_ranking"] = recompute_final_ranking(arena_df)

if arena_subset_df is not None:
if is_overall:
# swap arena_subset_df and arena_df for style control
arena_subset_df, arena_df = arena_df, arena_subset_df

arena_subset_df = arena_subset_df[arena_subset_df.index.isin(arena_df.index)]
arena_subset_df = arena_subset_df.sort_values(by=["rating"], ascending=False)
arena_subset_df["final_ranking"] = recompute_final_ranking(arena_subset_df)

arena_df = arena_df[arena_df.index.isin(arena_subset_df.index)]
arena_df["final_ranking"] = recompute_final_ranking(arena_df)
arena_df.loc[:, "final_ranking"] = recompute_final_ranking(arena_df)

arena_df = arena_subset_df.join(
arena_df["final_ranking"], rsuffix="_global", how="inner"
)

if use_delta:
if not is_overall:
arena_df["ranking_difference"] = (
arena_df["final_ranking_global"] - arena_df["final_ranking"]
)
Expand Down Expand Up @@ -497,7 +501,7 @@ def update_leaderboard_and_plots(category, filters):
if len(filters) > 0 and "Show Deprecate" in filters
else deprecated_model_name
),
use_delta=category != "Overall",
is_overall=category == "Overall",
)
if category != "Overall":
arena_values = update_leaderboard_df(arena_values)
Expand Down Expand Up @@ -586,7 +590,7 @@ def update_leaderboard_and_plots(category, filters):
model_table_df,
hidden_models=deprecated_model_name,
arena_subset_df=arena_overall_sc_df,
use_delta=False,
is_overall=True,
)

md = make_arena_leaderboard_md(arena_df, last_updated_time, vision=vision)
Expand Down

0 comments on commit 3a8ea6d

Please sign in to comment.