| 56 | |
| 57 | |
| 58 | def 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 | |
| 84 | def derive_title(csv_path): |