tohid.abedini
[Add] about
2c3fe6c
raw
history blame
3.93 kB
import gradio as gr
from gradio_leaderboard import Leaderboard, SelectColumns, ColumnFilter
from pathlib import Path
from utils import LLM_BENCHMARKS_ABOUT_TEXT, LLM_BENCHMARKS_SUBMIT_TEXT, custom_css, jsonl_to_dataframe, add_average_column_to_df, apply_clickable_model, submit
abs_path = Path(__file__).parent
# Any pandas-compatible data
persian_df = jsonl_to_dataframe(str(abs_path / "leaderboard_persian.jsonl"))
base_df = jsonl_to_dataframe(str(abs_path / "leaderboard_base.jsonl"))
all_columns = ["Model", "Average ⬆️", "Precision", "#Params (B)", "Part Multiple Choice", "ARC Easy", "ARC Challenging", "MMLU Pro", "GSM8k Persian", "Multiple Choice Persian"]
columns_to_average = ["Part Multiple Choice", "ARC Easy", "ARC Challenging", "MMLU Pro", "GSM8k Persian", "Multiple Choice Persian"]
base_df = add_average_column_to_df(base_df, columns_to_average, index=3)
persian_df = add_average_column_to_df(persian_df, columns_to_average, index=3)
base_df = apply_clickable_model(df=base_df, column_name="Model")
persian_df = apply_clickable_model(df=persian_df, column_name="Model")
columns_data_type = ["str" for i in range(len(persian_df.columns))]
# "str", "number", "bool", "date", "markdown"
# set model name link as markdown because of hyperlink selection
columns_data_type[0] = "markdown"
with gr.Blocks(css=custom_css) as demo:
gr.Markdown("""
# Part LLM Leaderboard
""")
with gr.Tab("πŸŽ–οΈ Persian Leaderboard"):
gr.Markdown("""## Persian LLM Leaderboard
Evaluating Persian Fine-Tuned models
""")
Leaderboard(
value=persian_df,
datatype=columns_data_type,
select_columns=SelectColumns(
default_selection=all_columns,
cant_deselect=["Model"],
label="Select Columns to Show",
),
search_columns=["model_name_for_query"],
hide_columns=["model_name_for_query",],
filter_columns=["Precision", "#Params (B)"],
)
with gr.Tab("πŸ₯‡ Base Leaderboard"):
gr.Markdown("""## Base LLM Leaderboard
Evaluating Base Models
""")
Leaderboard(
value=base_df,
datatype= columns_data_type,
select_columns=SelectColumns(
default_selection=all_columns,
cant_deselect=["Model"],
label="Select Columns to Show",
),
search_columns=["model_name_for_query"],
hide_columns=["model_name_for_query",],
filter_columns=["Precision", "#Params (B)"],
)
with gr.TabItem("πŸ“ About"):
gr.Markdown(LLM_BENCHMARKS_ABOUT_TEXT)
with gr.Tab("βœ‰οΈ Submit"):
gr.Markdown(LLM_BENCHMARKS_SUBMIT_TEXT)
model_name = gr.Textbox(label="Model name")
model_id = gr.Textbox(label="username/space e.g mlsb/alphafold3")
contact_email = gr.Textbox(label="Contact E-Mail")
challenge = gr.Radio(choices=["Persian", "Base"],label="Challenge")
gr.Markdown("Either give a submission id if you submitted to the MLSB workshop or provide a link to the preprint/paper describing the method.")
with gr.Row():
submission_id = gr.Textbox(label="Submission ID on CMT")
paper_link = gr.Textbox(label="Preprint or Paper link")
architecture = gr.Dropdown(choices=["GNN", "CNN","Diffusion Model", "Physics-based", "Other"],label="Model architecture")
license = gr.Dropdown(choices=["mit", "apache-2.0", "gplv2", "gplv3", "lgpl", "mozilla", "bsd", "other"],label="License")
submit_btn = gr.Button("Submit")
submit_btn.click(submit, inputs=[model_name, model_id, contact_email, challenge, submission_id, paper_link, architecture, license], outputs=[])
gr.Markdown("""
Please find more information about the challenges on [mlsb.io/#challenge](https://mlsb.io/#challenge)""")
if __name__ == "__main__":
demo.launch()