MCPcopy Create free account
hub / github.com/microsoft/BitNet / run_benchmark

Function run_benchmark

utils/e2e_benchmark.py:25–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23 sys.exit(1)
24
25def run_benchmark():
26 build_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "build")
27 if platform.system() == "Windows":
28 bench_path = os.path.join(build_dir, "bin", "Release", "llama-bench.exe")
29 if not os.path.exists(bench_path):
30 bench_path = os.path.join(build_dir, "bin", "llama-bench")
31 else:
32 bench_path = os.path.join(build_dir, "bin", "llama-bench")
33 if not os.path.exists(bench_path):
34 logging.error(f"Benchmark binary not found, please build first.")
35 sys.exit(1)
36 command = [
37 f'{bench_path}',
38 '-m', args.model,
39 '-n', str(args.n_token),
40 '-ngl', '0',
41 '-b', '1',
42 '-t', str(args.threads),
43 '-p', str(args.n_prompt),
44 '-r', '5'
45 ]
46 run_command(command)
47
48def parse_args():
49 parser = argparse.ArgumentParser(description='Setup the environment for running the inference')

Callers 1

e2e_benchmark.pyFile · 0.85

Calls 1

run_commandFunction · 0.70

Tested by

no test coverage detected