Run benchmark test
(self)
| 64 | return True |
| 65 | |
| 66 | def run_benchmark(self): |
| 67 | """Run benchmark test""" |
| 68 | cmd = [ |
| 69 | f"{self.build_dir}/bin/llama-bench", |
| 70 | "-m", self.model_path, |
| 71 | "-p", "128", |
| 72 | "-n", "0", |
| 73 | "-t", str(self.threads), |
| 74 | "-ngl", "0" |
| 75 | ] |
| 76 | |
| 77 | print(f"⚡ Running benchmark: {' '.join(cmd)}") |
| 78 | |
| 79 | result = subprocess.run( |
| 80 | cmd, |
| 81 | capture_output=True, |
| 82 | text=True, |
| 83 | cwd=os.getcwd(), |
| 84 | timeout=300 # 5分钟超时 |
| 85 | ) |
| 86 | |
| 87 | if result.returncode != 0: |
| 88 | print(f"❌ Benchmark failed: {result.stderr}") |
| 89 | return None |
| 90 | |
| 91 | return result.stdout |
| 92 | |
| 93 | def parse_throughput(self, output): |
| 94 | """Parse pp128 throughput from output""" |
no outgoing calls