Spaces:
Runtime error
Runtime error
Commit
β’
0bb31bc
1
Parent(s):
f25b0d0
fix
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import matplotlib.pyplot as plt
|
|
5 |
import bar_chart_race as bcr
|
6 |
import pandas as pd
|
7 |
import gradio as gr
|
|
|
8 |
import os
|
9 |
|
10 |
|
@@ -15,10 +16,15 @@ def restart_space():
|
|
15 |
)
|
16 |
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
)
|
|
|
|
|
|
|
|
|
|
|
22 |
# resample for ever model to a daily frequency
|
23 |
open_llm_race_dataset["date"] = pd.to_datetime(open_llm_race_dataset["date"])
|
24 |
open_llm_race_dataset = (
|
@@ -44,7 +50,7 @@ open_llm_race_dataset["type"] = open_llm_race_dataset["model"].apply(
|
|
44 |
)
|
45 |
|
46 |
|
47 |
-
def get_bar_chart(model_type: str):
|
48 |
fig, ax = plt.subplots(figsize=(12, 6))
|
49 |
ax.set_xlim(0, 100)
|
50 |
subset = open_llm_race_dataset[open_llm_race_dataset["type"] == model_type]
|
@@ -68,16 +74,15 @@ def get_bar_chart(model_type: str):
|
|
68 |
demo = gr.Blocks()
|
69 |
with demo:
|
70 |
# leaderboard title
|
71 |
-
gr.HTML("<h1>
|
72 |
|
73 |
with gr.Tabs():
|
74 |
with gr.TabItem(label="Pretrained Models"):
|
75 |
get_bar_chart(ModelType.PT.name)
|
76 |
with gr.TabItem(label="Instructions Finetuend Models"):
|
77 |
get_bar_chart(ModelType.IFT.name)
|
78 |
-
|
79 |
with gr.TabItem(label="RLHF Models"):
|
80 |
-
get_bar_chart(ModelType.RL.name)
|
81 |
|
82 |
|
83 |
# Restart space every hour
|
|
|
5 |
import bar_chart_race as bcr
|
6 |
import pandas as pd
|
7 |
import gradio as gr
|
8 |
+
import requests
|
9 |
import os
|
10 |
|
11 |
|
|
|
16 |
)
|
17 |
|
18 |
|
19 |
+
if not os.path.exists("open-llm-race-dataset.csv"):
|
20 |
+
file = requests.get(
|
21 |
+
"https://huggingface.co/datasets/IlyasMoutawwakil/open-llm-race-dataset/resolve/main/open-llm-race-dataset.csv"
|
22 |
+
).content
|
23 |
+
with open("open-llm-race-dataset.csv") as f:
|
24 |
+
f.write(file)
|
25 |
+
|
26 |
+
open_llm_race_dataset = pd.read_csv("open-llm-race-dataset.csv")
|
27 |
+
|
28 |
# resample for ever model to a daily frequency
|
29 |
open_llm_race_dataset["date"] = pd.to_datetime(open_llm_race_dataset["date"])
|
30 |
open_llm_race_dataset = (
|
|
|
50 |
)
|
51 |
|
52 |
|
53 |
+
def get_bar_chart(model_type: str, top_n: int = 10):
|
54 |
fig, ax = plt.subplots(figsize=(12, 6))
|
55 |
ax.set_xlim(0, 100)
|
56 |
subset = open_llm_race_dataset[open_llm_race_dataset["type"] == model_type]
|
|
|
74 |
demo = gr.Blocks()
|
75 |
with demo:
|
76 |
# leaderboard title
|
77 |
+
gr.HTML("<center><h1>LLM Bar Race ππββοΈ</h1></center>")
|
78 |
|
79 |
with gr.Tabs():
|
80 |
with gr.TabItem(label="Pretrained Models"):
|
81 |
get_bar_chart(ModelType.PT.name)
|
82 |
with gr.TabItem(label="Instructions Finetuend Models"):
|
83 |
get_bar_chart(ModelType.IFT.name)
|
|
|
84 |
with gr.TabItem(label="RLHF Models"):
|
85 |
+
get_bar_chart(ModelType.RL.name, top_n=4)
|
86 |
|
87 |
|
88 |
# Restart space every hour
|