Skip to content

Commit

Permalink
refactor: Fix floating point precision issue in whisper-processing.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Jun 4, 2024
1 parent c69f6eb commit 260448e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/whisper-utils/whisper-processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ struct DetectionResultWithText run_whisper_inference(struct transcription_filter
}
// token ids https://huggingface.co/openai/whisper-large-v3/raw/main/tokenizer.json
if (token.id > 50365 && token.id <= 51865) {
const float time = ((float)token.id - 50365.0f) * 0.02;
const float time = ((float)token.id - 50365.0f) * 0.02f;
const float duration_s = (float)duration_ms / 1000.0f;
const float ratio = std::max(time, duration_s) /
std::min(time, duration_s);
Expand Down

0 comments on commit 260448e

Please sign in to comment.