install.bat 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. title Church Transcription — Installation
  4. echo.
  5. echo ============================================================
  6. echo Church 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. if errorlevel 1 (
  67. echo cu124 index failed, trying cu121...
  68. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
  69. if errorlevel 1 (
  70. echo.
  71. echo ERROR: PyTorch CUDA installation failed on both cu124 and cu121 indexes.
  72. echo Check your internet connection and try again.
  73. pause
  74. exit /b 1
  75. )
  76. )
  77. :: Confirm the CUDA build was installed, not the CPU fallback
  78. for /f "delims=" %%v in ('python -c "import torch; print(torch.__version__)"') do set TORCH_VER=%%v
  79. echo Installed PyTorch %TORCH_VER%
  80. echo %TORCH_VER% | find "+cpu" >nul
  81. if not errorlevel 1 (
  82. echo.
  83. echo WARNING: CPU-only PyTorch was installed instead of the CUDA build.
  84. echo Transcription will work but will be slow without GPU acceleration.
  85. echo See SETUP.md Part 2b for CUDA Toolkit installation instructions.
  86. echo.
  87. pause
  88. )
  89. :: ── Install WhisperLiveKit ────────────────────────────────────────────────────
  90. echo.
  91. echo [5/6] Installing WhisperLiveKit and dependencies...
  92. echo.
  93. pip install whisperlivekit pyannote.audio python-multipart diart
  94. if errorlevel 1 (
  95. echo.
  96. echo ERROR: WhisperLiveKit installation failed.
  97. pause
  98. exit /b 1
  99. )
  100. :: ── Install bridge dependencies ───────────────────────────────────────────────
  101. echo.
  102. echo [6/6] Installing bridge script dependencies...
  103. pip install -r bridge\requirements.txt
  104. if errorlevel 1 (
  105. echo.
  106. echo ERROR: Bridge dependencies failed to install.
  107. pause
  108. exit /b 1
  109. )
  110. :: ── Pre-download Whisper model ────────────────────────────────────────────────
  111. echo.
  112. echo Downloading Whisper large-v3 model (~3 GB) — this only happens once.
  113. echo.
  114. python -c "from faster_whisper import WhisperModel; WhisperModel('large-v3', device='cuda', compute_type='float16')"
  115. if errorlevel 1 (
  116. echo.
  117. echo WARNING: Model pre-download failed. It will download on first start instead.
  118. echo This is not critical — continuing.
  119. )
  120. :: ── Done ─────────────────────────────────────────────────────────────────────
  121. echo.
  122. echo ============================================================
  123. echo Installation complete.
  124. echo ============================================================
  125. echo.
  126. echo Next steps:
  127. echo 1. Edit start.bat and add your HuggingFace token
  128. echo (see SETUP.md Part 7 for instructions)
  129. echo 2. Double-click start.bat to launch the system
  130. echo.
  131. pause