Skip to content

Commit

Permalink
Adding Core ML support for WhisperCpp
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus committed Nov 3, 2024
1 parent 386c151 commit a7ec69e
Show file tree
Hide file tree
Showing 22 changed files with 627 additions and 394 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ coverage.xml

# whisper_cpp
libwhisper.*
libwhisper-coreml.*
whisper_cpp
whisper_cpp.exe
whisper.dll
buzz/whisper_cpp.py
buzz/whisper_cpp_coreml.py

# Internationalization - compiled binaries
*.mo
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ bundle_mac: dist/Buzz.app codesign_all_mac zip_mac notarize_zip staple_app_mac d
bundle_mac_unsigned: dist/Buzz.app zip_mac dmg_mac_unsigned

UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)

LIBWHISPER :=
ifeq ($(OS), Windows_NT)
Expand All @@ -38,6 +39,8 @@ ifeq ($(OS), Windows_NT)
else
rm -f buzz/$(LIBWHISPER)
rm -f buzz/whisper_cpp.py
rm -f buzz/libwhisper-coreml.dylib || true
rm -f buzz/whisper_cpp_coreml.py || true
rm -rf whisper.cpp/build || true
rm -rf dist/* || true
endif
Expand Down Expand Up @@ -88,9 +91,23 @@ else
cp whisper.cpp/build/bin/Debug/$(LIBWHISPER) buzz || true
cp whisper.cpp/build/$(LIBWHISPER) buzz || true
endif
# Build CoreML support on ARM Macs
ifeq ($(shell uname -m), arm64)
ifeq ($(shell uname -s), Darwin)
rm -rf whisper.cpp/build || true
cmake -S whisper.cpp -B whisper.cpp/build/ $(CMAKE_FLAGS) -DWHISPER_COREML=1 -DCMAKE_OSX_ARCHITECTURES="arm64"
cmake --build whisper.cpp/build --verbose
cp whisper.cpp/build/$(LIBWHISPER) buzz/libwhisper-coreml.dylib || true
endif
endif

buzz/whisper_cpp.py: buzz/$(LIBWHISPER) translation_mo
cd buzz && ctypesgen ../whisper.cpp/whisper.h -lwhisper -o whisper_cpp.py
ifeq ($(shell uname -m), arm64)
ifeq ($(shell uname -s), Darwin)
cd buzz && ctypesgen ../whisper.cpp/whisper.h -lwhisper-coreml -o whisper_cpp_coreml.py
endif
endif

# Prints all the Mac developer identities used for code signing
print_identities_mac:
Expand Down
6 changes: 6 additions & 0 deletions buzz/assets/info-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 38 additions & 34 deletions buzz/locale/ca_ES/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: buzz\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-18 08:41+0300\n"
"POT-Creation-Date: 2024-11-03 08:32+0200\n"
"PO-Revision-Date: 2023-02-15 05:01+0000\n"
"Last-Translator: Jordi Mas i Hernàndez <[email protected]>\n"
"Language-Team: Catalan <[email protected]>\n"
Expand All @@ -26,7 +26,7 @@ msgstr ""

#: buzz/widgets/import_url_dialog.py:28
#: buzz/widgets/preferences_dialog/preferences_dialog.py:69
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:245
#: buzz/widgets/transcriber/advanced_settings_dialog.py:97
#: buzz/widgets/transcription_viewer/transcription_viewer_widget.py:295
#: buzz/widgets/main_window.py:234
Expand All @@ -35,7 +35,7 @@ msgstr ""

#: buzz/widgets/import_url_dialog.py:29
#: buzz/widgets/preferences_dialog/preferences_dialog.py:70
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:245
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:246
#: buzz/widgets/transcription_viewer/transcription_viewer_widget.py:296
#: buzz/widgets/model_download_progress_dialog.py:29
#: buzz/widgets/main_window.py:235
Expand Down Expand Up @@ -63,67 +63,67 @@ msgstr ""
msgid "Font Size"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:60
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:61
msgid "Test"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:66
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:67
msgid "OpenAI API key"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:79
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:80
msgid "OpenAI base url"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:88
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:89
msgid "Default export file name"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:94
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:95
msgid "Enable live recording transcription export"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:100
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:101
#: buzz/widgets/preferences_dialog/folder_watch_preferences_widget.py:47
#: buzz/widgets/preferences_dialog/folder_watch_preferences_widget.py:50
msgid "Browse"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:119
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:120
msgid "Export folder"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:130
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:131
#, fuzzy
msgid "Live recording mode"
msgstr "Enregistrament en viu"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:155
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:161
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:156
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:162
msgid "OpenAI API Key Test"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:156
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:157
msgid ""
"Your API key is valid. Buzz will use this key to perform Whisper API "
"transcriptions and AI translations."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:172
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
msgid "Invalid API key"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:191
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
msgid "Select Export Folder"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:243
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down Expand Up @@ -180,45 +180,45 @@ msgstr ""
msgid "Huggingface ID of a Faster whisper model"
msgstr ""

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:93
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:94
msgid "Download"
msgstr "Baixada"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:98
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:99
msgid "Show file location"
msgstr "Mostra la ubicació del fitxer"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:106
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:107
msgid "Delete"
msgstr "Suprimeix"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:137
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:138
msgid "Downloaded"
msgstr "Baixat"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:142
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:143
msgid "Available for Download"
msgstr "Disponible per baixar"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:163
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:164
msgid "Download link to Whisper.cpp ggml model file"
msgstr ""

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:238
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:239
msgid "Delete Model"
msgstr "Suprimeix el model"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:239
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:240
msgid "Are you sure you want to delete the selected model?"
msgstr "Esteu segur que voleu suprimir el model seleccionat?"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:267
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:268
#, fuzzy
msgid "Download failed"
msgstr "Baixat"

#: buzz/widgets/preferences_dialog/models_preferences_widget.py:268
#: buzz/widgets/main_window.py:291 buzz/model_loader.py:473
#: buzz/widgets/preferences_dialog/models_preferences_widget.py:269
#: buzz/widgets/main_window.py:291 buzz/model_loader.py:503
msgid "Error"
msgstr "Error"

Expand All @@ -240,19 +240,23 @@ msgstr "Detecta l'idioma"
msgid "Run"
msgstr "Executa"

#: buzz/widgets/transcriber/transcription_options_group_box.py:88
#: buzz/widgets/transcriber/transcription_options_group_box.py:92
msgid "Model:"
msgstr "Model:"

#: buzz/widgets/transcriber/transcription_options_group_box.py:91
#: buzz/widgets/transcriber/transcription_options_group_box.py:104
msgid "First time use of a model may take up to several minutest to load."
msgstr ""

#: buzz/widgets/transcriber/transcription_options_group_box.py:113
msgid "Api Key:"
msgstr ""

#: buzz/widgets/transcriber/transcription_options_group_box.py:92
#: buzz/widgets/transcriber/transcription_options_group_box.py:114
msgid "Task:"
msgstr "Tasca:"

#: buzz/widgets/transcriber/transcription_options_group_box.py:93
#: buzz/widgets/transcriber/transcription_options_group_box.py:115
msgid "Language:"
msgstr "Idioma:"

Expand Down Expand Up @@ -560,7 +564,7 @@ msgstr ""
msgid "Transcribe"
msgstr "Obre una transcripció"

#: buzz/model_loader.py:502
#: buzz/model_loader.py:532
msgid "A connection error occurred"
msgstr ""

Expand Down
Loading

0 comments on commit a7ec69e

Please sign in to comment.