Spaces:
Sleeping
Sleeping
Commit
Β·
b32e3ed
1
Parent(s):
40122c3
update name and envs
Browse files- app.py +24 -8
- src/about.py +5 -4
- src/envs.py +8 -6
app.py
CHANGED
|
@@ -22,7 +22,7 @@ from src.display.utils import (
|
|
| 22 |
ModelType,
|
| 23 |
fields,
|
| 24 |
WeightType,
|
| 25 |
-
Precision
|
| 26 |
)
|
| 27 |
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
| 28 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
|
@@ -32,18 +32,29 @@ from src.submission.submit import add_new_eval
|
|
| 32 |
def restart_space():
|
| 33 |
API.restart_space(repo_id=REPO_ID)
|
| 34 |
|
|
|
|
| 35 |
### Space initialisation
|
| 36 |
try:
|
| 37 |
print(EVAL_REQUESTS_PATH)
|
| 38 |
snapshot_download(
|
| 39 |
-
repo_id=QUEUE_REPO,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
)
|
| 41 |
except Exception:
|
| 42 |
restart_space()
|
| 43 |
try:
|
| 44 |
print(EVAL_RESULTS_PATH)
|
| 45 |
snapshot_download(
|
| 46 |
-
repo_id=RESULTS_REPO,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
)
|
| 48 |
except Exception:
|
| 49 |
restart_space()
|
|
@@ -57,6 +68,7 @@ LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS,
|
|
| 57 |
pending_eval_queue_df,
|
| 58 |
) = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
| 59 |
|
|
|
|
| 60 |
def init_leaderboard(dataframe):
|
| 61 |
if dataframe is None or dataframe.empty:
|
| 62 |
raise ValueError("Leaderboard DataFrame is empty or None.")
|
|
@@ -80,9 +92,7 @@ def init_leaderboard(dataframe):
|
|
| 80 |
max=150,
|
| 81 |
label="Select the number of parameters (B)",
|
| 82 |
),
|
| 83 |
-
ColumnFilter(
|
| 84 |
-
AutoEvalColumn.still_on_hub.name, type="boolean", label="Deleted/incomplete", default=True
|
| 85 |
-
),
|
| 86 |
],
|
| 87 |
bool_checkboxgroup_label="Hide models",
|
| 88 |
interactive=False,
|
|
@@ -95,7 +105,13 @@ with demo:
|
|
| 95 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
| 96 |
|
| 97 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 98 |
-
with gr.TabItem("π
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
| 100 |
|
| 101 |
with gr.TabItem("π About", elem_id="llm-benchmark-tab-table", id=2):
|
|
@@ -201,4 +217,4 @@ with demo:
|
|
| 201 |
scheduler = BackgroundScheduler()
|
| 202 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 203 |
scheduler.start()
|
| 204 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
|
| 22 |
ModelType,
|
| 23 |
fields,
|
| 24 |
WeightType,
|
| 25 |
+
Precision,
|
| 26 |
)
|
| 27 |
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
| 28 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
|
|
|
| 32 |
def restart_space():
|
| 33 |
API.restart_space(repo_id=REPO_ID)
|
| 34 |
|
| 35 |
+
|
| 36 |
### Space initialisation
|
| 37 |
try:
|
| 38 |
print(EVAL_REQUESTS_PATH)
|
| 39 |
snapshot_download(
|
| 40 |
+
repo_id=QUEUE_REPO,
|
| 41 |
+
local_dir=EVAL_REQUESTS_PATH,
|
| 42 |
+
repo_type="dataset",
|
| 43 |
+
tqdm_class=None,
|
| 44 |
+
etag_timeout=30,
|
| 45 |
+
token=TOKEN,
|
| 46 |
)
|
| 47 |
except Exception:
|
| 48 |
restart_space()
|
| 49 |
try:
|
| 50 |
print(EVAL_RESULTS_PATH)
|
| 51 |
snapshot_download(
|
| 52 |
+
repo_id=RESULTS_REPO,
|
| 53 |
+
local_dir=EVAL_RESULTS_PATH,
|
| 54 |
+
repo_type="dataset",
|
| 55 |
+
tqdm_class=None,
|
| 56 |
+
etag_timeout=30,
|
| 57 |
+
token=TOKEN,
|
| 58 |
)
|
| 59 |
except Exception:
|
| 60 |
restart_space()
|
|
|
|
| 68 |
pending_eval_queue_df,
|
| 69 |
) = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
| 70 |
|
| 71 |
+
|
| 72 |
def init_leaderboard(dataframe):
|
| 73 |
if dataframe is None or dataframe.empty:
|
| 74 |
raise ValueError("Leaderboard DataFrame is empty or None.")
|
|
|
|
| 92 |
max=150,
|
| 93 |
label="Select the number of parameters (B)",
|
| 94 |
),
|
| 95 |
+
ColumnFilter(AutoEvalColumn.still_on_hub.name, type="boolean", label="Deleted/incomplete", default=True),
|
|
|
|
|
|
|
| 96 |
],
|
| 97 |
bool_checkboxgroup_label="Hide models",
|
| 98 |
interactive=False,
|
|
|
|
| 105 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
| 106 |
|
| 107 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 108 |
+
with gr.TabItem("π
Position Bias Analyzer", elem_id="llm-benchmark-tab-table", id=0):
|
| 109 |
+
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
| 110 |
+
|
| 111 |
+
with gr.TabItem("π
LLMBar Natural", elem_id="llm-benchmark-tab-table", id=4):
|
| 112 |
+
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
| 113 |
+
|
| 114 |
+
with gr.TabItem("π
LLMBar Adversarial (Manual)", elem_id="llm-benchmark-tab-table", id=5):
|
| 115 |
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
| 116 |
|
| 117 |
with gr.TabItem("π About", elem_id="llm-benchmark-tab-table", id=2):
|
|
|
|
| 217 |
scheduler = BackgroundScheduler()
|
| 218 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 219 |
scheduler.start()
|
| 220 |
+
demo.queue(default_concurrency_limit=40).launch()
|
src/about.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from dataclasses import dataclass
|
| 2 |
from enum import Enum
|
| 3 |
|
|
|
|
| 4 |
@dataclass
|
| 5 |
class Task:
|
| 6 |
benchmark: str
|
|
@@ -11,17 +12,17 @@ class Task:
|
|
| 11 |
# Select your tasks here
|
| 12 |
# ---------------------------------------------------
|
| 13 |
class Tasks(Enum):
|
| 14 |
-
# task_key in the json file, metric_key in the json file, name to display in the leaderboard
|
| 15 |
task0 = Task("anli_r1", "acc", "ANLI")
|
| 16 |
task1 = Task("logiqa", "acc_norm", "LogiQA")
|
| 17 |
|
| 18 |
-
NUM_FEWSHOT = 0 # Change with your few shot
|
| 19 |
-
# ---------------------------------------------------
|
| 20 |
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
# Your leaderboard name
|
| 24 |
-
TITLE = """<h1 align="center" id="space-title">
|
| 25 |
|
| 26 |
# What does your leaderboard evaluate?
|
| 27 |
INTRODUCTION_TEXT = """
|
|
|
|
| 1 |
from dataclasses import dataclass
|
| 2 |
from enum import Enum
|
| 3 |
|
| 4 |
+
|
| 5 |
@dataclass
|
| 6 |
class Task:
|
| 7 |
benchmark: str
|
|
|
|
| 12 |
# Select your tasks here
|
| 13 |
# ---------------------------------------------------
|
| 14 |
class Tasks(Enum):
|
| 15 |
+
# task_key in the json file, metric_key in the json file, name to display in the leaderboard
|
| 16 |
task0 = Task("anli_r1", "acc", "ANLI")
|
| 17 |
task1 = Task("logiqa", "acc_norm", "LogiQA")
|
| 18 |
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
NUM_FEWSHOT = 0 # Change with your few shot
|
| 21 |
+
# ---------------------------------------------------
|
| 22 |
|
| 23 |
|
| 24 |
# Your leaderboard name
|
| 25 |
+
TITLE = """<h1 align="center" id="space-title">LLM as Judge Eval</h1>"""
|
| 26 |
|
| 27 |
# What does your leaderboard evaluate?
|
| 28 |
INTRODUCTION_TEXT = """
|
src/envs.py
CHANGED
|
@@ -4,17 +4,19 @@ from huggingface_hub import HfApi
|
|
| 4 |
|
| 5 |
# Info to change for your repository
|
| 6 |
# ----------------------------------
|
| 7 |
-
TOKEN = os.environ.get("HF_TOKEN")
|
| 8 |
|
| 9 |
-
OWNER =
|
|
|
|
|
|
|
| 10 |
# ----------------------------------
|
| 11 |
|
| 12 |
-
REPO_ID = f"{OWNER}/
|
| 13 |
-
QUEUE_REPO = f"{OWNER}/
|
| 14 |
-
RESULTS_REPO = f"{OWNER}/
|
| 15 |
|
| 16 |
# If you setup a cache later, just change HF_HOME
|
| 17 |
-
CACHE_PATH=os.getenv("HF_HOME", ".")
|
| 18 |
|
| 19 |
# Local caches
|
| 20 |
EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
|
|
|
|
| 4 |
|
| 5 |
# Info to change for your repository
|
| 6 |
# ----------------------------------
|
| 7 |
+
TOKEN = os.environ.get("HF_TOKEN") # A read/write token for your org
|
| 8 |
|
| 9 |
+
OWNER = (
|
| 10 |
+
"CEIA-RL" # Change to your org - don't forget to create a results and request dataset, with the correct format!
|
| 11 |
+
)
|
| 12 |
# ----------------------------------
|
| 13 |
|
| 14 |
+
REPO_ID = f"{OWNER}/LLMasJudgeEval"
|
| 15 |
+
QUEUE_REPO = f"{OWNER}/judge_requests"
|
| 16 |
+
RESULTS_REPO = f"{OWNER}/judge_results"
|
| 17 |
|
| 18 |
# If you setup a cache later, just change HF_HOME
|
| 19 |
+
CACHE_PATH = os.getenv("HF_HOME", ".")
|
| 20 |
|
| 21 |
# Local caches
|
| 22 |
EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
|