Skip to content

Commit

Permalink
Fix benchmark code
Browse files Browse the repository at this point in the history
  • Loading branch information
AyiStar committed Jul 30, 2024
1 parent 5db1e5a commit 33bc4cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions test/collect_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
result_dict = {}
for x in all_results:
key = (x['model'], x['data_type'])
result_dict.setdefault(key, [None] * 4)
assert result_dict[key][x['opt_level']] is None
result_dict.setdefault(key, [('', '')] * 4)
assert result_dict[key][x['opt_level']] == ('', '')
result_dict[key][x['opt_level']] = (x['pe_toks'], x['tg_toks'])
for k in result_dict:
assert all(v is not None for v in result_dict[k]), f'result for {k} has None: {result_dict[k]}'
# prompt evaluation table
headers[0] = "Prompt Evaluation Performance (Tokens/Sec)"
value_matrix = [
Expand Down
9 changes: 5 additions & 4 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ def run_benchmark(ggml_type: str, n_threads: int=1, n_iters: int=1) -> list[str]

@staticmethod
def run_main(model_path: str, n_threads: int=1, prompt: str='Hello', n_tokens: int=100) -> list[str]:
benchmark_options = [
options = [
'-m', model_path,
'-t', str(n_threads),
'-n', str(n_tokens),
'-p', prompt
'-p', prompt,
'--mlock', '--ignore-eos'
]
run_cmd = ['./src/main'] + benchmark_options
return run_cmd
run_cmd = ['./src/main'] + options
return run_cmd

0 comments on commit 33bc4cb

Please sign in to comment.