Skip to content

Commit

Permalink
compare-llama-bench.py: add missing basicConfig (ggerganov#7138)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mofosyne authored May 8, 2024
1 parent 3855416 commit acdce3c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions scripts/compare-llama-bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@
"specified values are averaged WITHOUT weighing by the --repetitions parameter of llama-bench."
)
parser.add_argument("-s", "--show", help=help_s)
parser.add_argument("--verbose", action="store_true", help="increase output verbosity")

known_args, unknown_args = parser.parse_known_args()

logging.basicConfig(level=logging.DEBUG if known_args.verbose else logging.INFO)

if unknown_args:
logger.error(f"Received unknown args: {unknown_args}.")
logger.error(f"Received unknown args: {unknown_args}.\n")
parser.print_help()
sys.exit(1)

Expand All @@ -110,7 +113,7 @@
input_file = sqlite_files[0]

if input_file is None:
logger.error("Cannot find a suitable input file, please provide one.")
logger.error("Cannot find a suitable input file, please provide one.\n")
parser.print_help()
sys.exit(1)

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

if hexsha8_baseline is None:
logger.error("No baseline was provided and did not find data for any master branch commits.")
logger.error("No baseline was provided and did not find data for any master branch commits.\n")
parser.print_help()
sys.exit(1)
else:
logger.error("No baseline was provided and the current working directory "
"is not part of a git repository from which a baseline could be inferred.")
"is not part of a git repository from which a baseline could be inferred.\n")
parser.print_help()
sys.exit(1)

Expand Down Expand Up @@ -238,7 +241,7 @@ def get_commit_hexsha8(name):
break

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

logger.info(tabulate(
print(tabulate( # noqa: NP100
table,
headers=headers,
floatfmt=".2f",
Expand Down

0 comments on commit acdce3c

Please sign in to comment.