Spaces:
Sleeping
Sleeping
Add styling
Browse files- README.md +2 -2
- app.py +64 -30
- styles.css +75 -0
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
title: "Evaluating LLMs on Athena: a practical introduction to Slurm"
|
| 3 |
emoji: 💻
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.30.0
|
| 8 |
python_version: '3.12'
|
|
|
|
| 1 |
---
|
| 2 |
title: "Evaluating LLMs on Athena: a practical introduction to Slurm"
|
| 3 |
emoji: 💻
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.30.0
|
| 8 |
python_version: '3.12'
|
app.py
CHANGED
|
@@ -139,18 +139,18 @@ def score(samples, benchmark):
|
|
| 139 |
|
| 140 |
|
| 141 |
def tables(results, categories):
|
| 142 |
-
headers = ["Login", "
|
| 143 |
|
| 144 |
def row(result):
|
| 145 |
-
return [result["login"],
|
| 146 |
round(100 * result["by_category"][category]["accuracy"], 2) for category in categories
|
| 147 |
-
]
|
| 148 |
|
| 149 |
recent = sorted(results, key=lambda result: result["created_at"], reverse=True)[:RECENT_LIMIT]
|
| 150 |
submissions = gr.update(
|
| 151 |
-
headers=["Submitted (UTC)"
|
| 152 |
value=[
|
| 153 |
-
[result["created_at"]]
|
| 154 |
+ [result["error_counts"][error] for error in ERROR_TYPES]
|
| 155 |
for result in recent
|
| 156 |
],
|
|
@@ -229,28 +229,56 @@ def submit(login, filepath):
|
|
| 229 |
return status + " Results are temporarily unavailable — click Refresh.", gr.skip(), gr.skip()
|
| 230 |
|
| 231 |
|
| 232 |
-
CSS = """
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
#
|
| 237 |
-
#
|
| 238 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
|
| 240 |
with gr.Blocks(title="Evaluating LLMs on Athena: a practical introduction to Slurm") as demo:
|
| 241 |
with gr.Column(elem_id="workshop"):
|
| 242 |
-
gr.
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
""", elem_id="intro")
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
| 254 |
gr.Markdown("""Upload the full benchmark. A prediction is correct if it matches the reference within **1e-6**
|
| 255 |
and has no evaluator error. **Accuracy = correct / all questions**, overall and per category.
|
| 256 |
|
|
@@ -271,16 +299,22 @@ over the prediction. Error columns show **counts of failed questions**, so corre
|
|
| 271 |
The saved `results.json` includes per-question outcomes, reference answers and absolute differences.
|
| 272 |
Both tabs show results for the current benchmark only.
|
| 273 |
""", elem_id="scoring")
|
| 274 |
-
with gr.
|
| 275 |
-
with gr.
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
outputs = [submissions_table, leaderboard_table]
|
| 281 |
send.click(submit, inputs=[login, upload], outputs=[status, *outputs], concurrency_limit=1)
|
| 282 |
refresh.click(refresh_tables, outputs=outputs)
|
| 283 |
demo.load(refresh_tables, outputs=outputs)
|
| 284 |
|
| 285 |
if __name__ == "__main__":
|
| 286 |
-
demo.queue().launch(css=CSS)
|
|
|
|
| 139 |
|
| 140 |
|
| 141 |
def tables(results, categories):
|
| 142 |
+
headers = ["Login", "Accuracy (%)"] + [f"{category} (%)" for category in categories] + ["Submission"]
|
| 143 |
|
| 144 |
def row(result):
|
| 145 |
+
return [result["login"], round(100 * result["accuracy"], 2)] + [
|
| 146 |
round(100 * result["by_category"][category]["accuracy"], 2) for category in categories
|
| 147 |
+
] + [result["submission_id"]]
|
| 148 |
|
| 149 |
recent = sorted(results, key=lambda result: result["created_at"], reverse=True)[:RECENT_LIMIT]
|
| 150 |
submissions = gr.update(
|
| 151 |
+
headers=headers + ["Submitted (UTC)", "Correct / total"] + list(ERROR_TYPES),
|
| 152 |
value=[
|
| 153 |
+
row(result) + [result["created_at"][:19].replace("T", " "), f"{result['correct']} / {result['total']}"]
|
| 154 |
+ [result["error_counts"][error] for error in ERROR_TYPES]
|
| 155 |
for result in recent
|
| 156 |
],
|
|
|
|
| 229 |
return status + " Results are temporarily unavailable — click Refresh.", gr.skip(), gr.skip()
|
| 230 |
|
| 231 |
|
| 232 |
+
CSS = Path(__file__).with_name("styles.css").read_text(encoding="utf-8")
|
| 233 |
+
THEME = gr.themes.Base(
|
| 234 |
+
primary_hue="teal", secondary_hue="purple", neutral_hue="slate",
|
| 235 |
+
).set(
|
| 236 |
+
body_background_fill="#f5f5fa", body_background_fill_dark="#19172e",
|
| 237 |
+
body_text_color="#2b2661", body_text_color_dark="#eeecfa",
|
| 238 |
+
body_text_color_subdued="#69667e", body_text_color_subdued_dark="#bab5d1",
|
| 239 |
+
block_background_fill="#ffffff", block_background_fill_dark="#24213d",
|
| 240 |
+
panel_background_fill="#ffffff", panel_background_fill_dark="#24213d",
|
| 241 |
+
block_border_color="#e4e2ee", block_border_color_dark="#403b5e",
|
| 242 |
+
input_background_fill="#fafafe", input_background_fill_dark="#19172e",
|
| 243 |
+
input_border_color="#d8d5e5", input_border_color_dark="#504969",
|
| 244 |
+
input_border_color_focus="#17bcaf", input_border_color_focus_dark="#17bcaf",
|
| 245 |
+
button_primary_background_fill="#17bcaf", button_primary_background_fill_dark="#17bcaf",
|
| 246 |
+
button_primary_background_fill_hover="#38cec2", button_primary_background_fill_hover_dark="#38cec2",
|
| 247 |
+
button_primary_text_color="#172943", button_primary_text_color_dark="#172943",
|
| 248 |
+
button_primary_text_color_hover="#172943", button_primary_text_color_hover_dark="#172943",
|
| 249 |
+
button_primary_border_color="#17bcaf", button_primary_border_color_dark="#17bcaf",
|
| 250 |
+
button_secondary_background_fill="#f3f0f8", button_secondary_background_fill_dark="#352c4e",
|
| 251 |
+
button_secondary_text_color="#59358c", button_secondary_text_color_dark="#e0cfef",
|
| 252 |
+
table_even_background_fill="#f8f7fc", table_even_background_fill_dark="#2b2746",
|
| 253 |
+
table_odd_background_fill="#ffffff", table_odd_background_fill_dark="#24213d",
|
| 254 |
+
table_border_color="#e4e2ee", table_border_color_dark="#403b5e",
|
| 255 |
+
table_row_focus="#e4f7f4", table_row_focus_dark="#234340",
|
| 256 |
+
link_text_color="#59358c", link_text_color_dark="#70dfd5",
|
| 257 |
+
)
|
| 258 |
|
| 259 |
with gr.Blocks(title="Evaluating LLMs on Athena: a practical introduction to Slurm") as demo:
|
| 260 |
with gr.Column(elem_id="workshop"):
|
| 261 |
+
gr.HTML("""<header class="workshop-hero">
|
| 262 |
+
<div class="hero-shapes" aria-hidden="true"><i></i><i></i><i></i></div>
|
| 263 |
+
<p class="eyebrow">MLinPL Tutorial · PLLuM</p>
|
| 264 |
+
<h1>Evaluating LLMs on Athena:<span>a practical introduction to Slurm</span></h1>
|
| 265 |
+
<p class="hero-note">Run an experiment. Evaluate your model. Compare the results.</p>
|
| 266 |
+
</header>""", elem_id="hero")
|
| 267 |
+
with gr.Column(elem_id="submit-panel"):
|
| 268 |
+
gr.Markdown("""## Submit your evaluation
|
| 269 |
+
Enter your assigned login and upload **samples.json** from a full benchmark evaluation.
|
| 270 |
+
|
| 271 |
+
`$SCRATCH/pllum-slurm-lab/evaluation/samples.json`
|
| 272 |
""", elem_id="intro")
|
| 273 |
+
with gr.Row(elem_id="upload-fields"):
|
| 274 |
+
login = gr.Textbox(label="Login", placeholder="tutorial001", info="tutorial001–tutorial033",
|
| 275 |
+
elem_id="login-field", scale=1, min_width=220)
|
| 276 |
+
upload = gr.File(label="samples.json", file_types=[".json"], type="filepath",
|
| 277 |
+
elem_id="upload-field", scale=2, min_width=280, height=160)
|
| 278 |
+
with gr.Row(elem_id="submit-actions"):
|
| 279 |
+
send = gr.Button("Submit", variant="primary", elem_id="submit-button", scale=0, min_width=240)
|
| 280 |
+
status = gr.Markdown(elem_id="status")
|
| 281 |
+
with gr.Accordion("How scoring works", open=False, elem_id="scoring-accordion"):
|
| 282 |
gr.Markdown("""Upload the full benchmark. A prediction is correct if it matches the reference within **1e-6**
|
| 283 |
and has no evaluator error. **Accuracy = correct / all questions**, overall and per category.
|
| 284 |
|
|
|
|
| 299 |
The saved `results.json` includes per-question outcomes, reference answers and absolute differences.
|
| 300 |
Both tabs show results for the current benchmark only.
|
| 301 |
""", elem_id="scoring")
|
| 302 |
+
with gr.Column(elem_id="results-panel"):
|
| 303 |
+
with gr.Tabs(elem_id="results-tabs"):
|
| 304 |
+
with gr.Tab("Leaderboard"):
|
| 305 |
+
leaderboard_table = gr.Dataframe(interactive=False, label="Best result per login",
|
| 306 |
+
elem_id="leaderboard-table", max_height=420)
|
| 307 |
+
with gr.Tab("Submissions"):
|
| 308 |
+
submissions_table = gr.Dataframe(interactive=False, label="Latest submissions",
|
| 309 |
+
elem_id="submissions-table", max_height=420)
|
| 310 |
+
gr.Markdown("Accuracy is shown in %. Equal scores are ranked by earliest submission. "
|
| 311 |
+
"Submissions shows the 50 latest runs.", elem_id="results-note")
|
| 312 |
+
with gr.Row(elem_id="refresh-actions"):
|
| 313 |
+
refresh = gr.Button("Refresh", elem_id="refresh-button", scale=0, min_width=160)
|
| 314 |
outputs = [submissions_table, leaderboard_table]
|
| 315 |
send.click(submit, inputs=[login, upload], outputs=[status, *outputs], concurrency_limit=1)
|
| 316 |
refresh.click(refresh_tables, outputs=outputs)
|
| 317 |
demo.load(refresh_tables, outputs=outputs)
|
| 318 |
|
| 319 |
if __name__ == "__main__":
|
| 320 |
+
demo.queue().launch(theme=THEME, css=CSS)
|
styles.css
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Palette and quarter-circle motif from MLinPL Tutorial.pdf. */
|
| 2 |
+
body { background: var(--body-background-fill); }
|
| 3 |
+
.gradio-container { width: 100% !important; min-width: 0 !important; box-sizing: border-box; max-width: 1200px !important; margin: auto !important; padding: 32px 24px !important; }
|
| 4 |
+
.gradio-container .main { width: 100%; min-width: 0; padding: 0 !important; }
|
| 5 |
+
.gradio-container .main > .wrap, .gradio-container main { min-width: 0; width: 100%; }
|
| 6 |
+
#workshop { width: 100%; gap: 22px; min-width: 0 !important; }
|
| 7 |
+
#hero { padding: 0; border: 0; background: transparent; }
|
| 8 |
+
.workshop-hero { position: relative; overflow: hidden; isolation: isolate; padding: 46px 90px; border-radius: 24px; background: #2b2661; color: white; text-align: center; }
|
| 9 |
+
.workshop-hero .eyebrow { margin: 0 0 20px; color: #70dfd5; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
|
| 10 |
+
.workshop-hero h1 { max-width: 820px; margin: auto; color: white; font-size: clamp(27px, 3.3vw, 43px); line-height: 1.2; font-weight: 700; letter-spacing: -.035em; text-wrap: balance; }
|
| 11 |
+
.workshop-hero h1 span { display: block; margin-top: 10px; color: #ded3ef; font-size: .65em; font-weight: 400; letter-spacing: -.015em; }
|
| 12 |
+
.workshop-hero .hero-note { margin: 24px 0 0; color: #c9c5e2; font-size: 14px; }
|
| 13 |
+
.hero-shapes { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
|
| 14 |
+
.hero-shapes i { position: absolute; width: 80px; height: 80px; }
|
| 15 |
+
.hero-shapes i:nth-child(1) { top: 0; right: 0; border-radius: 0 0 100% 0; background: #8a389e; }
|
| 16 |
+
.hero-shapes i:nth-child(2) { top: 80px; right: 80px; border-radius: 0 0 100% 0; background: #17bcaf; }
|
| 17 |
+
.hero-shapes i:nth-child(3) { bottom: 0; left: 0; border-radius: 0 100% 0 0; background: #59358c; }
|
| 18 |
+
#submit-panel, #results-panel { padding: 26px; border: 1px solid var(--block-border-color); border-radius: 20px; background: var(--block-background-fill); box-shadow: 0 8px 28px #2b266108; min-width: 0; }
|
| 19 |
+
#intro, #status { text-align: center; }
|
| 20 |
+
#intro h2 { margin: 0 0 10px; font-size: 23px; letter-spacing: -.025em; }
|
| 21 |
+
#intro p { margin: 8px auto; max-width: 760px; color: var(--body-text-color-subdued); line-height: 1.7; }
|
| 22 |
+
#intro code { font-size: 12px; overflow-wrap: anywhere; }
|
| 23 |
+
#upload-fields { gap: 18px; margin-top: 12px; align-items: center; }
|
| 24 |
+
#login-field, #upload-field { border-radius: 14px; }
|
| 25 |
+
#login-field textarea { text-align: center; min-height: 50px; }
|
| 26 |
+
#upload-field { border-style: dashed; border-color: #17bcaf80; }
|
| 27 |
+
#upload-field .upload-container { min-height: 0 !important; padding: 24px !important; }
|
| 28 |
+
#upload-field:hover { border-color: #17bcaf; }
|
| 29 |
+
#submit-actions, #refresh-actions { justify-content: center; }
|
| 30 |
+
#submit-button, #refresh-button { min-height: 46px; border-radius: 12px; font-weight: 600; }
|
| 31 |
+
#submit-button { box-shadow: 0 4px 14px #17bcaf25; }
|
| 32 |
+
#submit-button:hover { box-shadow: 0 6px 18px #17bcaf40; }
|
| 33 |
+
#workshop button:focus-visible, #workshop textarea:focus-visible { outline: 3px solid #17bcaf; outline-offset: 3px; }
|
| 34 |
+
#status:empty { display: none; }
|
| 35 |
+
#status p { overflow-wrap: anywhere; }
|
| 36 |
+
#scoring-accordion { border-radius: 14px; }
|
| 37 |
+
#scoring { text-align: center; }
|
| 38 |
+
#scoring table { text-align: left; font-size: 13px; }
|
| 39 |
+
#scoring code { white-space: normal; overflow-wrap: anywhere; }
|
| 40 |
+
#results-tabs [role="tablist"] { justify-content: center; gap: 8px; border-bottom: 1px solid var(--block-border-color); padding-bottom: 12px; }
|
| 41 |
+
#results-tabs [role="tablist"] button { min-height: 44px; border: 0; border-radius: 10px; padding: 10px 24px; color: var(--body-text-color-subdued); font-weight: 600; }
|
| 42 |
+
#results-tabs [role="tablist"] button.selected { background: #8a389e; color: white; }
|
| 43 |
+
#results-tabs [role="tablist"] button:hover:not(.selected) { background: #8a389e12; }
|
| 44 |
+
#results-tabs { min-width: 0; width: 100%; }
|
| 45 |
+
#results-panel .column { min-width: 0 !important; }
|
| 46 |
+
#results-panel .tabitem { padding: 20px 0 0; border: 0; min-width: 0; }
|
| 47 |
+
#results-panel .block { min-width: 0 !important; }
|
| 48 |
+
#leaderboard-table, #submissions-table { max-width: 100%; border-radius: 12px; }
|
| 49 |
+
#results-panel th, #results-panel td { text-align: center !important; font-variant-numeric: tabular-nums; }
|
| 50 |
+
#results-panel th { font-weight: 600; }
|
| 51 |
+
#results-panel td { font-size: 13px; }
|
| 52 |
+
#results-panel .cell-wrap { text-align: center; font-variant-numeric: tabular-nums; }
|
| 53 |
+
#results-note { text-align: center; color: var(--body-text-color-subdued); font-size: 12px; }
|
| 54 |
+
#refresh-actions { margin-top: 8px; }
|
| 55 |
+
@media (max-width: 640px) {
|
| 56 |
+
.gradio-container { padding: 14px 12px !important; }
|
| 57 |
+
#workshop { width: 100%; gap: 14px; }
|
| 58 |
+
.workshop-hero { padding: 36px 24px; border-radius: 18px; }
|
| 59 |
+
.workshop-hero .eyebrow { font-size: 10px; letter-spacing: .12em; }
|
| 60 |
+
.workshop-hero .hero-note { font-size: 12px; }
|
| 61 |
+
.hero-shapes i { width: 40px; height: 40px; }
|
| 62 |
+
.hero-shapes i:nth-child(2) { top: 40px; right: 40px; }
|
| 63 |
+
#submit-panel, #results-panel { padding: 18px 14px; border-radius: 16px; }
|
| 64 |
+
#intro h2 { font-size: 20px; }
|
| 65 |
+
#intro p { font-size: 14px; }
|
| 66 |
+
#upload-fields { flex-direction: column; gap: 12px; }
|
| 67 |
+
#upload-fields > * { width: 100%; min-width: 0 !important; }
|
| 68 |
+
#submit-button, #refresh-button { width: 100%; flex-grow: 1; }
|
| 69 |
+
#results-tabs [role="tablist"] { gap: 4px; }
|
| 70 |
+
#results-tabs [role="tablist"] button { min-height: 44px; padding: 10px 18px; font-size: 14px; }
|
| 71 |
+
#scoring { overflow-x: auto; }
|
| 72 |
+
}
|
| 73 |
+
@media (prefers-reduced-motion: reduce) {
|
| 74 |
+
#workshop * { scroll-behavior: auto !important; transition: none !important; }
|
| 75 |
+
}
|