Skip to content

Commit

Permalink
Check if tokens_per_sec is available before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
mpatel31415 committed Oct 7, 2024
1 parent 952db42 commit 662ef05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions thunder/benchmarks/benchmark_litgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,9 @@ def benchmark_main(return_metrics_as_json=False, json_path="", **kwargs) -> None

print(f"Average iter time: {benchmark.perf_metrics['average_iter_time']:.2f} ms")
print(f"Memory used: {benchmark.perf_metrics['memory_used_GB']:.02f} GB")
print(f"Tokens/s: {benchmark.perf_metrics['tokens_per_sec']:.02f}")
print(f"Tokens/s/GPU: {(benchmark.perf_metrics['tokens_per_sec']/world_size):.02f}")
if "tokens_per_sec" in benchmark.perf_metrics:
print(f"Tokens/s: {benchmark.perf_metrics.get['tokens_per_sec']:.02f}")
print(f"Tokens/s/GPU: {(benchmark.perf_metrics['tokens_per_sec']/world_size):.02f}")
print(f"TFLOP/s: {benchmark.perf_metrics['model_flop_per_sec'] / 1e12:.02f}")

if benchmark.dump_memory_snapshot:
Expand Down

0 comments on commit 662ef05

Please sign in to comment.