Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for large v3 faster whisper model #815

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions buzz/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ def download_faster_whisper_model(
"config.json",
"tokenizer.json",
"vocabulary.txt",
"vocabulary.json",
]

if local_files_only:
Expand Down
8 changes: 7 additions & 1 deletion buzz/transcriber/recording_transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from PyQt6.QtCore import QObject, pyqtSignal

from buzz import transformers_whisper, whisper_audio
from buzz.model_loader import ModelType, get_custom_api_whisper_model
from buzz.model_loader import WhisperModelSize, ModelType, get_custom_api_whisper_model
from buzz.settings.settings import Settings
from buzz.transcriber.transcriber import TranscriptionOptions, Task
from buzz.transcriber.whisper_cpp import WhisperCpp, whisper_cpp_params
Expand Down Expand Up @@ -68,6 +68,12 @@
model = WhisperCpp(model_path)
elif self.transcription_options.model.model_type == ModelType.FASTER_WHISPER:
model = faster_whisper.WhisperModel(model_path)

# 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(

Check warning on line 74 in buzz/transcriber/recording_transcriber.py

View check run for this annotation

Codecov / codecov/patch

buzz/transcriber/recording_transcriber.py#L73-L74

Added lines #L73 - L74 were not covered by tests
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:
settings = Settings()
custom_openai_base_url = settings.value(
Expand Down
Loading