feat(cuda): добавлен optional runtime для Linux и Windows
This commit is contained in:
1 parent
937eafe8db
commit
99ed5ed92f
10 files changed
+282
-36
No files matched your search
@@ -41,8 +41,8 @@ from .speaker_diarizer import SpeakerDiarizer, load_speaker_diarizer
|
||||
from .transcriber import (
|
||||
Segment,
|
||||
TranscribeResult,
|
||||
_is_cuda_error,
|
||||
_transcribe_file,
|
||||
cuda_error_hint,
|
||||
load_model,
|
||||
)
|
||||
from .types import (
|
||||
@@ -65,6 +65,13 @@ app = typer.Typer()
|
||||
console = Console(stderr=True)
|
||||
|
||||
|
||||
def _print_cuda_hint(exc: BaseException) -> None:
|
||||
"""Показывает подсказку, не заменяя исходную ошибку."""
|
||||
hint = cuda_error_hint(exc)
|
||||
if hint:
|
||||
console.print(hint, style="yellow", markup=False)
|
||||
|
||||
|
||||
def _show_cli_warning(
|
||||
message: Warning | str,
|
||||
*_args: object,
|
||||
@@ -398,21 +405,15 @@ def main(
|
||||
except SystemExit:
|
||||
raise
|
||||
except ValueError as exc:
|
||||
_print_cuda_hint(exc)
|
||||
console.print(f"Ошибка: {exc}", style="red bold")
|
||||
raise SystemExit(1)
|
||||
except (FileNotFoundError,) as exc:
|
||||
_print_cuda_hint(exc)
|
||||
console.print(f"Ошибка: {exc}", style="red bold")
|
||||
raise SystemExit(1)
|
||||
except Exception as exc:
|
||||
if _is_cuda_error(exc) and sys.platform == "win32":
|
||||
console.print(
|
||||
"GPU на Windows требует CUDA toolkit (включает cuBLAS).\n"
|
||||
"Установите одним из способов:\n"
|
||||
" choco install cuda\n"
|
||||
" winget install -e --id Nvidia.CUDA\n"
|
||||
"После установки перезапустите терминал.",
|
||||
style="yellow",
|
||||
)
|
||||
_print_cuda_hint(exc)
|
||||
if verbose:
|
||||
console.print_exception()
|
||||
else:
|
||||
@@ -758,6 +759,7 @@ def _run_batch(
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except Exception as exc:
|
||||
_print_cuda_hint(exc)
|
||||
if verbose:
|
||||
console.print_exception()
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user