Fix for Faster whisper (#1170)

This commit is contained in:
Raivis Dejus 2025-05-18 16:33:46 +03:00 committed by GitHub
commit 5810ac4a2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

View file

@ -417,6 +417,7 @@ def download_faster_whisper_model(
"model.bin", # largest by size first
"pytorch_model.bin", # possible alternative model filename
"config.json",
"preprocessor_config.json",
"tokenizer.json",
"vocabulary.*",
]

View file

@ -100,11 +100,14 @@ class RecordingTranscriber(QObject):
device=device,
)
# This was commented out as it was causing issues. On the other hand some users are reporting errors without
# this. It is possible isseus were present in older model versions without some config files and now are fixed
#
# Fix for large-v3 https://github.com/guillaumekln/faster-whisper/issues/547#issuecomment-1797962599
if self.transcription_options.model.whisper_model_size == WhisperModelSize.LARGEV3:
model.feature_extractor.mel_filters = model.feature_extractor.get_mel_filters(
model.feature_extractor.sampling_rate, model.feature_extractor.n_fft, n_mels=128
)
# if self.transcription_options.model.whisper_model_size in {WhisperModelSize.LARGEV3, WhisperModelSize.LARGEV3TURBO}:
# model.feature_extractor.mel_filters = model.feature_extractor.get_mel_filters(
# model.feature_extractor.sampling_rate, model.feature_extractor.n_fft, n_mels=128
# )
elif self.transcription_options.model.model_type == ModelType.OPEN_AI_WHISPER_API:
custom_openai_base_url = self.settings.value(
key=Settings.Key.CUSTOM_OPENAI_BASE_URL, default_value=""
@ -190,7 +193,8 @@ class RecordingTranscriber(QObject):
task=self.transcription_options.task.value,
temperature=self.transcription_options.temperature,
initial_prompt=self.transcription_options.initial_prompt,
word_timestamps=self.transcription_options.word_level_timings,
word_timestamps=False,
without_timestamps=True,
no_speech_threshold=0.4,
)
result = {"text": " ".join([segment.text for segment in whisper_segments])}

View file

@ -347,7 +347,7 @@ class RecordingTranscriberWidget(QWidget):
self.on_cancel_model_progress_dialog
)
if self.model_download_progress_dialog is not None:
if self.model_download_progress_dialog is not None and total_size > 0:
self.model_download_progress_dialog.set_value(
fraction_completed=current_size / total_size
)