Skip to content

Commit 4af648c

Browse files
committed
[Chore] Fix pre-commit formatting for hash benchmarks
Signed-off-by: LuminolT <[email protected]>
1 parent cefd2f6 commit 4af648c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

benchmarks/benchmark_hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import random
1717
import statistics
1818
import time
19-
from typing import Callable, Iterable
19+
from collections.abc import Callable, Iterable
2020

2121
from vllm.utils.hashing import sha256, xxhash
2222

benchmarks/hash_perf_demo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ def main() -> None:
8686
)
8787
args = parser.parse_args()
8888

89-
blocks = _generate_blocks(args.num_blocks, args.block_size, args.vocab_size, args.seed)
89+
blocks = _generate_blocks(
90+
args.num_blocks, args.block_size, args.vocab_size, args.seed
91+
)
9092
print(
9193
f"Benchmarking {len(args.algorithms)} algorithms on "
9294
f"{args.num_blocks} blocks (block size={args.block_size})."
@@ -100,7 +102,7 @@ def main() -> None:
100102
avg, best, throughput = result
101103
print(
102104
f"{algo:14s} avg: {avg:.6f}s best: {best:.6f}s "
103-
f"throughput: {throughput/1e6:.2f}M tokens/s"
105+
f"throughput: {throughput / 1e6:.2f}M tokens/s"
104106
)
105107

106108

vllm/utils/hashing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
from typing import Any
1010

1111
import cbor2
12+
1213
try:
13-
import xxhash as _xxhash
14-
if not hasattr(_xxhash, "xxh3_128_digest"):
15-
_xxhash = None
14+
import xxhash as _xxhash
15+
16+
if not hasattr(_xxhash, "xxh3_128_digest"):
17+
_xxhash = None
1618
except ImportError: # pragma: no cover
1719
_xxhash = None
1820

0 commit comments

Comments
 (0)