From bdb6051b8919660c7ae9f4a934d384ba5ffdb3c7 Mon Sep 17 00:00:00 2001 From: Ryan McCormick Date: Tue, 9 Jan 2024 18:43:41 -0800 Subject: [PATCH] Implement pairwise to remove python 3.10 restriction --- src/triton_cli/profiler.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/triton_cli/profiler.py b/src/triton_cli/profiler.py index 951ebbc..48a489f 100644 --- a/src/triton_cli/profiler.py +++ b/src/triton_cli/profiler.py @@ -27,7 +27,7 @@ import json import subprocess from dataclasses import dataclass -from itertools import pairwise +from itertools import tee from pathlib import Path from typing import Optional @@ -75,6 +75,14 @@ } +# Built-in to itertools in Python 3.10+ +def pairwise(iterable): + # n=2 for pairs + a, b = tee(iterable, 2) + next(b, None) + return zip(a, b) + + @dataclass class ProfileResults: prompt_size: int