From ec1b34bb90dc2822ce4ebac23970b84dbb03ec6c Mon Sep 17 00:00:00 2001 From: jumon Date: Mon, 5 Dec 2022 08:27:42 +0900 Subject: [PATCH] fix compression ratio function (#561) --- whisper/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/whisper/utils.py b/whisper/utils.py index 87c91f2..233d3d4 100644 --- a/whisper/utils.py +++ b/whisper/utils.py @@ -24,7 +24,8 @@ def optional_float(string): def compression_ratio(text) -> float: - return len(text) / len(zlib.compress(text.encode("utf-8"))) + text_bytes = text.encode("utf-8") + return len(text_bytes) / len(zlib.compress(text_bytes)) def format_timestamp(seconds: float, always_include_hours: bool = False, decimal_marker: str = '.'):