Strip the leading space before computing the compression ratio

This commit is contained in:
Guillaume Klein
2023-02-22 10:28:04 +01:00
parent e47e00910a
commit 4b8237da1b

View File

@@ -338,7 +338,7 @@ class WhisperModel:
avg_log_prob = cum_log_prob / (seq_len + 1)
tokens = result.sequences_ids[0]
text = self.decode_text_tokens(tokens)
text = self.decode_text_tokens(tokens).strip()
compression_ratio = get_compression_ratio(text)
if (