Spaces:
Running
Running
Commit History
-
改动汇总
Alex W.core/plotter.py — _aggregate_by_layer() 改为两步:先按 (layer, kv_head) 分组取 median,再跨 kv_head 取 median/q25/q75 core/plotter_plotly.py — _agg() 同上 core/table_gen.py — 加 _pseudobulk(df, col) helper,所有 make_table 函数调用它而非直接 .median() db/writer.py — 加 _pseudobulk_col(rows, col) 和 refresh_all_summaries(conn),_calc_summary_row() 和 update_model_summary() 全部改用伪重复安全的聚合方式 ui/tab_leaderboard.py — Refresh 按钮触发 load_leaderboard(),其中静默调用 refresh_all_summaries(),在展示排行榜前先把历史数据全部用新方式重算ba623bd
-
The condition number κ has extreme dynamic range across layers:
Alex W.- Layer 0: κ ~ thousands (ill-conditioned) - Deep layers: κ ~ single digits (well-conditioned) On a linear y-axis, the deep-layer variation is completely invisible — the early-layer spikes dominate the scale and compress everything else into a flat line at the bottom. This defeats the purpose of the plot. Switch the κ(Q) & κ(K) dual-line panel (row 2, col 3) to **log scale** in both rendering engines. Single-model figure — added after the two `draw()` calls: ```python ax.set_yscale("log") ``` Compare figure — same addition: ```python ax.set_yscale("log") ``` Title updated to reflect the scale: ``` "Law 3 — Condition Number κ (log scale)" y-label: "Condition number κ (log)" ``` Added inside the per-panel loop, after `fig.update_yaxes(title_text=...)`, for both `plotly_single()` and `plotly_compare()`: ```python if col == "cond_dual": fig.update_yaxes(type="log", row=row_idx, col=1) ``` ``` set_yscale("log") found 2× in core/plotter.py ✅ type="log" found 2×…e85f452 -
Three UX issues reported on Tab 5 Interactive view:
Alex W.1. **Layout unusable** — 4×3 grid compressed into a fixed Plotly canvas made each subplot too small to read. 2. **Width overflow** — matplotlib's physical canvas size (18×20 in) was inherited by `mpl_to_plotly`, causing the figure to exceed the page width. 3. **Slow response** — `mpl_to_plotly` rendered matplotlib first (server-side), then converted the entire figure to Plotly JSON. Double rendering + large polygon count from IQR bands made interaction sluggish. Root cause: all three issues trace back to a single architectural mistake — using `mpl_to_plotly` as a bridge instead of two independent rendering paths. --- **Throw away the bridge. Two completely independent engines.** ``` Interactive → core/plotter_plotly.py (native Plotly) Export → core/plotter.py (matplotlib, unchanged) ``` No conversion between them. Each optimized for its own purpose. --- Native Plotly figure generation. Zero matplotlib dependency. **Layout: 12×1 vertical stack** Eac…7ecfc20 -
Add `core/plotter.py` and `ui/tab_plot.py` to generate Nature/PRL-standard
Alex W.figures for Wang's Five Laws directly from the SQLite database. Update `app.py` to mount the new Tab 5. --- Pure computation layer. No UI dependency, no DB dependency. Takes a `pd.DataFrame` (from `db/reader.py`) and returns `matplotlib.Figure`. - `plot_single_model()` — 4×3 grid (12 subplots), single model - `plot_compare_models()` — 4×3 grid, Model A (solid) vs Model B (dashed) - `save_figure()` — exports PNG (300 dpi) + PDF (vector) + SVG (vector) - `fig_to_plotly()` — converts matplotlib Figure to Plotly for interactive preview - `fig_to_png_bytes()` — in-memory PNG bytes for Gradio Image component Gradio Tab 5 interface. Calls `core/plotter.py` and `db/reader.py` only. - Single-model mode: select model → generate → preview → download - Two-model comparison mode: select A & B → generate → preview → download - Controls: modality filter, layer range, band toggle, delta toggle - Download: PNG / PDF / SVG / ZIP (all formats bundled) --- - Added `from ui.tab_plot import build_tab…9d65593