Update modules/whisper/faster_whisper_inference.py
Browse files
modules/whisper/faster_whisper_inference.py
CHANGED
|
@@ -187,12 +187,12 @@ class FasterWhisperInference(WhisperBase):
|
|
| 187 |
else:
|
| 188 |
return "auto"
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
|
|
|
| 187 |
else:
|
| 188 |
return "auto"
|
| 189 |
|
| 190 |
+
@staticmethod
|
| 191 |
+
def format_suppress_tokens_str(suppress_tokens_str: str) -> List[int]:
|
| 192 |
+
try:
|
| 193 |
+
suppress_tokens = ast.literal_eval(suppress_tokens_str)
|
| 194 |
+
if not isinstance(suppress_tokens, list) or not all(isinstance(item, int) for item in suppress_tokens):
|
| 195 |
+
raise ValueError("Invalid Suppress Tokens. The value must be type of List[int]")
|
| 196 |
+
return suppress_tokens
|
| 197 |
+
except Exception as e:
|
| 198 |
+
raise ValueError("Invalid Suppress Tokens. The value must be type of List[int]")
|