Skip to content

Commit 6e5a830

Browse files
author
ochafik
committed
fix python lints
1 parent c7fa19a commit 6e5a830

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

scripts/tool_bench.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def plot(files: List[Path], output: Optional[Path] = None, test_regex: Optional[
152152
logger.info(f"Tests: {tests}")
153153
logger.info(f"Servers: {server_names}")
154154

155-
matrix = []
156-
index = []
155+
matrix: list[list[float]] = []
156+
index: list[str] = []
157157

158158
all_cols = [
159159
(server_name, test)
@@ -227,7 +227,7 @@ def run(
227227

228228
with output.open('a' if append else 'w') as output_file:
229229

230-
def run(server: ServerProcess, *, server_name: str, model_id: str, temp: float | None = None, output_kwargs={}, request_kwargs={}):
230+
def run(server: ServerProcess, *, server_name: str, model_id: str, temp: Optional[float] = None, output_kwargs={}, request_kwargs={}):
231231
request_kwargs = {**request_kwargs}
232232
if temp is not None:
233233
request_kwargs['temperature'] = temp
@@ -254,7 +254,7 @@ def run(server: ServerProcess, *, server_name: str, model_id: str, temp: float |
254254
failures = []
255255
success_times = []
256256
failure_times = []
257-
print(f"Running {test_name} ({server_name}, {model}): ", file=sys.stderr, flush=True)
257+
logger.info(f"Running {test_name} ({server_name}, {model}): ")
258258
for i in range(n):
259259
start_time = time.time()
260260

@@ -265,17 +265,14 @@ def elapsed():
265265
test(server)
266266
success_times.append(elapsed())
267267
success_count += 1
268-
print('.', end='', file=sys.stderr, flush=True)
268+
logger.info('success')
269269
except Exception as e:
270-
print('!', end='', file=sys.stderr, flush=True)
271-
if failure_count == 0:
272-
print(f" ({e}) ", end='', file=sys.stderr, flush=True)
270+
logger.error(f'failure: {e}')
273271
failure_count += 1
274272
failure_times.append(elapsed())
275273
failures.append(str(e))
276274
# import traceback
277275
# traceback.print_exc()
278-
print('\n', file=sys.stderr, flush=True)
279276
output_file.write(json.dumps({**output_kwargs, **dict(
280277
model=model,
281278
server_name=server_name,

0 commit comments

Comments
 (0)