Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latency test enhancement - part 1 #909

Merged
merged 4 commits into from
Aug 4, 2024
Merged

Conversation

min-xu-et
Copy link
Contributor

@min-xu-et min-xu-et commented Aug 4, 2024

This is part 1 of change to make latency test generate graph.

  • this makes the batch_size arg a list, but user can continue use it the same way as before when specifying a single value
  • this optionally dumps the results in a json file. example:
$ cat out.json
[
  {
    "batch_size": 1,
    "output_len": 256,
    "prefill_latency": 0.12703561782836914,
    "prefill_throughput": 4030.3657253962833,
    "avg_decode_latency": 0.05401019565761089,
    "avg_decode_throughput": 18.515022725326567,
    "total_latency": 13.953645706176758,
    "total_throughput": 55.03937939745991
  },
  {
    "batch_size": 1,
    "output_len": 256,
    "prefill_latency": 0.137282133102417,
    "prefill_throughput": 3729.545778677777,
    "avg_decode_latency": 0.054004695266485214,
    "avg_decode_throughput": 18.516908484818174,
    "total_latency": 13.962484121322632,
    "total_throughput": 55.00453882895798
  }
]

python/sglang/bench_latency.py Show resolved Hide resolved
python/sglang/bench_latency.py Outdated Show resolved Hide resolved
- testing output

```
In [3]: with open("out.jsonl", "r") as f:
   ...:     for l in f.readlines():
   ...:         print(json.loads(l))
   ...:         print("-"*80)
   ...:
{'batch_size': 1, 'output_len': 256, 'prefill_latency': 0.13420748710632324, 'prefill_throughput': 3814.9883515394195, 'avg_decode_latency': 0.053959593176841736, 'avg_decode_throughput': 18.532385830313817, 'total_latency': 13.947863340377808, 'total_throughput': 55.06219707334737}
--------------------------------------------------------------------------------
{'batch_size': 1, 'output_len': 256, 'prefill_latency': 0.13029885292053223, 'prefill_throughput': 3929.4282990523557, 'avg_decode_latency': 0.05398500803858042, 'avg_decode_throughput': 18.523661222488833, 'total_latency': 13.95046091079712, 'total_throughput': 55.051944513575}
--------------------------------------------------------------------------------
{'batch_size': 1, 'output_len': 256, 'prefill_latency': 0.13561320304870605, 'prefill_throughput': 3775.4436034971686, 'avg_decode_latency': 0.05398557987064123, 'avg_decode_throughput': 18.52346501410511, 'total_latency': 13.955921649932861, 'total_throughput': 55.03040352793143}
--------------------------------------------------------------------------------
```
@min-xu-et min-xu-et requested a review from merrymercy August 4, 2024 04:54
- simpler code
@Ying1123 Ying1123 merged commit 5398564 into sgl-project:main Aug 4, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants