-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
152 lines (134 loc) · 4.51 KB
/
setup.bat
File metadata and controls
152 lines (134 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@echo off
REM Copyright (c) 2026 AudioAlgorithms LLC. All rights reserved.
REM
REM vocos_rt one-click setup (Windows). Idempotent.
REM
REM Phases (per prompt sec.10):
REM 1. Verify prerequisites (Python 3.12, Git, NVIDIA driver)
REM 2. Create venv if absent
REM 3. Install requirements + dev requirements
REM 4. Download checkpoints (HF Hub)
REM 5. Download corpora (LibriTTS subsets)
REM 6. Export streaming ONNX (skipped if not yet built)
REM 7. Smoke test (test_00_forensic_log + test_01_bit_exactness if available)
REM 8. Print summary
setlocal EnableExtensions EnableDelayedExpansion
set "REPO_ROOT=%~dp0"
set "VENV_DIR=%REPO_ROOT%.venv"
set "MARKER=%REPO_ROOT%.setup_complete"
echo ============================================================
echo vocos_rt setup (Windows)
echo Repo: %REPO_ROOT%
echo ============================================================
REM ---- Idempotency check ----
if exist "%MARKER%" (
echo [setup] Already set up. Nothing to do.
echo [setup] Delete .setup_complete to force re-run.
exit /b 0
)
REM ---- Phase 1: prerequisites ----
echo.
echo [1/8] Verifying prerequisites...
where py >nul 2>&1
if errorlevel 1 (
echo [setup] ERROR: Python launcher 'py' not found. Install Python 3.12 from python.org.
exit /b 1
)
py -3.12 --version >nul 2>&1
if errorlevel 1 (
echo [setup] ERROR: Python 3.12 not installed. Install from python.org.
exit /b 1
)
where git >nul 2>&1
if errorlevel 1 (
echo [setup] ERROR: git not found in PATH.
exit /b 1
)
REM CUDA driver check via nvidia-smi (NOT nvcc -- see DECISIONS.md D6)
where nvidia-smi >nul 2>&1
if errorlevel 1 (
echo [setup] WARNING: nvidia-smi not found. CPU-only mode will be used.
set "HAS_GPU=0"
) else (
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
set "HAS_GPU=1"
)
REM ---- Phase 2: venv ----
echo.
echo [2/8] Ensuring venv at %VENV_DIR% ...
if not exist "%VENV_DIR%\Scripts\python.exe" (
py -3.12 -m venv "%VENV_DIR%"
if errorlevel 1 (
echo [setup] ERROR: venv creation failed.
exit /b 1
)
)
set "VENV_PY=%VENV_DIR%\Scripts\python.exe"
"%VENV_PY%" -m pip install --upgrade pip wheel setuptools
REM ---- Phase 3: install deps ----
echo.
echo [3/8] Installing dependencies ...
REM Install torch+torchaudio from the CUDA 12.1 wheel index first (DECISIONS.md D13).
REM PyPI ships only CPU wheels; we need GPU torch for tests 16/17a and Phase 2.
REM torch and torchaudio MUST be installed together with matching versions or
REM torchaudio's native extension fails to load (ABI mismatch).
if "%HAS_GPU%"=="1" (
"%VENV_PY%" -m pip install --index-url https://download.pytorch.org/whl/cu121 torch==2.5.1 torchaudio==2.5.1
) else (
"%VENV_PY%" -m pip install torch==2.5.1 torchaudio==2.5.1
)
"%VENV_PY%" -m pip install -r "%REPO_ROOT%requirements.txt"
if errorlevel 1 (
echo [setup] ERROR: requirements.txt install failed.
exit /b 1
)
"%VENV_PY%" -m pip install -r "%REPO_ROOT%requirements-dev.txt"
if errorlevel 1 (
echo [setup] ERROR: requirements-dev.txt install failed.
exit /b 1
)
"%VENV_PY%" -m pip install -e "%REPO_ROOT%"
REM ---- Phase 4: checkpoints ----
echo.
echo [4/8] Downloading checkpoints ...
"%VENV_PY%" "%REPO_ROOT%scripts\download_checkpoints.py"
if errorlevel 1 (
echo [setup] ERROR: checkpoint download failed.
exit /b 1
)
REM ---- Phase 5: corpora ----
echo.
echo [5/8] Downloading corpora ...
"%VENV_PY%" "%REPO_ROOT%scripts\download_corpora.py" --subsets test-clean dev-clean train-clean-100
if errorlevel 1 (
echo [setup] ERROR: corpus download failed.
exit /b 1
)
REM ---- Phase 6: ONNX export (skipped if exporter not yet built) ----
echo.
echo [6/8] Exporting streaming ONNX ...
if exist "%REPO_ROOT%scripts\export_streaming_onnx.py" (
"%VENV_PY%" "%REPO_ROOT%scripts\export_streaming_onnx.py"
) else (
echo [setup] export_streaming_onnx.py not yet present (Phase 3 deliverable). Skipping.
)
REM ---- Phase 7: smoke test ----
echo.
echo [7/8] Running smoke tests ...
"%VENV_PY%" -m pytest "%REPO_ROOT%tests" -v -k "test_00 or test_01_bit_exactness" --no-header
if errorlevel 1 (
echo [setup] WARNING: smoke tests failed. Check above output.
REM Do not abort: bootstrap is still complete, tests are diagnostic.
)
REM ---- Phase 8: summary ----
echo.
echo [8/8] Summary
echo Python: 3.12 (%VENV_PY%)
echo GPU: %HAS_GPU%
echo Repo: %REPO_ROOT%
echo.
echo [setup] DONE. Activate the venv with: %VENV_DIR%\Scripts\activate.bat
REM Mark complete
echo setup completed > "%MARKER%"
endlocal
exit /b 0