Spaces:
Running
Running
jhj0517
commited on
Commit
·
6ced57d
1
Parent(s):
bb0ce27
Use limited parameters for English-only models
Browse files
modules/whisper/insanely_fast_whisper_inference.py
CHANGED
@@ -75,18 +75,24 @@ class InsanelyFastWhisperInference(WhisperBase):
|
|
75 |
) as progress:
|
76 |
progress.add_task("[yellow]Transcribing...", total=None)
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
segments = self.model(
|
79 |
inputs=audio,
|
80 |
return_timestamps=True,
|
81 |
chunk_length_s=params.chunk_length,
|
82 |
batch_size=params.batch_size,
|
83 |
-
generate_kwargs=
|
84 |
-
"language": params.lang,
|
85 |
-
"task": "translate" if params.is_translate and self.current_model_size in self.translatable_models else "transcribe",
|
86 |
-
"no_speech_threshold": params.no_speech_threshold,
|
87 |
-
"temperature": params.temperature,
|
88 |
-
"compression_ratio_threshold": params.compression_ratio_threshold
|
89 |
-
}
|
90 |
)
|
91 |
|
92 |
segments_result = self.format_result(
|
|
|
75 |
) as progress:
|
76 |
progress.add_task("[yellow]Transcribing...", total=None)
|
77 |
|
78 |
+
kwargs = {
|
79 |
+
"no_speech_threshold": params.no_speech_threshold,
|
80 |
+
"temperature": params.temperature,
|
81 |
+
"compression_ratio_threshold": params.compression_ratio_threshold
|
82 |
+
}
|
83 |
+
|
84 |
+
if self.current_model_size.endswith(".en"):
|
85 |
+
pass
|
86 |
+
else:
|
87 |
+
kwargs["language"] = params.lang
|
88 |
+
kwargs["task"] = "translate" if params.is_translate else "transcribe"
|
89 |
+
|
90 |
segments = self.model(
|
91 |
inputs=audio,
|
92 |
return_timestamps=True,
|
93 |
chunk_length_s=params.chunk_length,
|
94 |
batch_size=params.batch_size,
|
95 |
+
generate_kwargs=kwargs
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
)
|
97 |
|
98 |
segments_result = self.format_result(
|