Add experiments/dsv4_p800_max_context_length/ to find the longest input context that P800 SGLang INT8 can serve for DeepSeek-V4-Flash-INT8. - Docker-based server start with dynamic --context-length. - Single-request, single-output-token probes for each candidate length. - Records success/failure, server args, and metrics per length. - Generates results.json and report.md summarizing the max supported length. - Smoke-tested at 4096 tokens successfully.
59 lines
2.1 KiB
Python
Executable File
59 lines
2.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Generate report.md from results.json for the max context length experiment.
|
|
|
|
Usage:
|
|
python3 parse_results.py <result_root>
|
|
"""
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def main():
|
|
result_root = Path(sys.argv[1]) if len(sys.argv) > 1 else Path("results")
|
|
results_json = result_root / "results.json"
|
|
report_path = result_root / "report.md"
|
|
|
|
with open(results_json, "r", encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
|
|
meta = data["metadata"]
|
|
cfg = data["config"]
|
|
|
|
with open(report_path, "w", encoding="utf-8") as f:
|
|
f.write("# P800 Max Context Length Exploration Report\n\n")
|
|
f.write(f"- Result root: `{result_root}`\n")
|
|
f.write(f"- Model: `{meta['model']}`\n")
|
|
f.write(f"- Hardware: {meta['hardware']}\n")
|
|
f.write(f"- TP: {cfg['tp']}, EP: {cfg['ep']}\n")
|
|
f.write(f"- Output len: {cfg['output_len']}, num prompts: {cfg['num_prompts']}, concurrency: {cfg['max_concurrency']}\n\n")
|
|
|
|
f.write("## Per-attempt results\n\n")
|
|
f.write("| Target len | Max context len | Status | TTFT mean(ms) | TTFT P95(ms) | E2E mean(ms) | E2E P99(ms) | Error |\n")
|
|
f.write("|---:|---:|---:|---:|---:|---:|---:|---:|\n")
|
|
|
|
max_supported = 0
|
|
for s in data.get("scenarios", []):
|
|
target = s["target_len"]
|
|
status = "✅ pass" if s["success"] else "❌ fail"
|
|
metrics = s.get("metrics") or {}
|
|
ttft = metrics.get("ttft_ms", {})
|
|
e2e = metrics.get("e2e_ms", {})
|
|
f.write(
|
|
f"| {target} | {s['max_context_len']} | {status} | "
|
|
f"{ttft.get('mean', 0):.2f} | {ttft.get('p95', 0):.2f} | "
|
|
f"{e2e.get('mean', 0):.2f} | {e2e.get('p99', 0):.2f} | "
|
|
f"{s.get('error', '') or ''} |\n"
|
|
)
|
|
if s["success"] and target > max_supported:
|
|
max_supported = target
|
|
|
|
f.write("\n## Maximum supported input length\n\n")
|
|
f.write(f"- **sglang-xpu**: {max_supported} tokens\n\n")
|
|
|
|
print(f"Wrote report to {report_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|