From 0b731978ef59d01b4fd559e31e8c00b63cbae28e Mon Sep 17 00:00:00 2001 From: liwenhao2 Date: Wed, 16 Sep 2026 10:52:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E9=A2=84=E7=AE=97=E5=88=86?= =?UTF-8?q?=E9=85=8D=E4=BF=AE=E5=A4=8D+genfail=E8=AF=8A=E6=96=AD:=E5=BD=95?= =?UTF-8?q?=E9=9F=B3=E4=B8=AD1B=E9=87=8D=E8=AF=95=E9=A2=84=E7=AE=97?= =?UTF-8?q?=E9=99=8D=E5=88=B01=E6=AC=A1(=E4=B8=A4=E6=AC=A1=E5=B0=9D?= =?UTF-8?q?=E8=AF=95~30s),=E7=BB=99=E5=85=9C=E5=BA=95=E7=95=99=E5=87=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=AA=97=E2=80=94=E2=80=94=E7=8E=B0=E5=9C=BA?= =?UTF-8?q?15s=C3=973=E5=90=83=E6=BB=A145s=E9=A2=84=E7=AE=97=E8=87=B4TAP-F?= =?UTF-8?q?ALLBACK=20skipped=3Dbudget;TRANSLATE=20single/batch=20empty=20?= =?UTF-8?q?=E8=AF=8A=E6=96=AD=E6=97=A5=E5=BF=97(=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=A4=B448=E5=AD=97,=E5=8C=BA=E5=88=86?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=99=BD=E5=8D=B7=E4=B8=8E=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E8=A2=AB=E6=B8=85=E6=B4=97=E6=88=90=E7=A9=BA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/k2fsa/sherpa/onnx/MainActivity.kt | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt b/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt index 486ac57..0ff9b25 100644 --- a/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt +++ b/app/src/main/java/com/k2fsa/sherpa/onnx/MainActivity.kt @@ -2251,6 +2251,9 @@ class MainActivity : AppCompatActivity() { ): String? { var temp = 0f var genRetry = 0 + // 重试预算:录音中只允许 1 次(两次尝试≈30s),给兜底留出时间窗—— + // 现场:三次尝试 15s×3 吃满 45s 预算,兜底被 skipped=budget 拒之门外 + val maxGenRetry = if (isRecording) 1 else 2 var ctx = context var lastRej = "" while (true) { @@ -2285,7 +2288,7 @@ class MainActivity : AppCompatActivity() { Log.i(TAG, "TAP-MISS sid=$sid reason=" + (if (raw != null) "repeat" else "genfail") + " temp=$temp" + srcTag) - if (genRetry >= 2) return null + if (genRetry >= maxGenRetry) return null genRetry++; temp = if (temp == 0f) 0.3f else 0.7f if (genRetry >= 2) ctx = "" } @@ -2294,7 +2297,7 @@ class MainActivity : AppCompatActivity() { Log.i(TAG, "TAP-MISS sid=$sid reason=echo temp=$temp" + srcTag) if (es == lastRej) return null // 复读成惯性,换温度无用 lastRej = es - if (genRetry >= 2) return null + if (genRetry >= maxGenRetry) return null genRetry++; temp = if (temp == 0f) 0.3f else 0.7f if (genRetry >= 2) ctx = "" } @@ -2488,7 +2491,13 @@ class MainActivity : AppCompatActivity() { } val tr = cleanTrans(one, segKeys[0].second) if (!tr.isNullOrEmpty()) got[segKeys[0].first] = tr - if (got.isEmpty()) return null + if (got.isEmpty()) { + // 空手而归的诊断(2026-09-16):区分「模型白卷」与「输出被清洗成空 + // (只有标签/残片)」——genfail 现场的两种死法原来看不出 + Log.w(TAG, "TRANSLATE single empty raw=" + + (one?.take(48)?.replace("\n", " ") ?: "")) + return null + } } else { val numbered = segKeys.mapIndexed { i, st -> (i + 1).toString() + ". " + st.second @@ -2544,7 +2553,11 @@ class MainActivity : AppCompatActivity() { cleanTrans(one, st.second)?.let { got[st.first] = it } } } - if (got.isEmpty()) return null + if (got.isEmpty()) { + Log.w(TAG, "TRANSLATE batch empty out=" + + (out?.take(48)?.replace("\n", " ") ?: "")) + return null + } } val res = HashMap() for ((key, _) in items) {