Only print fp16 warning once
Browse files
src/whisper/fasterWhisperContainer.py
CHANGED
@@ -77,6 +77,8 @@ class FasterWhisperCallback(AbstractWhisperCallback):
|
|
77 |
self.task = task
|
78 |
self.initial_prompt = initial_prompt
|
79 |
self.decodeOptions = decodeOptions
|
|
|
|
|
80 |
|
81 |
def invoke(self, audio, segment_index: int, prompt: str, detected_language: str, progress_listener: ProgressListener = None):
|
82 |
"""
|
@@ -107,7 +109,9 @@ class FasterWhisperCallback(AbstractWhisperCallback):
|
|
107 |
suppress_tokens = decodeOptions.pop("suppress_tokens", None)
|
108 |
|
109 |
if (decodeOptions.pop("fp16", None) is not None):
|
110 |
-
|
|
|
|
|
111 |
|
112 |
# Fix up decode options
|
113 |
if (logprob_threshold is not None):
|
|
|
77 |
self.task = task
|
78 |
self.initial_prompt = initial_prompt
|
79 |
self.decodeOptions = decodeOptions
|
80 |
+
|
81 |
+
self._printed_warning = False
|
82 |
|
83 |
def invoke(self, audio, segment_index: int, prompt: str, detected_language: str, progress_listener: ProgressListener = None):
|
84 |
"""
|
|
|
109 |
suppress_tokens = decodeOptions.pop("suppress_tokens", None)
|
110 |
|
111 |
if (decodeOptions.pop("fp16", None) is not None):
|
112 |
+
if not self._printed_warning:
|
113 |
+
print("WARNING: fp16 option is ignored by faster-whisper - use compute_type instead.")
|
114 |
+
self._printed_warning = True
|
115 |
|
116 |
# Fix up decode options
|
117 |
if (logprob_threshold is not None):
|