File size: 3,435 Bytes
54fdeab 845c238 54fdeab 582fcfe 54fdeab d779abf 62afa83 54fdeab 99b47fb 9f3376e 99b47fb 530329e 845c238 582fcfe c4887da 50c626b 530329e 50c626b 2cd88e3 17c1bbe 54fdeab 17c1bbe 54fdeab 17c1bbe 54fdeab 17c1bbe a8e2f0c 5ab1e76 54fdeab e72de6c 54fdeab 17c1bbe e72de6c 54fdeab 17c1bbe a8e2f0c 845c238 54fdeab e72de6c 54fdeab 17c1bbe 54fdeab 17c1bbe 54fdeab 75afdc2 54fdeab 75afdc2 7552e97 54fdeab 75afdc2 54fdeab 75afdc2 54fdeab 2c3fe6c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
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_markdown_format_for_columns, 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 Challenge", "MMLU Pro", "GSM8k Persian", "Multiple Choice Persian"]
columns_to_average = ["Part Multiple Choice", "ARC Easy", "ARC Challenge", "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_markdown_format_for_columns(df=base_df, model_column_name="Model")
persian_df = apply_markdown_format_for_columns(df=persian_df, model_column_name="Model")
columns_data_type = ["markdown" for i in range(len(persian_df.columns))]
# "str", "number", "bool", "date", "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 PartAI/Dorna-Llama3-8B-Instruct")
contact_email = gr.Textbox(label="Contact E-Mail")
section = gr.Radio(choices=["Persian", "Base"], label="Section")
license = gr.Dropdown(choices=["llama2", "llama3", "llama3.1", "llama3.2", "cc-by-nc-4.0", "mit", "apache-2.0", "gemma", "cc-by-nc-sa-4.0", "other"], label="License")
submit_btn = gr.Button("Submit")
submit_btn.click(submit, inputs=[model_name, model_id, contact_email, section, license], outputs=[])
gr.Markdown("""
Please find more information about Part DP AI on [partdp.ai](https://partdp.ai)""")
if __name__ == "__main__":
demo.launch()
|