Spaces:
Running
Running
p-video-2-pro-reference
#12
by minette-kaunismaki - opened
- app.py +93 -2
- data/ref2v_bench_v0_results.csv +14 -0
- ui.py +167 -30
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import asyncio
|
|
|
|
| 2 |
import json
|
|
|
|
| 3 |
from collections import defaultdict
|
| 4 |
from pathlib import Path
|
| 5 |
|
|
@@ -701,6 +703,12 @@ button.theme-toggle[data-mode="light"] .theme-icon-moon { display: block !import
|
|
| 701 |
flex: 1 1 0% !important;
|
| 702 |
min-width: 0 !important;
|
| 703 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 704 |
.view-filters > .block,
|
| 705 |
.view-filters .form,
|
| 706 |
.view-filters .block {
|
|
@@ -1224,7 +1232,7 @@ button.theme-toggle[data-mode="light"] .theme-icon-moon { display: block !import
|
|
| 1224 |
min-width: 180px;
|
| 1225 |
max-width: 260px;
|
| 1226 |
background: var(--pruna-table-sticky) !important;
|
| 1227 |
-
box-shadow:
|
| 1228 |
}
|
| 1229 |
.ranking-table th.model-cell,
|
| 1230 |
.prose .ranking-table th.model-cell {
|
|
@@ -1232,7 +1240,7 @@ button.theme-toggle[data-mode="light"] .theme-icon-moon { display: block !import
|
|
| 1232 |
left: var(--rank-col-width);
|
| 1233 |
z-index: 5;
|
| 1234 |
background: var(--pruna-bg-header) !important;
|
| 1235 |
-
box-shadow: 0 1px 0 var(--pruna-hairline),
|
| 1236 |
}
|
| 1237 |
.ranking-table tbody tr:hover .rank,
|
| 1238 |
.ranking-table tbody tr:hover .model-cell {
|
|
@@ -2475,6 +2483,55 @@ def load_text_to_video_dataframe(path):
|
|
| 2475 |
return load_video_generation_dataframe(path)
|
| 2476 |
|
| 2477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2478 |
df = load_oneig_dataframe(oneig_path)
|
| 2479 |
|
| 2480 |
oneig_metric_columns = [
|
|
@@ -2555,6 +2612,12 @@ image_to_video_path = _resolve_data_path(
|
|
| 2555 |
space_root.parent / "i2v-pro.csv",
|
| 2556 |
)
|
| 2557 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2558 |
qwen_df = load_qwen_combined_dataframe(qwen_path)
|
| 2559 |
aa_df = load_artificial_analysis_dataframe(aa_path)
|
| 2560 |
arena_df = load_arena_ai_dataframe(arena_path)
|
|
@@ -2720,7 +2783,35 @@ image_to_video_metric_ids = _metric_ids_for(
|
|
| 2720 |
image_to_video_df, ["datapoint_elo", "rapidata_elo"]
|
| 2721 |
)
|
| 2722 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2723 |
datasets = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2724 |
{
|
| 2725 |
"id": "text_to_video",
|
| 2726 |
"name": "VBench-2.0 Dataset",
|
|
|
|
| 1 |
import asyncio
|
| 2 |
+
import io
|
| 3 |
import json
|
| 4 |
+
import re
|
| 5 |
from collections import defaultdict
|
| 6 |
from pathlib import Path
|
| 7 |
|
|
|
|
| 703 |
flex: 1 1 0% !important;
|
| 704 |
min-width: 0 !important;
|
| 705 |
}
|
| 706 |
+
@media (min-width: 701px) {
|
| 707 |
+
.view-filters .form > .filter-modality {
|
| 708 |
+
flex: 0 0 210px !important;
|
| 709 |
+
min-width: 210px !important;
|
| 710 |
+
}
|
| 711 |
+
}
|
| 712 |
.view-filters > .block,
|
| 713 |
.view-filters .form,
|
| 714 |
.view-filters .block {
|
|
|
|
| 1232 |
min-width: 180px;
|
| 1233 |
max-width: 260px;
|
| 1234 |
background: var(--pruna-table-sticky) !important;
|
| 1235 |
+
box-shadow: inset -1px 0 0 var(--pruna-border) !important;
|
| 1236 |
}
|
| 1237 |
.ranking-table th.model-cell,
|
| 1238 |
.prose .ranking-table th.model-cell {
|
|
|
|
| 1240 |
left: var(--rank-col-width);
|
| 1241 |
z-index: 5;
|
| 1242 |
background: var(--pruna-bg-header) !important;
|
| 1243 |
+
box-shadow: 0 1px 0 var(--pruna-hairline), inset -1px 0 0 var(--pruna-border) !important;
|
| 1244 |
}
|
| 1245 |
.ranking-table tbody tr:hover .rank,
|
| 1246 |
.ranking-table tbody tr:hover .model-cell {
|
|
|
|
| 2483 |
return load_video_generation_dataframe(path)
|
| 2484 |
|
| 2485 |
|
| 2486 |
+
def _read_commented_csv(path):
|
| 2487 |
+
"""Read a CSV whose leading lines are '#' comments."""
|
| 2488 |
+
lines = Path(path).read_text(encoding="utf-8").splitlines(keepends=True)
|
| 2489 |
+
start = 0
|
| 2490 |
+
while start < len(lines) and lines[start].startswith("#"):
|
| 2491 |
+
start += 1
|
| 2492 |
+
return pd.read_csv(
|
| 2493 |
+
io.StringIO("".join(lines[start:])), na_values=["N/A", "n/a", ""]
|
| 2494 |
+
)
|
| 2495 |
+
|
| 2496 |
+
|
| 2497 |
+
def load_reference_to_video_dataframe(path):
|
| 2498 |
+
"""Load ref2v_bench results for the leaderboard and Pareto plots."""
|
| 2499 |
+
raw = _read_commented_csv(path)
|
| 2500 |
+
raw = raw.dropna(subset=["model_id"]).reset_index(drop=True)
|
| 2501 |
+
raw["model_id"] = raw["model_id"].astype(str).str.strip()
|
| 2502 |
+
raw["display_name"] = raw["display_name"].astype(str).str.strip()
|
| 2503 |
+
|
| 2504 |
+
df = raw.rename(
|
| 2505 |
+
columns={
|
| 2506 |
+
"display_name": "Model",
|
| 2507 |
+
"rapidata_elo": "Rapidata Elo",
|
| 2508 |
+
"min_generation_s": "Min Generation Time (s)",
|
| 2509 |
+
"median_generation_s": "Median Generation Time (s)",
|
| 2510 |
+
"p20_generation_s": "P20 Generation Time (s)",
|
| 2511 |
+
"generation_s_per_output_video_s": "Time / Output Video Second (s)",
|
| 2512 |
+
"price_usd_per_second": "Price / Second of Video (USD)",
|
| 2513 |
+
}
|
| 2514 |
+
)
|
| 2515 |
+
df = df.drop(
|
| 2516 |
+
columns=[c for c in df.columns if c.startswith("compass_")]
|
| 2517 |
+
+ ["model_id", "n_generations", "n_generations_all"],
|
| 2518 |
+
errors="ignore",
|
| 2519 |
+
)
|
| 2520 |
+
df = _as_numeric(
|
| 2521 |
+
df,
|
| 2522 |
+
[
|
| 2523 |
+
"Rapidata Elo",
|
| 2524 |
+
"Min Generation Time (s)",
|
| 2525 |
+
"Median Generation Time (s)",
|
| 2526 |
+
"P20 Generation Time (s)",
|
| 2527 |
+
"Time / Output Video Second (s)",
|
| 2528 |
+
"Price / Second of Video (USD)",
|
| 2529 |
+
],
|
| 2530 |
+
)
|
| 2531 |
+
df = _apply_video_timings(df, replace_displayed_time=True)
|
| 2532 |
+
return df.reset_index(drop=True)
|
| 2533 |
+
|
| 2534 |
+
|
| 2535 |
df = load_oneig_dataframe(oneig_path)
|
| 2536 |
|
| 2537 |
oneig_metric_columns = [
|
|
|
|
| 2612 |
space_root.parent / "i2v-pro.csv",
|
| 2613 |
)
|
| 2614 |
|
| 2615 |
+
ref2v_path = _resolve_data_path(
|
| 2616 |
+
data_dir / "ref2v_bench_v0_results.csv",
|
| 2617 |
+
space_root.parent / "ref2v_bench_v0_results.csv",
|
| 2618 |
+
)
|
| 2619 |
+
ref2v_df = load_reference_to_video_dataframe(ref2v_path)
|
| 2620 |
+
|
| 2621 |
qwen_df = load_qwen_combined_dataframe(qwen_path)
|
| 2622 |
aa_df = load_artificial_analysis_dataframe(aa_path)
|
| 2623 |
arena_df = load_arena_ai_dataframe(arena_path)
|
|
|
|
| 2783 |
image_to_video_df, ["datapoint_elo", "rapidata_elo"]
|
| 2784 |
)
|
| 2785 |
|
| 2786 |
+
ref2v_metric_ids = _metric_ids_for(ref2v_df, ["rapidata_elo"])
|
| 2787 |
+
ref2v_price_note = "Prices include reference fees"
|
| 2788 |
+
for _name, _note in zip(
|
| 2789 |
+
ref2v_df["Model"], ref2v_df.get("price_footnote", [None] * len(ref2v_df))
|
| 2790 |
+
):
|
| 2791 |
+
if isinstance(_note, str) and _note.strip():
|
| 2792 |
+
_cost = re.search(r"about (\$[\d.\u2013-]+/s)", _note)
|
| 2793 |
+
ref2v_price_note += (
|
| 2794 |
+
f", except {_name}, which received no reference video and so paid none"
|
| 2795 |
+
+ (f" (about {_cost.group(1)} with them)" if _cost else "")
|
| 2796 |
+
)
|
| 2797 |
+
ref2v_price_note += "."
|
| 2798 |
+
|
| 2799 |
datasets = [
|
| 2800 |
+
{
|
| 2801 |
+
"id": "ref2v",
|
| 2802 |
+
"name": "Ref2V Bench v0",
|
| 2803 |
+
"modality": "reference_to_video",
|
| 2804 |
+
"data": ref2v_df,
|
| 2805 |
+
"columns": [
|
| 2806 |
+
col for col in text_to_video_display_columns if col in ref2v_df.columns
|
| 2807 |
+
],
|
| 2808 |
+
"metric_ids": ref2v_metric_ids,
|
| 2809 |
+
"note": (
|
| 2810 |
+
"Rapidata Elo from pairwise preference, voters see only the two "
|
| 2811 |
+
"videos. " + ref2v_price_note
|
| 2812 |
+
),
|
| 2813 |
+
"samples": None,
|
| 2814 |
+
},
|
| 2815 |
{
|
| 2816 |
"id": "text_to_video",
|
| 2817 |
"name": "VBench-2.0 Dataset",
|
data/ref2v_bench_v0_results.csv
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ref2v_bench_v0 results, one row per model. Sources: build_results_table.py docstring.
|
| 2 |
+
# Human eval: Rapidata shows voters the two videos only. Elo over all clips; rank 1 = best.
|
| 3 |
+
# Price and time on the 111 prompts every model completed. price_usd_per_second = billed cost incl. reference fees / output s; generation_s = provider wait (queue included), not upload or download.
|
| 4 |
+
# compass_<prompt set>_<metric>: mean score; _n videos scored; _se standard error (pooled spread); _z standard errors from the 7-model average (|z| < 2 is roughly noise). Prompt sets are never pooled.
|
| 5 |
+
# Scales: visual_quality 0-1 (DOVER++ technical), audio_quality ~1-10 (Audiobox PQ), the rest 1-5 (Gemini judges; lip sync by SyncNet). stable_speaking_frontal_face is only the lip-sync filter. Lip sync on OpenS2V has too few videos to report.
|
| 6 |
+
model_id,display_name,provider,endpoint,rapidata_elo,rapidata_elo_ci,rapidata_rank,price_usd_per_second,generation_s_per_output_video_s,median_generation_s,n_generations,n_generations_all,min_generation_s,p20_generation_s,mean_generation_s,list_price_usd_per_second,price_usd_per_second_image_refs,price_usd_per_second_video_ref,price_usd_per_typical_clip,price_footnote,compass_multiref_compass_anatomical_consistency,compass_multiref_compass_anatomical_consistency_n,compass_multiref_compass_anatomical_consistency_se,compass_multiref_compass_anatomical_consistency_z,compass_multiref_compass_audio_quality,compass_multiref_compass_audio_quality_n,compass_multiref_compass_audio_quality_se,compass_multiref_compass_audio_quality_z,compass_multiref_compass_audio_task_following,compass_multiref_compass_audio_task_following_n,compass_multiref_compass_audio_task_following_se,compass_multiref_compass_audio_task_following_z,compass_multiref_compass_detail_binding,compass_multiref_compass_detail_binding_n,compass_multiref_compass_detail_binding_se,compass_multiref_compass_detail_binding_z,compass_multiref_compass_detail_preservation,compass_multiref_compass_detail_preservation_n,compass_multiref_compass_detail_preservation_se,compass_multiref_compass_detail_preservation_z,compass_multiref_compass_source_correctness,compass_multiref_compass_source_correctness_n,compass_multiref_compass_source_correctness_se,compass_multiref_compass_source_correctness_z,compass_multiref_compass_speech_content_accuracy,compass_multiref_compass_speech_content_accuracy_n,compass_multiref_compass_speech_content_accuracy_se,compass_multiref_compass_speech_content_accuracy_z,compass_multiref_compass_speech_lip_synchronization,compass_multiref_compass_speech_lip_synchronization_n,compass_multiref_compass_speech_lip_synchronization_se,compass_multiref_compass_speech_lip_synchronization_z,compass_multiref_compass_stable_speaking_frontal_face,compass_multiref_compass_stable_speaking_frontal_face_n,compass_multiref_compass_stable_speaking_frontal_face_se,compass_multiref_compass_stable_speaking_frontal_face_z,compass_multiref_compass_temporal_order_following,compass_multiref_compass_temporal_order_following_n,compass_multiref_compass_temporal_order_following_se,compass_multiref_compass_temporal_order_following_z,compass_multiref_compass_visual_event_sound_alignment,compass_multiref_compass_visual_event_sound_alignment_n,compass_multiref_compass_visual_event_sound_alignment_se,compass_multiref_compass_visual_event_sound_alignment_z,compass_multiref_compass_visual_quality,compass_multiref_compass_visual_quality_n,compass_multiref_compass_visual_quality_se,compass_multiref_compass_visual_quality_z,compass_multiref_compass_visual_task_following,compass_multiref_compass_visual_task_following_n,compass_multiref_compass_visual_task_following_se,compass_multiref_compass_visual_task_following_z,compass_opens2v_eval_anatomical_consistency,compass_opens2v_eval_anatomical_consistency_n,compass_opens2v_eval_anatomical_consistency_se,compass_opens2v_eval_anatomical_consistency_z,compass_opens2v_eval_audio_quality,compass_opens2v_eval_audio_quality_n,compass_opens2v_eval_audio_quality_se,compass_opens2v_eval_audio_quality_z,compass_opens2v_eval_audio_task_following,compass_opens2v_eval_audio_task_following_n,compass_opens2v_eval_audio_task_following_se,compass_opens2v_eval_audio_task_following_z,compass_opens2v_eval_detail_binding,compass_opens2v_eval_detail_binding_n,compass_opens2v_eval_detail_binding_se,compass_opens2v_eval_detail_binding_z,compass_opens2v_eval_detail_preservation,compass_opens2v_eval_detail_preservation_n,compass_opens2v_eval_detail_preservation_se,compass_opens2v_eval_detail_preservation_z,compass_opens2v_eval_speech_lip_synchronization,compass_opens2v_eval_speech_lip_synchronization_n,compass_opens2v_eval_speech_lip_synchronization_se,compass_opens2v_eval_speech_lip_synchronization_z,compass_opens2v_eval_stable_speaking_frontal_face,compass_opens2v_eval_stable_speaking_frontal_face_n,compass_opens2v_eval_stable_speaking_frontal_face_se,compass_opens2v_eval_stable_speaking_frontal_face_z,compass_opens2v_eval_temporal_order_following,compass_opens2v_eval_temporal_order_following_n,compass_opens2v_eval_temporal_order_following_se,compass_opens2v_eval_temporal_order_following_z,compass_opens2v_eval_visual_event_sound_alignment,compass_opens2v_eval_visual_event_sound_alignment_n,compass_opens2v_eval_visual_event_sound_alignment_se,compass_opens2v_eval_visual_event_sound_alignment_z,compass_opens2v_eval_visual_quality,compass_opens2v_eval_visual_quality_n,compass_opens2v_eval_visual_quality_se,compass_opens2v_eval_visual_quality_z,compass_opens2v_eval_visual_task_following,compass_opens2v_eval_visual_task_following_n,compass_opens2v_eval_visual_task_following_se,compass_opens2v_eval_visual_task_following_z
|
| 7 |
+
p_video_2_pro_reference,P-Video 2 Pro Reference,replicate,prunaai/p-video-2-pro-reference,1033,17,2,0.0462104,2.28478,14.0119,111,130,7.65198,10.0467,17.0844,0.035,0.0386462,0.0735259,0.31,,3.8689,82,0.10718,-0.101591,7.48157,82,0.0859189,1.30774,4.77083,48,0.149249,0.957173,4.87805,82,0.0380168,-0.939528,4.72764,82,0.0836426,0.40603,4.91837,49,0.0797278,0.269433,4.67308,52,0.119709,0.590681,4.32502,16,0.204044,2.26479,2.90909,55,0.199959,-0.716404,4.69355,62,0.113031,0.0886122,4.78261,69,0.0582419,-1.50969,0.152517,82,0.00347198,-11.2026,4.53445,82,0.0759313,1.95537,4.15625,48,0.128152,-0.525695,6.85765,48,0.109265,-0.0731109,4.27273,11,0.418506,0.44341,5,48,0.00646454,0.553139,4.59606,48,0.124882,-0.286497,4.16178,2,0.741891,0.407439,3.2,5,0.727029,-0.668081,4.85714,14,0.136551,0.173231,4.87179,39,0.0831586,0.191592,0.173233,48,0.00569378,-5.0973,4.59774,47,0.0789107,-1.1962
|
| 8 |
+
gemini_omni_1_1_flash,Gemini Omni 1.1 Flash,wavespeed,google/gemini-omni-1.1-flash/reference-to-video,1124,17,1,0.1,8.78015,46.2765,111,117,34.186,39.9785,65.6533,0.1,0.1,0.1,0.8,,4.2378,82,0.10718,3.34031,7.19456,82,0.0859189,-2.03276,4.70833,48,0.149249,0.53841,4.96341,82,0.0380168,1.30595,4.18089,82,0.0836426,-6.13069,4.80769,52,0.0773938,-1.15247,4.23077,52,0.119709,-3.10417,4.66283,22,0.17401,4.59704,3.76364,55,0.199959,3.55719,4.75,64,0.111251,0.597455,4.96203,79,0.0544311,1.68083,0.223415,82,0.00347198,9.21745,4.56723,82,0.0759313,2.38699,4.20714,35,0.150076,-0.109784,6.66536,35,0.127959,-1.56512,4.4,10,0.438933,0.712734,5,35,0.00757049,0.472333,4.16667,35,0.146247,-3.18077,4.37053,1,1.04919,0.487065,3,3,0.938591,-0.730579,5,12,0.147492,1.12896,4.92593,27,0.0999442,0.701027,0.222455,35,0.00666787,3.02944,4.79564,35,0.0914431,1.13196
|
| 9 |
+
kling_3_0_omni_pro,Kling 3.0 Omni Pro,wavespeed,kwaivgi/kling-video-o3-pro/reference-to-video,921,17,6,0.14,37.429,272.644,111,125,133.942,202.143,279.875,0.14,0.14,0.14,1.12,"Kling received no reference video (its API can't add sound to a video input, so we sent one frame), so it paid no reference-video fee on the 21 reference-video prompts.
|
| 10 |
+
At the other models' fees ($0.06–0.13 per reference-video second) it would cost about $0.148–0.157/s.",3.75,81,0.107839,-1.20356,7.23066,81,0.0864477,-1.60264,4.60417,48,0.149249,-0.159529,4.83539,81,0.0382508,-2.049,4.7284,81,0.0841573,0.412491,4.925,40,0.0882425,0.318599,4.71154,52,0.119709,0.911973,2.53796,8,0.288562,-4.59151,2.38889,54,0.201802,-3.28764,4.64286,56,0.118932,-0.342004,4.85938,64,0.0604742,-0.184554,0.185875,81,0.00349334,-1.58501,4.16782,81,0.0763986,-2.85554,4.14205,44,0.13385,-0.609437,7.1283,44,0.114124,2.30154,4.2,10,0.438933,0.257084,5,44,0.00675199,0.529591,4.65152,44,0.130435,0.150819,2.30744,1,1.04919,-1.47929,3,5,0.727029,-0.943173,4.72727,11,0.15405,-0.689484,4.65385,26,0.101848,-1.98351,0.193628,44,0.00594696,-1.45065,4.63254,43,0.0824994,-0.722339
|
| 11 |
+
minimax_h3,MiniMax H3,wavespeed,minimax/h3/reference-to-video,987,17,4,0.112617,40.0517,282.27,111,127,130.438,208.691,299.486,0.1,0.1,0.158178,0.8,,3.92073,82,0.10718,0.381982,7.38123,82,0.0859189,0.139846,4.6875,48,0.149249,0.398822,4.93902,82,0.0380168,0.664383,4.7832,82,0.0836426,1.07023,4.85714,49,0.0797278,-0.498486,4.80392,51,0.120877,1.66743,3.885,26,0.160066,0.138059,3.46296,54,0.201802,2.03477,4.67213,61,0.113954,-0.100052,4.86111,72,0.0570157,-0.165299,0.198768,82,0.00347198,2.11847,4.40083,81,0.0763986,0.194454,4.31383,47,0.129508,0.696565,6.84768,47,0.110422,-0.162594,3.36364,11,0.418506,-1.72882,5,47,0.00653295,0.547347,4.71749,47,0.126203,0.678674,4.055,4,0.524596,0.372662,4.4,5,0.727029,0.982472,4.83333,12,0.147492,-0.00104824,4.83784,37,0.0853766,-0.211118,0.206642,47,0.00575403,0.762264,4.7356,47,0.0789107,0.550857
|
| 12 |
+
minimax_h3_max,MiniMax H3 Max,fal,minimax/h3-max/reference-to-video,1030,17,3,0.0969066,2.08629,10.3881,111,129,5.11202,6.60513,15.6002,0.08,0.08,0.157958,0.64,,3.78354,82,0.10718,-0.898065,7.41123,82,0.0859189,0.489073,4.58333,48,0.149249,-0.299117,4.88618,82,0.0380168,-0.725673,4.68767,82,0.0836426,-0.0718716,4.92,50,0.0789265,0.292854,4.73585,53,0.118575,1.12572,4.19443,22,0.17401,1.90522,3.5,54,0.201802,2.2183,4.74603,63,0.112131,0.55738,4.86957,69,0.0582419,-0.0166641,0.188244,82,0.00347198,-0.912534,4.41048,82,0.0759313,0.322712,4.06383,47,0.129508,-1.23381,6.78496,47,0.110422,-0.730621,4.81818,11,0.418506,1.74675,5,47,0.00653295,0.547347,4.77305,47,0.126203,1.11888,4.49758,2,0.741891,0.860069,3.8,5,0.727029,0.157195,5,13,0.141706,1.17506,4.97436,39,0.0831586,1.42495,0.203966,47,0.00575403,0.297244,4.60851,47,0.0789107,-1.05966
|
| 13 |
+
seedance_2_5,Seedance 2.5,wavespeed,bytedance/seedance-2.5/text-to-video,985,17,5,0.370093,30.0721,206.055,111,121,130.958,178.206,224.864,0.36,0.36,0.406542,2.88,,4.02134,82,0.10718,1.32068,7.38576,82,0.0859189,0.192623,4.66667,48,0.149249,0.259234,4.9878,82,0.0380168,1.94751,4.79675,82,0.0836426,1.23223,4.85,40,0.0882425,-0.531332,4.62745,51,0.120877,0.207517,3.80772,17,0.197952,-0.278735,2.98182,55,0.199959,-0.352693,4.55,60,0.1149,-1.16217,4.97183,71,0.0574158,1.76424,0.188524,82,0.00347198,-0.831838,4.29557,82,0.0759313,-1.19067,4.55128,39,0.142172,2.3047,6.8551,39,0.121219,-0.0869478,3.88889,9,0.462676,-0.428525,4.98291,39,0.00717176,-1.88493,4.69801,39,0.138544,0.477557,4.1214,2,0.741891,0.353016,4,3,0.938591,0.334849,4.58333,12,0.147492,-1.69606,4.90909,22,0.110721,0.480747,0.202191,39,0.00631668,-0.0102518,4.65449,39,0.0866269,-0.434531
|
| 14 |
+
wan_3_0,Wan 3.0,wavespeed,alibaba/wan-3.0/reference-to-video,921,17,6,0.123453,26.9252,192.698,111,124,115.08,139.634,201.333,0.1,0.1,0.208145,0.8,,3.57622,82,0.10718,-2.83236,7.49946,82,0.0859189,1.51598,4.375,48,0.149249,-1.69499,4.9065,82,0.0380168,-0.191036,4.95122,82,0.0836426,3.07904,5,32,0.0986581,1.04516,4.43396,53,0.118575,-1.42024,3.62734,9,0.272059,-0.865839,2.36,50,0.209719,-3.30128,4.73016,63,0.112131,0.415822,4.78723,47,0.0705686,-1.18044,0.202543,82,0.00347198,3.20577,4.32546,82,0.0759313,-0.79695,4.13095,42,0.137,-0.676396,6.9204,42,0.11681,0.468866,3.66667,9,0.462676,-0.908823,4.99206,42,0.00691088,-0.630993,4.82011,42,0.133504,1.41016,3.50279,3,0.605752,-0.588872,4.4,5,0.727029,0.982472,4.83333,12,0.147492,-0.00104824,4.81818,11,0.156582,-0.240643,0.213674,42,0.0060869,1.87588,4.8204,42,0.0834757,1.53658
|
ui.py
CHANGED
|
@@ -23,7 +23,7 @@ MAX_COMPARE_MODELS = 4
|
|
| 23 |
DEFAULT_COMPARE_PROMPTS = 3
|
| 24 |
MAX_COMPARE_PROMPTS = 8
|
| 25 |
MAX_PARETO_METRICS = 8
|
| 26 |
-
_PARETO_SLOT_COUNT =
|
| 27 |
_PARETO_PRICE_COLUMN = "Price / Image (USD)"
|
| 28 |
_PARETO_VIDEO_PRICE_COLUMN = "Price / Second of Video (USD)"
|
| 29 |
_PARETO_PRICE_COLUMNS = (_PARETO_PRICE_COLUMN, _PARETO_VIDEO_PRICE_COLUMN)
|
|
@@ -56,10 +56,12 @@ TAB_ABOUT = "about"
|
|
| 56 |
MODALITY_TEXT_TO_VIDEO = "text_to_video"
|
| 57 |
MODALITY_IMAGE_TO_VIDEO = "image_to_video"
|
| 58 |
MODALITY_VIDEO_TO_VIDEO = "video_to_video"
|
|
|
|
| 59 |
MODALITY_TEXT_TO_IMAGE = "text_to_image"
|
| 60 |
MODALITY_CHOICES = [
|
| 61 |
("Text to Video", MODALITY_TEXT_TO_VIDEO),
|
| 62 |
("Image to Video", MODALITY_IMAGE_TO_VIDEO),
|
|
|
|
| 63 |
("Video to Video", MODALITY_VIDEO_TO_VIDEO),
|
| 64 |
("Text to Image", MODALITY_TEXT_TO_IMAGE),
|
| 65 |
]
|
|
@@ -903,6 +905,25 @@ def _pareto_fill_colors(models):
|
|
| 903 |
]
|
| 904 |
|
| 905 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 906 |
def _build_pareto_figure(
|
| 907 |
data,
|
| 908 |
score_column,
|
|
@@ -911,6 +932,12 @@ def _build_pareto_figure(
|
|
| 911 |
x_hover_prefix="",
|
| 912 |
x_hover_suffix="",
|
| 913 |
x_axis_type="linear",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 914 |
):
|
| 915 |
scatter = (
|
| 916 |
data[["Model", score_column, x_column]]
|
|
@@ -923,7 +950,9 @@ def _build_pareto_figure(
|
|
| 923 |
|
| 924 |
x_values = scatter[x_column].astype(float).tolist()
|
| 925 |
scores = scatter[score_column].astype(float).tolist()
|
| 926 |
-
on_frontier = _pareto_frontier_mask(
|
|
|
|
|
|
|
| 927 |
|
| 928 |
dominated = scatter.loc[[not flag for flag in on_frontier]].copy()
|
| 929 |
frontier = scatter.loc[on_frontier].sort_values(x_column).copy()
|
|
@@ -936,7 +965,7 @@ def _build_pareto_figure(
|
|
| 936 |
hover = (
|
| 937 |
"<b>%{text}</b><br>"
|
| 938 |
f"{escape(x_title)}: {x_hover_prefix}%{{x:.4f}}{x_hover_suffix}"
|
| 939 |
-
"<br>
|
| 940 |
)
|
| 941 |
|
| 942 |
fig = go.Figure()
|
|
@@ -1017,7 +1046,7 @@ def _build_pareto_figure(
|
|
| 1017 |
fig.update_layout(
|
| 1018 |
title=None,
|
| 1019 |
xaxis_title=x_title,
|
| 1020 |
-
yaxis_title=score_label,
|
| 1021 |
autosize=True,
|
| 1022 |
height=420,
|
| 1023 |
margin={"l": 56, "r": 28, "t": 28, "b": 80},
|
|
@@ -1036,26 +1065,12 @@ def _build_pareto_figure(
|
|
| 1036 |
)
|
| 1037 |
axis_font = {"color": "#fafafa", "size": 13}
|
| 1038 |
tick_font = {"color": "#a3a3a3", "size": 12}
|
| 1039 |
-
x_axis_ticks =
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
-
tick_values = [
|
| 1046 |
-
factor * (10**exponent)
|
| 1047 |
-
for exponent in range(
|
| 1048 |
-
floor(log10(minimum)),
|
| 1049 |
-
ceil(log10(maximum)) + 1,
|
| 1050 |
-
)
|
| 1051 |
-
for factor in (1, 2, 5)
|
| 1052 |
-
if minimum * 0.8 <= factor * (10**exponent) <= maximum * 1.2
|
| 1053 |
-
]
|
| 1054 |
-
x_axis_ticks = {
|
| 1055 |
-
"tickmode": "array",
|
| 1056 |
-
"tickvals": tick_values,
|
| 1057 |
-
"ticktext": [f"{value:g}" for value in tick_values],
|
| 1058 |
-
}
|
| 1059 |
fig.update_xaxes(
|
| 1060 |
type=x_axis_type,
|
| 1061 |
**x_axis_ticks,
|
|
@@ -1067,6 +1082,8 @@ def _build_pareto_figure(
|
|
| 1067 |
color="#d4d4d4",
|
| 1068 |
)
|
| 1069 |
fig.update_yaxes(
|
|
|
|
|
|
|
| 1070 |
showgrid=True,
|
| 1071 |
gridcolor="rgba(74, 57, 98, 0.55)",
|
| 1072 |
zeroline=False,
|
|
@@ -1077,6 +1094,35 @@ def _build_pareto_figure(
|
|
| 1077 |
return fig
|
| 1078 |
|
| 1079 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1080 |
def _is_log_scale(scale):
|
| 1081 |
return scale == "Logarithmic"
|
| 1082 |
|
|
@@ -1119,8 +1165,10 @@ def _uniform_pareto_scales(scale):
|
|
| 1119 |
return [scale] * MAX_PARETO_METRICS
|
| 1120 |
|
| 1121 |
|
| 1122 |
-
def _pareto_master_scale_update(price_scales, time_scales):
|
| 1123 |
values = list(price_scales) + list(time_scales)
|
|
|
|
|
|
|
| 1124 |
if values and all(value == values[0] for value in values):
|
| 1125 |
return gr.update(value=values[0])
|
| 1126 |
return gr.update(value=None)
|
|
@@ -1233,6 +1281,7 @@ def _pareto_slot_updates(
|
|
| 1233 |
score_columns,
|
| 1234 |
price_scales=None,
|
| 1235 |
time_scales=None,
|
|
|
|
| 1236 |
):
|
| 1237 |
"""Updates for a fixed bank of Gradio Plot slots (visible/hidden)."""
|
| 1238 |
score_columns = [column for column in (score_columns or []) if column]
|
|
@@ -1286,6 +1335,7 @@ def _pareto_slot_updates(
|
|
| 1286 |
_pareto_plot_update(time_fig),
|
| 1287 |
]
|
| 1288 |
)
|
|
|
|
| 1289 |
return updates
|
| 1290 |
|
| 1291 |
|
|
@@ -1310,7 +1360,11 @@ def _pareto_all_scale_updates(data, score_columns, scale):
|
|
| 1310 |
radio_updates = [
|
| 1311 |
gr.update(value=scale) for _ in range(MAX_PARETO_METRICS * 2)
|
| 1312 |
]
|
| 1313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1314 |
|
| 1315 |
|
| 1316 |
def _samples_html(samples, selected_models, num_prompts, seed=0):
|
|
@@ -1455,7 +1509,8 @@ def _filter_row(datasets, metrics, default_dataset_id, default_metric_id=None):
|
|
| 1455 |
type="value",
|
| 1456 |
filterable=False,
|
| 1457 |
scale=1,
|
| 1458 |
-
min_width=
|
|
|
|
| 1459 |
)
|
| 1460 |
dataset_dd = gr.Dropdown(
|
| 1461 |
choices=_dataset_choices(datasets, modality=default_modality),
|
|
@@ -1668,6 +1723,40 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 1668 |
slot_time_scale,
|
| 1669 |
)
|
| 1670 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1671 |
|
| 1672 |
with gr.TabItem(
|
| 1673 |
"Samples",
|
|
@@ -1816,6 +1905,7 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 1816 |
),
|
| 1817 |
"price_scales": _normalize_pareto_scales(prev.get("price_scales")),
|
| 1818 |
"time_scales": _normalize_pareto_scales(prev.get("time_scales")),
|
|
|
|
| 1819 |
"stale": {
|
| 1820 |
TAB_LEADERBOARDS: not flags["include_leaderboard"],
|
| 1821 |
TAB_PARETO: not flags["include_pareto"],
|
|
@@ -1877,6 +1967,7 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 1877 |
include_samples=False,
|
| 1878 |
price_scales=None,
|
| 1879 |
time_scales=None,
|
|
|
|
| 1880 |
):
|
| 1881 |
view = resolve_view(datasets, metrics, dataset_id, metric_id)
|
| 1882 |
data = view["data"]
|
|
@@ -1902,6 +1993,7 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 1902 |
view["score_columns"],
|
| 1903 |
price_scales=price_scales,
|
| 1904 |
time_scales=time_scales,
|
|
|
|
| 1905 |
)
|
| 1906 |
else:
|
| 1907 |
pareto_updates = _pareto_skip_updates()
|
|
@@ -2042,6 +2134,7 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2042 |
seed,
|
| 2043 |
price_scales=view_state.get("price_scales"),
|
| 2044 |
time_scales=view_state.get("time_scales"),
|
|
|
|
| 2045 |
**flags,
|
| 2046 |
),
|
| 2047 |
"state": _commit_state(
|
|
@@ -2317,6 +2410,7 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2317 |
seed,
|
| 2318 |
price_scales=view_state.get("price_scales"),
|
| 2319 |
time_scales=view_state.get("time_scales"),
|
|
|
|
| 2320 |
**flags,
|
| 2321 |
)
|
| 2322 |
stale[tab] = False
|
|
@@ -2393,7 +2487,7 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2393 |
view_state["price_scales"] = price_scales
|
| 2394 |
view_state["time_scales"] = time_scales
|
| 2395 |
master_scale = _pareto_master_scale_update(
|
| 2396 |
-
price_scales, time_scales
|
| 2397 |
)
|
| 2398 |
view = resolve_view(datasets, metrics, dataset_id, metric_id)
|
| 2399 |
score_columns = [
|
|
@@ -2416,18 +2510,43 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2416 |
handler.__name__ = f"on_pareto_{axis}_scale_{slot_index}"
|
| 2417 |
return handler
|
| 2418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2419 |
def on_pareto_all_scale(dataset_id, metric_id, models, scale, view_state):
|
| 2420 |
if scale not in _PARETO_SCALE_VALUES:
|
| 2421 |
-
return (*_skip_all(MAX_PARETO_METRICS * 4), gr.skip())
|
| 2422 |
view_state = dict(view_state or {})
|
| 2423 |
scales = _uniform_pareto_scales(scale)
|
| 2424 |
if (
|
| 2425 |
_normalize_pareto_scales(view_state.get("price_scales")) == scales
|
| 2426 |
and _normalize_pareto_scales(view_state.get("time_scales")) == scales
|
|
|
|
| 2427 |
):
|
| 2428 |
-
return (*_skip_all(MAX_PARETO_METRICS * 4), gr.skip())
|
| 2429 |
view_state["price_scales"] = scales
|
| 2430 |
view_state["time_scales"] = scales
|
|
|
|
| 2431 |
view = resolve_view(datasets, metrics, dataset_id, metric_id)
|
| 2432 |
data = _filter_leaderboard(
|
| 2433 |
view["data"], [], [], [], models=list(models or [])
|
|
@@ -2479,6 +2598,7 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2479 |
"optimized": [],
|
| 2480 |
"price_scales": _default_pareto_scales(),
|
| 2481 |
"time_scales": _default_pareto_scales(),
|
|
|
|
| 2482 |
"stale": {
|
| 2483 |
TAB_LEADERBOARDS: False,
|
| 2484 |
TAB_PARETO: True,
|
|
@@ -2502,6 +2622,8 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2502 |
slot_time,
|
| 2503 |
)
|
| 2504 |
],
|
|
|
|
|
|
|
| 2505 |
]
|
| 2506 |
pareto_all_scale_outputs = [
|
| 2507 |
*[
|
|
@@ -2520,6 +2642,8 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2520 |
slot_time_scale
|
| 2521 |
for _, _, _, _, _, _, _, _, _, slot_time_scale in pareto_slots
|
| 2522 |
],
|
|
|
|
|
|
|
| 2523 |
]
|
| 2524 |
view_inputs = [
|
| 2525 |
platform,
|
|
@@ -2681,6 +2805,19 @@ def render_image_workspace(datasets, metrics, default_dataset_id, default_metric
|
|
| 2681 |
**_VIEW_EVENTS,
|
| 2682 |
)
|
| 2683 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2684 |
prompt_count.change(
|
| 2685 |
on_samples_controls,
|
| 2686 |
inputs=[dataset_dd, models_dd, prompt_count, seed_state],
|
|
|
|
| 23 |
DEFAULT_COMPARE_PROMPTS = 3
|
| 24 |
MAX_COMPARE_PROMPTS = 8
|
| 25 |
MAX_PARETO_METRICS = 8
|
| 26 |
+
_PARETO_SLOT_COUNT = 3 + MAX_PARETO_METRICS * 8
|
| 27 |
_PARETO_PRICE_COLUMN = "Price / Image (USD)"
|
| 28 |
_PARETO_VIDEO_PRICE_COLUMN = "Price / Second of Video (USD)"
|
| 29 |
_PARETO_PRICE_COLUMNS = (_PARETO_PRICE_COLUMN, _PARETO_VIDEO_PRICE_COLUMN)
|
|
|
|
| 56 |
MODALITY_TEXT_TO_VIDEO = "text_to_video"
|
| 57 |
MODALITY_IMAGE_TO_VIDEO = "image_to_video"
|
| 58 |
MODALITY_VIDEO_TO_VIDEO = "video_to_video"
|
| 59 |
+
MODALITY_REFERENCE_TO_VIDEO = "reference_to_video"
|
| 60 |
MODALITY_TEXT_TO_IMAGE = "text_to_image"
|
| 61 |
MODALITY_CHOICES = [
|
| 62 |
("Text to Video", MODALITY_TEXT_TO_VIDEO),
|
| 63 |
("Image to Video", MODALITY_IMAGE_TO_VIDEO),
|
| 64 |
+
("Reference to Video", MODALITY_REFERENCE_TO_VIDEO),
|
| 65 |
("Video to Video", MODALITY_VIDEO_TO_VIDEO),
|
| 66 |
("Text to Image", MODALITY_TEXT_TO_IMAGE),
|
| 67 |
]
|
|
|
|
| 905 |
]
|
| 906 |
|
| 907 |
|
| 908 |
+
def _log_axis_ticks(values):
|
| 909 |
+
"""Tick dict with clean 1/2/5 steps for a log axis, or {} if not possible."""
|
| 910 |
+
positive = [float(v) for v in values if v and float(v) > 0]
|
| 911 |
+
if not positive:
|
| 912 |
+
return {}
|
| 913 |
+
minimum, maximum = min(positive), max(positive)
|
| 914 |
+
tick_values = [
|
| 915 |
+
factor * (10**exponent)
|
| 916 |
+
for exponent in range(floor(log10(minimum)), ceil(log10(maximum)) + 1)
|
| 917 |
+
for factor in (1, 2, 5)
|
| 918 |
+
if minimum * 0.8 <= factor * (10**exponent) <= maximum * 1.2
|
| 919 |
+
]
|
| 920 |
+
return {
|
| 921 |
+
"tickmode": "array",
|
| 922 |
+
"tickvals": tick_values,
|
| 923 |
+
"ticktext": [f"{value:g}" for value in tick_values],
|
| 924 |
+
}
|
| 925 |
+
|
| 926 |
+
|
| 927 |
def _build_pareto_figure(
|
| 928 |
data,
|
| 929 |
score_column,
|
|
|
|
| 932 |
x_hover_prefix="",
|
| 933 |
x_hover_suffix="",
|
| 934 |
x_axis_type="linear",
|
| 935 |
+
y_title=None,
|
| 936 |
+
y_lower_is_better=False,
|
| 937 |
+
y_hover_label="Score",
|
| 938 |
+
y_hover_suffix="",
|
| 939 |
+
y_axis_type="linear",
|
| 940 |
+
y_hover_prefix="",
|
| 941 |
):
|
| 942 |
scatter = (
|
| 943 |
data[["Model", score_column, x_column]]
|
|
|
|
| 950 |
|
| 951 |
x_values = scatter[x_column].astype(float).tolist()
|
| 952 |
scores = scatter[score_column].astype(float).tolist()
|
| 953 |
+
on_frontier = _pareto_frontier_mask(
|
| 954 |
+
x_values, [-value for value in scores] if y_lower_is_better else scores
|
| 955 |
+
)
|
| 956 |
|
| 957 |
dominated = scatter.loc[[not flag for flag in on_frontier]].copy()
|
| 958 |
frontier = scatter.loc[on_frontier].sort_values(x_column).copy()
|
|
|
|
| 965 |
hover = (
|
| 966 |
"<b>%{text}</b><br>"
|
| 967 |
f"{escape(x_title)}: {x_hover_prefix}%{{x:.4f}}{x_hover_suffix}"
|
| 968 |
+
f"<br>{escape(y_hover_label)}: {y_hover_prefix}%{{y:.4f}}{y_hover_suffix}<extra></extra>"
|
| 969 |
)
|
| 970 |
|
| 971 |
fig = go.Figure()
|
|
|
|
| 1046 |
fig.update_layout(
|
| 1047 |
title=None,
|
| 1048 |
xaxis_title=x_title,
|
| 1049 |
+
yaxis_title=y_title or score_label,
|
| 1050 |
autosize=True,
|
| 1051 |
height=420,
|
| 1052 |
margin={"l": 56, "r": 28, "t": 28, "b": 80},
|
|
|
|
| 1065 |
)
|
| 1066 |
axis_font = {"color": "#fafafa", "size": 13}
|
| 1067 |
tick_font = {"color": "#a3a3a3", "size": 12}
|
| 1068 |
+
x_axis_ticks = (
|
| 1069 |
+
_log_axis_ticks(scatter[x_column]) if x_axis_type == "log" else {}
|
| 1070 |
+
)
|
| 1071 |
+
y_axis_ticks = (
|
| 1072 |
+
_log_axis_ticks(scatter[score_column]) if y_axis_type == "log" else {}
|
| 1073 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1074 |
fig.update_xaxes(
|
| 1075 |
type=x_axis_type,
|
| 1076 |
**x_axis_ticks,
|
|
|
|
| 1082 |
color="#d4d4d4",
|
| 1083 |
)
|
| 1084 |
fig.update_yaxes(
|
| 1085 |
+
type=y_axis_type,
|
| 1086 |
+
**y_axis_ticks,
|
| 1087 |
showgrid=True,
|
| 1088 |
gridcolor="rgba(74, 57, 98, 0.55)",
|
| 1089 |
zeroline=False,
|
|
|
|
| 1094 |
return fig
|
| 1095 |
|
| 1096 |
|
| 1097 |
+
def _speed_price_figure(data, scale=_PARETO_SCALE_DEFAULT):
|
| 1098 |
+
"""Generation time vs price; both lower-is-better, frontier = bottom-left."""
|
| 1099 |
+
price_column = _pareto_price_column(data)
|
| 1100 |
+
time_column = _pareto_time_column(data)
|
| 1101 |
+
if data is None or price_column is None or time_column is None:
|
| 1102 |
+
return None
|
| 1103 |
+
return _build_pareto_figure(
|
| 1104 |
+
data,
|
| 1105 |
+
score_column=price_column,
|
| 1106 |
+
x_column=time_column,
|
| 1107 |
+
x_title=_PARETO_TIME_TITLES.get(time_column, "Generation time (s)"),
|
| 1108 |
+
x_hover_suffix="s",
|
| 1109 |
+
x_axis_type=_pareto_axis_type(scale),
|
| 1110 |
+
y_title=_PARETO_PRICE_TITLES.get(price_column, "Price (USD)"),
|
| 1111 |
+
y_lower_is_better=True,
|
| 1112 |
+
y_hover_label="Price",
|
| 1113 |
+
y_hover_prefix="$",
|
| 1114 |
+
y_axis_type=_pareto_axis_type(scale),
|
| 1115 |
+
)
|
| 1116 |
+
|
| 1117 |
+
|
| 1118 |
+
def _speed_price_updates(data, scale=_PARETO_SCALE_DEFAULT):
|
| 1119 |
+
fig = _speed_price_figure(data, scale)
|
| 1120 |
+
return [
|
| 1121 |
+
gr.update(visible=fig is not None),
|
| 1122 |
+
_pareto_plot_update(fig),
|
| 1123 |
+
]
|
| 1124 |
+
|
| 1125 |
+
|
| 1126 |
def _is_log_scale(scale):
|
| 1127 |
return scale == "Logarithmic"
|
| 1128 |
|
|
|
|
| 1165 |
return [scale] * MAX_PARETO_METRICS
|
| 1166 |
|
| 1167 |
|
| 1168 |
+
def _pareto_master_scale_update(price_scales, time_scales, speed_scale=None):
|
| 1169 |
values = list(price_scales) + list(time_scales)
|
| 1170 |
+
if speed_scale:
|
| 1171 |
+
values.append(speed_scale)
|
| 1172 |
if values and all(value == values[0] for value in values):
|
| 1173 |
return gr.update(value=values[0])
|
| 1174 |
return gr.update(value=None)
|
|
|
|
| 1281 |
score_columns,
|
| 1282 |
price_scales=None,
|
| 1283 |
time_scales=None,
|
| 1284 |
+
speed_scale=None,
|
| 1285 |
):
|
| 1286 |
"""Updates for a fixed bank of Gradio Plot slots (visible/hidden)."""
|
| 1287 |
score_columns = [column for column in (score_columns or []) if column]
|
|
|
|
| 1335 |
_pareto_plot_update(time_fig),
|
| 1336 |
]
|
| 1337 |
)
|
| 1338 |
+
updates.extend(_speed_price_updates(data, speed_scale or _PARETO_SCALE_DEFAULT))
|
| 1339 |
return updates
|
| 1340 |
|
| 1341 |
|
|
|
|
| 1360 |
radio_updates = [
|
| 1361 |
gr.update(value=scale) for _ in range(MAX_PARETO_METRICS * 2)
|
| 1362 |
]
|
| 1363 |
+
speed_updates = [
|
| 1364 |
+
_pareto_plot_update(_speed_price_figure(data, scale)),
|
| 1365 |
+
gr.update(value=scale),
|
| 1366 |
+
]
|
| 1367 |
+
return price_updates + time_updates + radio_updates + speed_updates
|
| 1368 |
|
| 1369 |
|
| 1370 |
def _samples_html(samples, selected_models, num_prompts, seed=0):
|
|
|
|
| 1509 |
type="value",
|
| 1510 |
filterable=False,
|
| 1511 |
scale=1,
|
| 1512 |
+
min_width=210,
|
| 1513 |
+
elem_classes="filter-modality",
|
| 1514 |
)
|
| 1515 |
dataset_dd = gr.Dropdown(
|
| 1516 |
choices=_dataset_choices(datasets, modality=default_modality),
|
|
|
|
| 1723 |
slot_time_scale,
|
| 1724 |
)
|
| 1725 |
)
|
| 1726 |
+
with gr.Column(
|
| 1727 |
+
visible=False, elem_classes="pareto-metric-block"
|
| 1728 |
+
) as speed_price_group:
|
| 1729 |
+
gr.Markdown(
|
| 1730 |
+
"#### Cost and speed",
|
| 1731 |
+
elem_classes="pareto-metric-title",
|
| 1732 |
+
)
|
| 1733 |
+
with gr.Row(
|
| 1734 |
+
equal_height=True, elem_classes="pareto-layout"
|
| 1735 |
+
):
|
| 1736 |
+
with gr.Column(
|
| 1737 |
+
scale=1, min_width=320, elem_classes="pareto-col"
|
| 1738 |
+
):
|
| 1739 |
+
speed_price_scale = _pareto_plot_heading(
|
| 1740 |
+
"Time vs price"
|
| 1741 |
+
)
|
| 1742 |
+
speed_price_plot = gr.Plot(
|
| 1743 |
+
value=None,
|
| 1744 |
+
show_label=False,
|
| 1745 |
+
elem_classes="pareto-plot",
|
| 1746 |
+
)
|
| 1747 |
+
# Empty half so the plot matches the width of the others.
|
| 1748 |
+
with gr.Column(
|
| 1749 |
+
scale=1, min_width=320, elem_classes="pareto-col"
|
| 1750 |
+
):
|
| 1751 |
+
gr.HTML("", padding=False)
|
| 1752 |
+
gr.HTML(
|
| 1753 |
+
"<p class='pareto-note-copy'>Lower is better on both "
|
| 1754 |
+
"axes, so the best models sit at the bottom-left. "
|
| 1755 |
+
"Green points are on the frontier. Hover a point to "
|
| 1756 |
+
"see which model it is.</p>",
|
| 1757 |
+
padding=False,
|
| 1758 |
+
elem_classes="pareto-note",
|
| 1759 |
+
)
|
| 1760 |
|
| 1761 |
with gr.TabItem(
|
| 1762 |
"Samples",
|
|
|
|
| 1905 |
),
|
| 1906 |
"price_scales": _normalize_pareto_scales(prev.get("price_scales")),
|
| 1907 |
"time_scales": _normalize_pareto_scales(prev.get("time_scales")),
|
| 1908 |
+
"speed_scale": prev.get("speed_scale") or _PARETO_SCALE_DEFAULT,
|
| 1909 |
"stale": {
|
| 1910 |
TAB_LEADERBOARDS: not flags["include_leaderboard"],
|
| 1911 |
TAB_PARETO: not flags["include_pareto"],
|
|
|
|
| 1967 |
include_samples=False,
|
| 1968 |
price_scales=None,
|
| 1969 |
time_scales=None,
|
| 1970 |
+
speed_scale=None,
|
| 1971 |
):
|
| 1972 |
view = resolve_view(datasets, metrics, dataset_id, metric_id)
|
| 1973 |
data = view["data"]
|
|
|
|
| 1993 |
view["score_columns"],
|
| 1994 |
price_scales=price_scales,
|
| 1995 |
time_scales=time_scales,
|
| 1996 |
+
speed_scale=speed_scale,
|
| 1997 |
)
|
| 1998 |
else:
|
| 1999 |
pareto_updates = _pareto_skip_updates()
|
|
|
|
| 2134 |
seed,
|
| 2135 |
price_scales=view_state.get("price_scales"),
|
| 2136 |
time_scales=view_state.get("time_scales"),
|
| 2137 |
+
speed_scale=view_state.get("speed_scale"),
|
| 2138 |
**flags,
|
| 2139 |
),
|
| 2140 |
"state": _commit_state(
|
|
|
|
| 2410 |
seed,
|
| 2411 |
price_scales=view_state.get("price_scales"),
|
| 2412 |
time_scales=view_state.get("time_scales"),
|
| 2413 |
+
speed_scale=view_state.get("speed_scale"),
|
| 2414 |
**flags,
|
| 2415 |
)
|
| 2416 |
stale[tab] = False
|
|
|
|
| 2487 |
view_state["price_scales"] = price_scales
|
| 2488 |
view_state["time_scales"] = time_scales
|
| 2489 |
master_scale = _pareto_master_scale_update(
|
| 2490 |
+
price_scales, time_scales, view_state.get("speed_scale")
|
| 2491 |
)
|
| 2492 |
view = resolve_view(datasets, metrics, dataset_id, metric_id)
|
| 2493 |
score_columns = [
|
|
|
|
| 2510 |
handler.__name__ = f"on_pareto_{axis}_scale_{slot_index}"
|
| 2511 |
return handler
|
| 2512 |
|
| 2513 |
+
def on_speed_scale(dataset_id, metric_id, models, scale, view_state):
|
| 2514 |
+
view_state = dict(view_state or {})
|
| 2515 |
+
if (
|
| 2516 |
+
scale not in _PARETO_SCALE_VALUES
|
| 2517 |
+
or view_state.get("speed_scale") == scale
|
| 2518 |
+
):
|
| 2519 |
+
return gr.skip(), gr.skip(), gr.skip()
|
| 2520 |
+
view_state["speed_scale"] = scale
|
| 2521 |
+
master_scale = _pareto_master_scale_update(
|
| 2522 |
+
_normalize_pareto_scales(view_state.get("price_scales")),
|
| 2523 |
+
_normalize_pareto_scales(view_state.get("time_scales")),
|
| 2524 |
+
scale,
|
| 2525 |
+
)
|
| 2526 |
+
view = resolve_view(datasets, metrics, dataset_id, metric_id)
|
| 2527 |
+
data = _filter_leaderboard(
|
| 2528 |
+
view["data"], [], [], [], models=list(models or [])
|
| 2529 |
+
)
|
| 2530 |
+
return (
|
| 2531 |
+
_pareto_plot_update(_speed_price_figure(data, scale)),
|
| 2532 |
+
master_scale,
|
| 2533 |
+
view_state,
|
| 2534 |
+
)
|
| 2535 |
+
|
| 2536 |
def on_pareto_all_scale(dataset_id, metric_id, models, scale, view_state):
|
| 2537 |
if scale not in _PARETO_SCALE_VALUES:
|
| 2538 |
+
return (*_skip_all(MAX_PARETO_METRICS * 4 + 2), gr.skip())
|
| 2539 |
view_state = dict(view_state or {})
|
| 2540 |
scales = _uniform_pareto_scales(scale)
|
| 2541 |
if (
|
| 2542 |
_normalize_pareto_scales(view_state.get("price_scales")) == scales
|
| 2543 |
and _normalize_pareto_scales(view_state.get("time_scales")) == scales
|
| 2544 |
+
and view_state.get("speed_scale") == scale
|
| 2545 |
):
|
| 2546 |
+
return (*_skip_all(MAX_PARETO_METRICS * 4 + 2), gr.skip())
|
| 2547 |
view_state["price_scales"] = scales
|
| 2548 |
view_state["time_scales"] = scales
|
| 2549 |
+
view_state["speed_scale"] = scale
|
| 2550 |
view = resolve_view(datasets, metrics, dataset_id, metric_id)
|
| 2551 |
data = _filter_leaderboard(
|
| 2552 |
view["data"], [], [], [], models=list(models or [])
|
|
|
|
| 2598 |
"optimized": [],
|
| 2599 |
"price_scales": _default_pareto_scales(),
|
| 2600 |
"time_scales": _default_pareto_scales(),
|
| 2601 |
+
"speed_scale": _PARETO_SCALE_DEFAULT,
|
| 2602 |
"stale": {
|
| 2603 |
TAB_LEADERBOARDS: False,
|
| 2604 |
TAB_PARETO: True,
|
|
|
|
| 2622 |
slot_time,
|
| 2623 |
)
|
| 2624 |
],
|
| 2625 |
+
speed_price_group,
|
| 2626 |
+
speed_price_plot,
|
| 2627 |
]
|
| 2628 |
pareto_all_scale_outputs = [
|
| 2629 |
*[
|
|
|
|
| 2642 |
slot_time_scale
|
| 2643 |
for _, _, _, _, _, _, _, _, _, slot_time_scale in pareto_slots
|
| 2644 |
],
|
| 2645 |
+
speed_price_plot,
|
| 2646 |
+
speed_price_scale,
|
| 2647 |
]
|
| 2648 |
view_inputs = [
|
| 2649 |
platform,
|
|
|
|
| 2805 |
**_VIEW_EVENTS,
|
| 2806 |
)
|
| 2807 |
|
| 2808 |
+
speed_price_scale.change(
|
| 2809 |
+
on_speed_scale,
|
| 2810 |
+
inputs=[
|
| 2811 |
+
dataset_dd,
|
| 2812 |
+
metric_dd,
|
| 2813 |
+
models_dd,
|
| 2814 |
+
speed_price_scale,
|
| 2815 |
+
view_state,
|
| 2816 |
+
],
|
| 2817 |
+
outputs=[speed_price_plot, pareto_all_scale, view_state],
|
| 2818 |
+
**_VIEW_EVENTS,
|
| 2819 |
+
)
|
| 2820 |
+
|
| 2821 |
prompt_count.change(
|
| 2822 |
on_samples_controls,
|
| 2823 |
inputs=[dataset_dd, models_dd, prompt_count, seed_state],
|