MCPcopy Create free account
hub / github.com/antirez/ds4 / read_points

Function read_points

speed-bench/plot_speed.py:58–81  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

56
57
58def read_points(path):
59 rows = []
60 with path.open("r", encoding="utf-8-sig", newline="") as fp:
61 reader = csv.DictReader(fp)
62 required = {"ctx_tokens", "prefill_tps", "gen_tps"}
63 missing = required.difference(reader.fieldnames or ())
64 if missing:
65 missing_list = ", ".join(sorted(missing))
66 raise SystemExit(f"{path}: missing CSV column(s): {missing_list}")
67
68 for row in reader:
69 rows.append(
70 (
71 int(row["ctx_tokens"]),
72 float(row["prefill_tps"]),
73 float(row["gen_tps"]),
74 )
75 )
76
77 if len(rows) < 2:
78 raise SystemExit(f"{path}: need at least two data rows")
79
80 rows.sort(key=lambda item: item[0])
81 return rows
82
83
84def derive_title(csv_path):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected