mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-14 22:55:46 +01:00
Fix for speech separation error (#1371)
This commit is contained in:
parent
37f5628c49
commit
c4d7971e04
16 changed files with 107 additions and 3 deletions
|
|
@ -25,8 +25,11 @@ from buzz.assets import APP_BASE_DIR
|
|||
if getattr(sys, "frozen", False) is False and platform.system() != "Windows":
|
||||
faulthandler.enable()
|
||||
|
||||
# Sets stderr to no-op TextIO when None (run as Windows GUI).
|
||||
# Resolves https://github.com/chidiwilliams/buzz/issues/221
|
||||
# Sets stdout/stderr to no-op TextIO when None (run as Windows GUI with --noconsole).
|
||||
# stdout fix: torch.hub uses sys.stdout.write() for download progress and crashes if None.
|
||||
# stderr fix: Resolves https://github.com/chidiwilliams/buzz/issues/221
|
||||
if sys.stdout is None:
|
||||
sys.stdout = TextIO()
|
||||
if sys.stderr is None:
|
||||
sys.stderr = TextIO()
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ if sys.platform == "win32":
|
|||
|
||||
from demucs import api as demucsApi
|
||||
|
||||
from buzz.locale import _
|
||||
from buzz.model_loader import ModelType
|
||||
from buzz.transcriber.file_transcriber import FileTranscriber
|
||||
from buzz.transcriber.openai_whisper_api_file_transcriber import (
|
||||
|
|
@ -127,11 +128,19 @@ class FileTranscriberQueueWorker(QObject):
|
|||
separator = None
|
||||
separated = None
|
||||
try:
|
||||
# Force CPU if specified, otherwise use CUDA if available
|
||||
force_cpu = os.getenv("BUZZ_FORCE_CPU", "false").lower() == "true"
|
||||
if force_cpu:
|
||||
device = "cpu"
|
||||
else:
|
||||
import torch
|
||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||
separator = demucsApi.Separator(
|
||||
device=device,
|
||||
progress=True,
|
||||
callback=separator_progress_callback,
|
||||
)
|
||||
_, separated = separator.separate_audio_file(Path(self.current_task.file_path))
|
||||
_origin, separated = separator.separate_audio_file(Path(self.current_task.file_path))
|
||||
|
||||
task_file_path = Path(self.current_task.file_path)
|
||||
self.speech_path = task_file_path.with_name(f"{task_file_path.stem}_speech.mp3")
|
||||
|
|
@ -140,6 +149,12 @@ class FileTranscriberQueueWorker(QObject):
|
|||
self.current_task.file_path = str(self.speech_path)
|
||||
except Exception as e:
|
||||
logging.error(f"Error during speech extraction: {e}", exc_info=True)
|
||||
self.task_error.emit(
|
||||
self.current_task,
|
||||
_("Speech extraction failed! Check your internet connection — a model may need to be downloaded."),
|
||||
)
|
||||
self.is_running = False
|
||||
return
|
||||
finally:
|
||||
# Release memory used by speech extractor
|
||||
del separator, separated
|
||||
|
|
|
|||
|
|
@ -1482,6 +1482,12 @@ msgstr "Afegeix a sobre"
|
|||
msgid "Append and correct"
|
||||
msgstr "Afegeix i corregeix"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Avís de permís d'ajust"
|
||||
|
||||
|
|
|
|||
|
|
@ -1473,6 +1473,12 @@ msgstr "Tilføj herover"
|
|||
msgid "Append and correct"
|
||||
msgstr "Tilføj og ret"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Snap tilladelse notifikationer"
|
||||
|
||||
|
|
|
|||
|
|
@ -1475,6 +1475,12 @@ msgstr "Oben anhängen"
|
|||
msgid "Append and correct"
|
||||
msgstr "Anhängen und korrigieren"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Snap-Berechtigungsmitteilung"
|
||||
|
||||
|
|
|
|||
|
|
@ -1442,3 +1442,9 @@ msgstr ""
|
|||
#: buzz/settings/recording_transcriber_mode.py:7
|
||||
msgid "Append and correct"
|
||||
msgstr ""
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -1543,6 +1543,12 @@ msgstr "Añadir arriba"
|
|||
msgid "Append and correct"
|
||||
msgstr "Añadir y corregir"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Aviso de permiso Snap"
|
||||
|
||||
|
|
|
|||
|
|
@ -1484,6 +1484,12 @@ msgstr "Aggiungere sopra"
|
|||
msgid "Append and correct"
|
||||
msgstr "Aggiungere e correggere"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Avviso di autorizzazione Snap"
|
||||
|
||||
|
|
|
|||
|
|
@ -1468,6 +1468,12 @@ msgstr ""
|
|||
msgid "Append and correct"
|
||||
msgstr ""
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Snap権限通知"
|
||||
|
||||
|
|
|
|||
|
|
@ -1477,6 +1477,14 @@ msgstr "Jaunie teikumi augšā"
|
|||
msgid "Append and correct"
|
||||
msgstr "Papildināt un labot esošo"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
"Runas atdalīšana neizdevās! Pārbaudiet interneta savienojumu, iespējams "
|
||||
"jālejupielādē modelis."
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Snap atļauju piezīme"
|
||||
|
||||
|
|
|
|||
|
|
@ -1474,6 +1474,12 @@ msgstr "Bovenaan toevoegen"
|
|||
msgid "Append and correct"
|
||||
msgstr "Toevoegen en corrigeren"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Snap-rechten"
|
||||
|
||||
|
|
|
|||
|
|
@ -1492,6 +1492,12 @@ msgstr ""
|
|||
msgid "Append and correct"
|
||||
msgstr ""
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "ID"
|
||||
#~ msgstr "ID"
|
||||
|
||||
|
|
|
|||
|
|
@ -1478,6 +1478,12 @@ msgstr "Acrescentar acima"
|
|||
msgid "Append and correct"
|
||||
msgstr "Acrescentar e corrigir"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Aviso de permissão do Snap"
|
||||
|
||||
|
|
|
|||
|
|
@ -1470,6 +1470,12 @@ msgstr ""
|
|||
msgid "Append and correct"
|
||||
msgstr ""
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "Попередження щодо дозволів Snap"
|
||||
|
||||
|
|
|
|||
|
|
@ -1492,6 +1492,12 @@ msgstr "增加上方"
|
|||
msgid "Append and correct"
|
||||
msgstr "增加并纠正"
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Snap permission notice"
|
||||
#~ msgstr "快照权限通知"
|
||||
|
||||
|
|
|
|||
|
|
@ -1484,6 +1484,12 @@ msgstr ""
|
|||
msgid "Append and correct"
|
||||
msgstr ""
|
||||
|
||||
#: buzz/file_transcriber_queue_worker.py:161
|
||||
msgid ""
|
||||
"Speech extraction failed! Check your internet connection — a model may need "
|
||||
"to be downloaded."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "ID"
|
||||
#~ msgstr "ID"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue