Skip to content

Commit acdce3c

Browse files
authored
compare-llama-bench.py: add missing basicConfig (ggml-org#7138)
* compare-llama-bench.py: add missing basicConfig * compare-llama-bench.py: Add line break between error message and print_help() * Add regular print() markdown table
1 parent 3855416 commit acdce3c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scripts/compare-llama-bench.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@
9393
"specified values are averaged WITHOUT weighing by the --repetitions parameter of llama-bench."
9494
)
9595
parser.add_argument("-s", "--show", help=help_s)
96+
parser.add_argument("--verbose", action="store_true", help="increase output verbosity")
9697

9798
known_args, unknown_args = parser.parse_known_args()
9899

100+
logging.basicConfig(level=logging.DEBUG if known_args.verbose else logging.INFO)
101+
99102
if unknown_args:
100-
logger.error(f"Received unknown args: {unknown_args}.")
103+
logger.error(f"Received unknown args: {unknown_args}.\n")
101104
parser.print_help()
102105
sys.exit(1)
103106

@@ -110,7 +113,7 @@
110113
input_file = sqlite_files[0]
111114

112115
if input_file is None:
113-
logger.error("Cannot find a suitable input file, please provide one.")
116+
logger.error("Cannot find a suitable input file, please provide one.\n")
114117
parser.print_help()
115118
sys.exit(1)
116119

@@ -202,12 +205,12 @@ def get_commit_hexsha8(name):
202205
hexsha8_baseline = find_parent_in_data(repo.heads.master.commit)
203206

204207
if hexsha8_baseline is None:
205-
logger.error("No baseline was provided and did not find data for any master branch commits.")
208+
logger.error("No baseline was provided and did not find data for any master branch commits.\n")
206209
parser.print_help()
207210
sys.exit(1)
208211
else:
209212
logger.error("No baseline was provided and the current working directory "
210-
"is not part of a git repository from which a baseline could be inferred.")
213+
"is not part of a git repository from which a baseline could be inferred.\n")
211214
parser.print_help()
212215
sys.exit(1)
213216

@@ -238,7 +241,7 @@ def get_commit_hexsha8(name):
238241
break
239242

240243
if hexsha8_compare is None:
241-
logger.error("No compare target was provided and did not find data for any non-master commits.")
244+
logger.error("No compare target was provided and did not find data for any non-master commits.\n")
242245
parser.print_help()
243246
sys.exit(1)
244247
else:
@@ -361,7 +364,7 @@ def get_rows(properties):
361364
headers = [PRETTY_NAMES[p] for p in show]
362365
headers += ["Test", f"t/s {name_baseline}", f"t/s {name_compare}", "Speedup"]
363366

364-
logger.info(tabulate(
367+
print(tabulate( # noqa: NP100
365368
table,
366369
headers=headers,
367370
floatfmt=".2f",

0 commit comments

Comments
 (0)