()
| 23 | sys.exit(1) |
| 24 | |
| 25 | def 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 | |
| 48 | def parse_args(): |
| 49 | parser = argparse.ArgumentParser(description='Setup the environment for running the inference') |
no test coverage detected