Skip to content

Commit 3e99276

Browse files
committed
Incorrect timetstamps
Fixes ggml-org#2271 - Adds consecutive timestamps after end of last segment as the new starting ts - Add these timestamp to output when "print-special" enabled - Fixes fflush usage in live reporting I was not able to test this with the special "token_timestamps" option.
1 parent c118733 commit 3e99276

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/whisper.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -6240,11 +6240,15 @@ int whisper_full_with_state(
62406240
}
62416241
}
62426242
text = "";
6243+
t0 = t1;
62436244
while (i < (int) tokens_cur.size() && tokens_cur[i].id > whisper_token_beg(ctx)) {
6245+
if (params.print_special) {
6246+
text += whisper_token_to_str(ctx, tokens_cur[i].id);
6247+
}
6248+
t0 = seek + 2 * (tokens_cur[i].tid - whisper_token_beg(ctx));
62446249
i++;
62456250
}
62466251
i--;
6247-
t0 = t1;
62486252
i0 = i + 1;
62496253
speaker_turn_next = false;
62506254
}
@@ -6261,8 +6265,8 @@ int whisper_full_with_state(
62616265
printf("[%s --> %s] %s\n", to_timestamp(tt0).c_str(), to_timestamp(tt1).c_str(), text.c_str());
62626266
} else {
62636267
printf("%s", text.c_str());
6264-
fflush(stdout);
62656268
}
6269+
fflush(stdout);
62666270
}
62676271

62686272
result_all.push_back({ tt0, tt1, text, {} , speaker_turn_next });

0 commit comments

Comments
 (0)