Skip to content

Commit

Permalink
Adding support for Turbo model
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus committed Oct 19, 2024
1 parent 56d7835 commit 373b0d6
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 129 deletions.
1 change: 1 addition & 0 deletions buzz/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class WhisperModelSize(str, enum.Enum):
LARGE = "large"
LARGEV2 = "large-v2"
LARGEV3 = "large-v3"
LARGEV3TURBO = "large-v3-turbo"
CUSTOM = "custom"

def to_faster_whisper_model_size(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion buzz/transformers_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def transcribe(
use_safetensors = len(safetensors_files) > 0

model = AutoModelForSpeechSeq2Seq.from_pretrained(
self.model_id, torch_dtype=torch_dtype, use_safetensors=use_safetensors
self.model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=use_safetensors
)

model.generation_config.language = language
Expand Down
5 changes: 5 additions & 0 deletions buzz/widgets/preferences_dialog/models_preferences_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ def reset(self):
model_size == WhisperModelSize.CUSTOM):
continue

# Skip turbo model for Faste Whisper and Whisper.cpp
if (self.model.model_type in {ModelType.FASTER_WHISPER, ModelType.WHISPER_CPP} and
model_size == WhisperModelSize.LARGEV3TURBO):
continue

Check warning on line 187 in buzz/widgets/preferences_dialog/models_preferences_widget.py

View check run for this annotation

Codecov / codecov/patch

buzz/widgets/preferences_dialog/models_preferences_widget.py#L187

Added line #L187 was not covered by tests

model = TranscriptionModel(
model_type=self.model.model_type,
whisper_model_size=WhisperModelSize(model_size),
Expand Down
6 changes: 5 additions & 1 deletion buzz/widgets/transcriber/transcription_options_group_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(

self.whisper_model_size_combo_box = QComboBox(self)
self.whisper_model_size_combo_box.addItems(
[size.value.title() for size in WhisperModelSize if size != WhisperModelSize.CUSTOM]
[size.value.title() for size in WhisperModelSize if size not in {WhisperModelSize.CUSTOM, WhisperModelSize.LARGEV3TURBO}]
)
self.whisper_model_size_combo_box.currentTextChanged.connect(
self.on_whisper_model_size_changed
Expand Down Expand Up @@ -141,6 +141,10 @@ def reset_visible_rows(self):
and whisper_model_size == WhisperModelSize.CUSTOM),
)

if model_type == ModelType.WHISPER:
if self.whisper_model_size_combo_box.findText(WhisperModelSize.LARGEV3TURBO.value.title()) == -1:
self.whisper_model_size_combo_box.addItem(WhisperModelSize.LARGEV3TURBO.value.title())

custom_model_index = (self.whisper_model_size_combo_box
.findText(WhisperModelSize.CUSTOM.value.title()))
if (model_type == ModelType.WHISPER
Expand Down
Loading

0 comments on commit 373b0d6

Please sign in to comment.