Skip to content

Commit

Permalink
Fix for default HF model (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus authored Jun 22, 2024
1 parent 2d5684c commit 0046139
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ On versions prior to Ubuntu 24.04 install `sudo apt-get install --no-install-rec
7. Build Buzz `poetry build`
8. Run Buzz `python -m buzz`

#### Error for Faster Whisper on GPU `Could not load library libcudnn_ops_infer.so.8`

You need to add path to the library to the `LD_LIBRARY_PATH` environment variable.
Check exact path to your poetry virtual environment, it may be different for you.

```
export LD_LIBRARY_PATH=/home/PutYourUserNameHere/.cache/pypoetry/virtualenvs/buzz-captions-JjGFxAW6-py3.12/lib/python3.12/site-packages/nvidia/cudnn/lib/:$LD_LIBRARY_PATH
```
### Windows

Assumes you have [Git](https://git-scm.com/downloads) and [python](https://www.python.org/downloads) installed and added to PATH.
Expand Down
2 changes: 1 addition & 1 deletion buzz/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def is_manually_downloadable(self):
class TranscriptionModel:
model_type: ModelType = ModelType.WHISPER
whisper_model_size: Optional[WhisperModelSize] = WhisperModelSize.TINY
hugging_face_model_id: Optional[str] = None
hugging_face_model_id: Optional[str] = "openai/whisper-tiny"

def __str__(self):
match self.model_type:
Expand Down
5 changes: 1 addition & 4 deletions buzz/widgets/transcriber/hugging_face_search_line_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ class HuggingFaceSearchLineEdit(LineEdit):

def __init__(
self,
default_value: str,
network_access_manager: Optional[QNetworkAccessManager] = None,
parent: Optional[QWidget] = None,
):
self.settings = QSettings(APP_NAME)
default_value = self.settings.value("hugging_face_model_id", "openai/whisper-tiny")

super().__init__(default_value, parent)

self.setMinimumWidth(150)
Expand Down Expand Up @@ -76,7 +74,6 @@ def on_select_item(self):

item = self.popup.currentItem()
self.setText(item.text())
self.settings.setValue("hugging_face_model_id", item.text())
QMetaObject.invokeMethod(self, "returnPressed")
self.model_selected.emit(item.data(Qt.ItemDataRole.UserRole))

Expand Down
5 changes: 4 additions & 1 deletion buzz/widgets/transcriber/transcription_options_group_box.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from typing import Optional, List

from PyQt6.QtCore import pyqtSignal
Expand Down Expand Up @@ -65,7 +66,9 @@ def __init__(
self.on_openai_access_token_edit_changed
)

self.hugging_face_search_line_edit = HuggingFaceSearchLineEdit()
self.hugging_face_search_line_edit = HuggingFaceSearchLineEdit(
default_value=default_transcription_options.model.hugging_face_model_id
)
self.hugging_face_search_line_edit.model_selected.connect(
self.on_hugging_face_model_changed
)
Expand Down
3 changes: 3 additions & 0 deletions tests/gui_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def test_should_validate_temperature(self, text: str, state: QValidator.State):
class TestHuggingFaceSearchLineEdit:
def test_should_update_selected_model_on_type(self, qtbot: QtBot):
widget = HuggingFaceSearchLineEdit(
default_value="",
network_access_manager=self.network_access_manager()
)
qtbot.add_widget(widget)
Expand All @@ -173,6 +174,7 @@ def test_should_update_selected_model_on_type(self, qtbot: QtBot):

def test_should_show_list_of_models(self, qtbot: QtBot):
widget = HuggingFaceSearchLineEdit(
default_value="",
network_access_manager=self.network_access_manager()
)
qtbot.add_widget(widget)
Expand All @@ -184,6 +186,7 @@ def test_should_show_list_of_models(self, qtbot: QtBot):

def test_should_select_model_from_list(self, qtbot: QtBot):
widget = HuggingFaceSearchLineEdit(
default_value="",
network_access_manager=self.network_access_manager()
)
qtbot.add_widget(widget)
Expand Down

0 comments on commit 0046139

Please sign in to comment.