MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / plot_strips

Function plot_strips

benchmarking/vllm/plot_tpot.py:261–366  ·  view source on GitHub ↗
(
    df: pd.DataFrame, results_dir: Path, imgs_dir: Path, fmms_name: str, fmt: str = "png"
)

Source from the content-addressed store, hash-verified

259 series=candidate_series,
260 x_col="max_concurrency",
261 y_col="speedup_pct",
262 ylabel="Speedup (%)",
263 hline=0,
264 )
265 ax.set_title(f"{model} TP{tp}")
266
267 fig.tight_layout()
268 out = speedups_dir / f"{model}.{fmt}"
269 fig.savefig(out, dpi=150, bbox_inches="tight")
270 plt.close(fig)
271 print(f"Saved to {out}")
272
273
274# ---------------------------------------------------------------------------
275# Per-model strip plots (imgs/strips/)
276# ---------------------------------------------------------------------------
277
278
279def plot_strips(
280 df: pd.DataFrame, results_dir: Path, imgs_dir: Path, fmms_name: str, fmt: str = "png"
281):
282 strips_dir = imgs_dir / "strips"
283 tp = tp_from_dir(results_dir)
284
285 variants = [BASELINE_NAME, FI2_NAME, fmms_name]
286
287 for model in MODELS:
288 mdf = df.query("model == @model and max_concurrency <= @MAX_CONCURRENCY")
289 if mdf.empty:
290 continue
291
292 present_variants = [v for v in variants if v in mdf["variant"].unique()]
293 concurrencies = sorted(mdf["max_concurrency"].unique())
294 n_conc = len(concurrencies)
295 n_variants = len(present_variants)
296
297 strips_dir.mkdir(parents=True, exist_ok=True)
298 fig, ax = plt.subplots(figsize=(max(8, n_conc * 1.8), 5))
299
300 width = 0.3
301 jitter = 0.06
302 legend_handles = {}
303
304 for i, conc in enumerate(concurrencies):
305 medians_at_conc = {}
306 positions_at_conc = {}
307 for j, variant in enumerate(present_variants):
308 offset = (j - (n_variants - 1) / 2) * width
309 pos = i + offset
310 vals = mdf.query("max_concurrency == @conc and variant == @variant")[
311 "median_tpot_ms"
312 ].values
313
314 if len(vals) == 0:
315 continue
316
317 color = VARIANT_COLORS[variant]
318 med = np.median(vals)

Callers 1

mainFunction · 0.85

Calls 1

tp_from_dirFunction · 0.85

Tested by

no test coverage detected