mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-05-31 15:05:58 +02:00
Incorrect timetstamps
Fixes #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.
This commit is contained in:
parent
c118733a29
commit
3e99276a27
@ -6240,11 +6240,15 @@ int whisper_full_with_state(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
text = "";
|
text = "";
|
||||||
|
t0 = t1;
|
||||||
while (i < (int) tokens_cur.size() && tokens_cur[i].id > whisper_token_beg(ctx)) {
|
while (i < (int) tokens_cur.size() && tokens_cur[i].id > whisper_token_beg(ctx)) {
|
||||||
|
if (params.print_special) {
|
||||||
|
text += whisper_token_to_str(ctx, tokens_cur[i].id);
|
||||||
|
}
|
||||||
|
t0 = seek + 2 * (tokens_cur[i].tid - whisper_token_beg(ctx));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
t0 = t1;
|
|
||||||
i0 = i + 1;
|
i0 = i + 1;
|
||||||
speaker_turn_next = false;
|
speaker_turn_next = false;
|
||||||
}
|
}
|
||||||
@ -6261,8 +6265,8 @@ int whisper_full_with_state(
|
|||||||
printf("[%s --> %s] %s\n", to_timestamp(tt0).c_str(), to_timestamp(tt1).c_str(), text.c_str());
|
printf("[%s --> %s] %s\n", to_timestamp(tt0).c_str(), to_timestamp(tt1).c_str(), text.c_str());
|
||||||
} else {
|
} else {
|
||||||
printf("%s", text.c_str());
|
printf("%s", text.c_str());
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
result_all.push_back({ tt0, tt1, text, {} , speaker_turn_next });
|
result_all.push_back({ tt0, tt1, text, {} , speaker_turn_next });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user