install.bat 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. title Church Transcription — Installation
  4. echo.
  5. echo ============================================================
  6. echo Live Transcription Display - One-time Setup
  7. echo ============================================================
  8. echo.
  9. echo This will install all required software into a local
  10. echo virtual environment (.venv). It will NOT affect other
  11. echo Python programs on this computer.
  12. echo.
  13. echo Estimated time: 10-20 minutes (depends on internet speed).
  14. echo.
  15. pause
  16. :: ── Check Python ────────────────────────────────────────────────────────────
  17. echo [1/6] Checking Python version (3.12+ required)...
  18. :: Prefer 3.12 then 3.13 — PyTorch does not yet publish wheels for 3.14+
  19. set PYEXE=
  20. for %%v in (3.12 3.13) do (
  21. if not defined PYEXE (
  22. py -%%v --version >nul 2>&1
  23. if not errorlevel 1 set PYEXE=py -%%v
  24. )
  25. )
  26. if not defined PYEXE (
  27. echo.
  28. echo ERROR: Python 3.12 or 3.13 not found.
  29. echo.
  30. echo PyTorch ^(required by WhisperLiveKit^) does not yet publish wheels
  31. echo for Python 3.14. Please install Python 3.12 alongside any newer
  32. echo version — they coexist safely on the same PC.
  33. echo.
  34. echo Download: https://www.python.org/downloads/release/python-31210/
  35. echo Tick "Add Python to PATH" during install.
  36. echo.
  37. pause
  38. exit /b 1
  39. )
  40. for /f "tokens=2 delims= " %%v in ('%PYEXE% --version 2^>^&1') do set PYVER=%%v
  41. echo Found Python %PYVER% ^(using %PYEXE%^)
  42. :: ── Create virtual environment ───────────────────────────────────────────────
  43. echo.
  44. echo [2/6] Creating virtual environment in .venv\ ...
  45. if exist .venv (
  46. echo .venv already exists — delete it and re-run if you need a clean install.
  47. ) else (
  48. %PYEXE% -m venv .venv
  49. if errorlevel 1 (
  50. echo ERROR: Failed to create virtual environment.
  51. pause
  52. exit /b 1
  53. )
  54. )
  55. call .venv\Scripts\activate.bat
  56. :: ── Upgrade pip ──────────────────────────────────────────────────────────────
  57. echo.
  58. echo [3/6] Upgrading pip...
  59. python -m pip install --upgrade pip --quiet
  60. :: ── Install PyTorch with CUDA ─────────────────────────────────────────────────
  61. echo.
  62. echo [4/6] Installing PyTorch with CUDA support (~2.5 GB download)...
  63. echo This is the longest step. Please wait.
  64. echo.
  65. :: pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
  66. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
  67. if errorlevel 1 (
  68. echo cu130 index failed, trying cu121...
  69. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
  70. if errorlevel 1 (
  71. echo cu128 index failed, trying cu121...
  72. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
  73. if errorlevel 1 (
  74. echo.
  75. echo ERROR: PyTorch CUDA installation failed on both cu130, cu128 and cu126 indexes.
  76. echo Check your internet connection and try again.
  77. pause
  78. exit /b 1
  79. )
  80. )
  81. )
  82. :: Confirm the CUDA build was installed, not the CPU fallback
  83. for /f "delims=" %%v in ('python -c "import torch; print(torch.__version__)"') do set TORCH_VER=%%v
  84. echo Installed PyTorch %TORCH_VER%
  85. echo %TORCH_VER% | find "+cpu" >nul
  86. if not errorlevel 1 (
  87. echo.
  88. echo WARNING: CPU-only PyTorch was installed instead of the CUDA build.
  89. echo Transcription will work but will be slow without GPU acceleration.
  90. echo See SETUP.md Part 2b for CUDA Toolkit installation instructions.
  91. echo.
  92. pause
  93. )
  94. :: ── Install WhisperLiveKit ────────────────────────────────────────────────────
  95. echo.
  96. echo [5/6] Installing WhisperLiveKit and dependencies...
  97. echo.
  98. pip install whisperlivekit pyannote.audio python-multipart diart
  99. if errorlevel 1 (
  100. echo.
  101. echo ERROR: WhisperLiveKit installation failed.
  102. pause
  103. exit /b 1
  104. )
  105. :: ── Install bridge dependencies ───────────────────────────────────────────────
  106. echo.
  107. echo [6/6] Installing bridge script dependencies...
  108. pip install -r bridge\requirements.txt
  109. if errorlevel 1 (
  110. echo.
  111. echo ERROR: Bridge dependencies failed to install.
  112. pause
  113. exit /b 1
  114. )
  115. :: ── Pre-download Whisper model ────────────────────────────────────────────────
  116. echo.
  117. echo Downloading Whisper large-v3 model (~3 GB) — this only happens once.
  118. echo.
  119. python -c "from faster_whisper import WhisperModel; WhisperModel('large-v3', device='cuda', compute_type='float16')"
  120. if errorlevel 1 (
  121. echo.
  122. echo WARNING: Model pre-download failed. It will download on first start instead.
  123. echo This is not critical — continuing.
  124. )
  125. echo.
  126. :: copy .venv\Lib\site-packages\nvidia\cudnn\bin\*.dll .venv\Lib\site-packages\ctranslate2\
  127. copy .venv\Lib\site-packages\nvidia\cublas\bin\*.dll .venv\Lib\site-packages\ctranslate2\
  128. echo.
  129. :: ── Done ─────────────────────────────────────────────────────────────────────
  130. echo.
  131. echo ============================================================
  132. echo Installation complete.
  133. echo ============================================================
  134. echo.
  135. echo Next steps:
  136. echo 1. Edit start.bat and add your HuggingFace token
  137. echo (see SETUP.md Part 7 for instructions)
  138. echo 2. Double-click start.bat to launch the system
  139. echo.
  140. pause