|
9 | 9 | import json |
10 | 10 | import os |
11 | 11 |
|
| 12 | +try: |
| 13 | + from benchmarks import get_all_benchmarks |
| 14 | +except ImportError: |
| 15 | + def get_all_benchmarks(): return {} |
| 16 | + |
12 | 17 |
|
13 | 18 | # ── Load model catalog ──────────────────────────────────────────────────────── |
14 | 19 |
|
@@ -149,7 +154,7 @@ def draw_footer(stdscr, height, width): |
149 | 154 | stdscr.attroff(curses.color_pair(1)) |
150 | 155 |
|
151 | 156 |
|
152 | | -def draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width): |
| 157 | +def draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width, benchmarks=None): |
153 | 158 | """Draw the scrollable model list.""" |
154 | 159 | visible = models[scroll_offset: scroll_offset + list_height] |
155 | 160 |
|
@@ -179,8 +184,14 @@ def draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_heig |
179 | 184 | label = COMPAT_LABELS.get(compat, "") |
180 | 185 | v_tag = " ✓" if verified else " ?" |
181 | 186 |
|
| 187 | + # Benchmark score for this variant |
| 188 | + bench_filename = model.get("_best_variant", {}).get("filename", "") |
| 189 | + bench_data = (benchmarks or {}).get(bench_filename, {}) |
| 190 | + tps = bench_data.get("gen_tps", 0) |
| 191 | + bench_str = f" ⚡{int(tps)}t/s" if tps > 0 else "" |
| 192 | + |
182 | 193 | # Build the line |
183 | | - line_left = f" {icon} {name} ({params}){v_tag}" |
| 194 | + line_left = f" {icon} {name} ({params}){v_tag}{bench_str}" |
184 | 195 | line_right = f"{variant} {size_dl}GB↓ {size_ram}GB RAM {label} " |
185 | 196 | padding = width - len(line_left) - len(line_right) |
186 | 197 | if padding < 1: |
@@ -256,6 +267,7 @@ def run_browser(stdscr, models, device_profile): |
256 | 267 |
|
257 | 268 | selected = 0 |
258 | 269 | scroll_offset = 0 |
| 270 | + benchmarks = get_all_benchmarks() |
259 | 271 |
|
260 | 272 | while True: |
261 | 273 | stdscr.clear() |
@@ -284,7 +296,7 @@ def run_browser(stdscr, models, device_profile): |
284 | 296 | scroll_offset = selected - list_height + 1 |
285 | 297 |
|
286 | 298 | draw_header(stdscr, device_profile, width) |
287 | | - draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width) |
| 299 | + draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width, benchmarks) |
288 | 300 |
|
289 | 301 | current_model = models[selected] if models else None |
290 | 302 | draw_detail_panel(stdscr, current_model, detail_top, width) |
|
0 commit comments