This commit is contained in:
hailin 2025-07-08 11:33:10 +08:00
parent 6f1c422871
commit 5eff648d8b
1 changed files with 11 additions and 16 deletions

View File

@ -2,27 +2,23 @@ import gradio as gr
import subprocess
def run_eval(inputs, native, other, outputs, api_url, api_token):
# 构造命令
timestamp = time.strftime("%Y%m%d-%H%M%S") # 生成当前时间戳作为 model 名
command = [
"evalscope", "perf",
"--parallel", "20",
"--model", "Qwen2.5-0.5B-Instruct",
"--url", api_url.strip(),
"--api", "openai",
"--token", api_token.strip(),
"--dataset", "random",
"--min-tokens", "128",
"--max-tokens", "128",
"--prefix-length", "64",
"--min-prompt-length", "1024",
"--max-prompt-length", "2048",
"--model", timestamp, # ✅ 使用时间戳作为 --model
"--dataset", "openqa",
"--max-tokens", "1024",
"--min-tokens", "1024",
"--parallel", "1",
"--max-prompt-length", "15360",
"--number", "100",
"--tokenizer-path", "Qwen/Qwen2.5-0.5B-Instruct",
"--debug"
"--api-key", api_token.strip(),
]
# 执行并流式输出
yield "[Eval Started]\n"
yield f"[Eval Started @ {timestamp}]\n"
try:
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1)
for line in process.stdout:
@ -31,8 +27,7 @@ def run_eval(inputs, native, other, outputs, api_url, api_token):
process.wait()
except Exception as e:
yield f"[Error] {str(e)}\n"
yield "[Eval Finished]"
yield "[Eval Finished]\n"
def enforce_input_exclusive_and_toggle_fields(selected):
group1 = {"API Models", "Local Models"}
group2 = {"Benchmarks", "Custom Datasets"}