feat(stream): add append-only streaming mode with flat cost
Add an append-only streaming path that feeds each audio chunk as a new conversation turn, so nothing is ever recomputed: the KV grows by append, no prefix is re-decoded and no audio is re-encoded. Per-step cost becomes flat instead of growing with the segment (RTF 1.06 -> 0.26 on 62.6s of continuous speech), but accuracy requires ~8s chunks because the audio encoder needs its 8s attention window, so text only appears every 8s. The incremental mode stays the default. 新增追加式流式:每块音频作为一个新的对话轮追加,前缀不重算、旧音频不重 编码,单步成本不再随段落增长(连续 62.6s 语音 RTF 从 1.06 降到 0.26)。 但准确率要求 chunk≈8s,否则会被截断,所以出字粒度是 8s;增量式仍为默认。
This commit is contained in:
1 parent
7e5257429a
commit
85b206f1cd
10 files changed
+330
-18
No files matched your search
@@ -44,7 +44,8 @@ inline void addStreamOptions(QCommandLineParser & p)
|
||||
p.addOption(makeOption("stream-segment", "单段最长时长,单位秒;0=不限", "sec", "30"));
|
||||
p.addOption(makeOption("unfixed-tokens", "前缀回滚丢弃的 token 数", "n", "5"));
|
||||
p.addOption(makeOption("unfixed-chunks", "冷启动不带前缀的 chunk 数", "n", "2"));
|
||||
p.addOption(makeOption("stream-mode", "流式后端: incremental 或 window", "mode", "incremental"));
|
||||
p.addOption(makeOption("stream-mode", "流式后端: incremental / append / window", "mode",
|
||||
"incremental"));
|
||||
}
|
||||
|
||||
inline AsrOptions asrOptions(const QCommandLineParser & p)
|
||||
@@ -67,7 +68,8 @@ inline StreamOptions streamOptions(const QCommandLineParser & p)
|
||||
o.unfixedTokenNum = p.value("unfixed-tokens").toInt();
|
||||
o.unfixedChunkNum = p.value("unfixed-chunks").toInt();
|
||||
o.maxTokensPerStep = p.value("max-tokens").toInt();
|
||||
o.incremental = p.value("stream-mode") != QLatin1String("window");
|
||||
o.incremental = p.value("stream-mode") == QLatin1String("incremental");
|
||||
o.appendOnly = p.value("stream-mode") == QLatin1String("append");
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user