v2.0.0:多上下文长度测试(默认512/2048/8192/32768/131072)+测试前空转预热(不计速度)+解码输出默认128+每长度采样默认2+Excel(xlsx)导出+详情按长度分组+接口输入框图标美化+README文档
This commit is contained in:
+14
-4
@@ -39,6 +39,7 @@ CREATE TABLE IF NOT EXISTS test_runs(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
test_id INTEGER NOT NULL,
|
||||
run_index INTEGER DEFAULT 0,
|
||||
context_length INTEGER DEFAULT 0,
|
||||
metrics_json TEXT DEFAULT '{}',
|
||||
error TEXT DEFAULT ''
|
||||
);
|
||||
@@ -65,11 +66,20 @@ def _connect():
|
||||
return conn
|
||||
|
||||
|
||||
def _migrate(conn):
|
||||
"""老库升级:为 test_runs 补 context_length 列"""
|
||||
cur = conn.execute("PRAGMA table_info(test_runs)")
|
||||
cols = [r[1] for r in cur.fetchall()]
|
||||
if "context_length" not in cols:
|
||||
conn.execute("ALTER TABLE test_runs ADD COLUMN context_length INTEGER DEFAULT 0")
|
||||
|
||||
|
||||
def init_db():
|
||||
with _lock:
|
||||
conn = _connect()
|
||||
try:
|
||||
conn.executescript(SCHEMA)
|
||||
_migrate(conn)
|
||||
conn.commit()
|
||||
finally:
|
||||
conn.close()
|
||||
@@ -202,13 +212,13 @@ def delete_test(tid: int):
|
||||
|
||||
# ───────────────────────── 采样指标 ─────────────────────────
|
||||
|
||||
def add_run(tid: int, run_index: int, metrics: dict, error: str = ""):
|
||||
def add_run(tid: int, run_index: int, metrics: dict, error: str = "", context_length: int = 0):
|
||||
with _lock:
|
||||
conn = _connect()
|
||||
try:
|
||||
conn.execute(
|
||||
"INSERT INTO test_runs(test_id,run_index,metrics_json,error) VALUES(?,?,?,?)",
|
||||
(tid, run_index, json.dumps(metrics, ensure_ascii=False), error))
|
||||
"INSERT INTO test_runs(test_id,run_index,context_length,metrics_json,error) VALUES(?,?,?,?,?)",
|
||||
(tid, run_index, context_length, json.dumps(metrics, ensure_ascii=False), error))
|
||||
conn.commit()
|
||||
finally:
|
||||
conn.close()
|
||||
@@ -219,7 +229,7 @@ def get_runs(tid: int):
|
||||
conn = _connect()
|
||||
try:
|
||||
rows = conn.execute(
|
||||
"SELECT run_index,metrics_json,error FROM test_runs "
|
||||
"SELECT run_index,context_length,metrics_json,error FROM test_runs "
|
||||
"WHERE test_id=? ORDER BY run_index", (tid,)).fetchall()
|
||||
out = []
|
||||
for r in rows:
|
||||
|
||||
Reference in New Issue
Block a user