LeeAeron commited on
Commit
df91641
·
verified ·
1 Parent(s): a2d0955

Upload Vibe.Voice.Portable.by.LeeAeron.bat

Browse files
Files changed (1) hide show
  1. Vibe.Voice.Portable.by.LeeAeron.bat +1178 -0
Vibe.Voice.Portable.by.LeeAeron.bat ADDED
@@ -0,0 +1,1178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+ set "INSTALL_DIR=%~dp0"
4
+ set "HF_HOME=%INSTALL_DIR%huggingface_cache"
5
+ set "PYTHON_DIR=%INSTALL_DIR%system"
6
+ set "PYTHONUSERBASE=%INSTALL_DIR%python_user_base"
7
+ set "FFMPEG_DIR=%INSTALL_DIR%ffmpeg"
8
+ set "VOICEPACK_DIR=%INSTALL_DIR%voice-pack"
9
+ set "VENV_DIR=%INSTALL_DIR%system\venv"
10
+ set "MODELS_DIR=%INSTALL_DIR%models"
11
+ set "REPO_DIR=%INSTALL_DIR%VibeVoice"
12
+ set "PIP_CACHE_DIR=%INSTALL_DIR%cache"
13
+ set "TEMP=%INSTALL_DIR%temp"
14
+ set "TMP=%INSTALL_DIR%temp"
15
+ set "PYTHON310_URL=https://www.python.org/ftp/python/3.10.8/python-3.10.8-embed-amd64.zip"
16
+ set "PYTHON311_URL=https://www.python.org/ftp/python/3.11.8/python-3.11.8-embed-amd64.zip"
17
+ set "FFMPEG_URL=https://huggingface.co/datasets/LeeAeron/ffmpeg_for_ai/resolve/main/ffmpeg.zip"
18
+ set "VOICEPACK_URL=https://huggingface.co/datasets/LeeAeron/VV/resolve/main/VP.zip"
19
+ set "VIBEVOICE_URL=https://huggingface.co/datasets/LeeAeron/VV/resolve/main/VV.zip"
20
+ set "GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py"
21
+ set "MAX_RETRIES=3"
22
+ set "RETRY_DELAY=5"
23
+
24
+ REM Setup clean PIP cache while re/installing
25
+ set CLEAN_PIP_CACHE=0
26
+ REM Setup clean HugginFace models cache while re/installing
27
+ set CLEAN_HF_HOME=0
28
+ REM Setup clean VoicePack cache while re/installing
29
+ set CLEAN_VOICEPACK=1
30
+ REM Setup clean ffmpeg folder while re/installing
31
+ set CLEAN_FFMPEG=0
32
+
33
+ :main_menu
34
+ cls
35
+ echo ==================================================
36
+ echo VibeVoice Main Menu
37
+ echo ==================================================
38
+ echo 1. Start VibeVoice Normal Mode
39
+ echo 2. Start VibeVoice CPU Mode (Low VRAM)
40
+ echo 3. Install/Reinstall VibeVoice
41
+ echo ==================================================
42
+ echo By @li_aeron, @ruweb24 and @nerual_dreming, 2025
43
+ echo ==================================================
44
+ set /p choice=Choose action 1-3:
45
+ if "%choice%"=="1" goto start_vibe
46
+ if "%choice%"=="2" goto start_vibe_low
47
+ if "%choice%"=="3" goto install_vibe
48
+ echo Wrong choice. Please, try again.
49
+ pause
50
+ goto main_menu
51
+
52
+ :install_vibe
53
+ cls
54
+ echo =========================================================================================================
55
+ echo Install/Reinstall VibeVoice
56
+ echo =========================================================================================================
57
+ echo 1. Install/Reinstall with Python 3.10 + Torch 2.5.1 CUDA 12.1 + Flash Attention (GTX10x-16x, RTX20x-40x)
58
+ echo 2. Install/Reinstall with Python 3.10 + Torch 2.7.1 CUDA 12.8 + Flash Attention (GTX10x-16x, RTX20x-50x)
59
+ echo 3. Install/Reinstall with Python 3.11 + Torch 2.5.1 CUDA 12.1 + Flash Attention (GTX10x-16x, RTX20x-40x)
60
+ echo 4. Install/Reinstall with Python 3.11 + Torch 2.7.1 CUDA 12.8 + Flash Attention (GTX10x-16x, RTX20x-50x)
61
+ echo 5. Back
62
+ echo =========================================================================================================
63
+ echo GTX10xx-16xx does not support FlashAtention!
64
+ echo Q8-Large model will be disabled if your GPU does not support FlashAttention!
65
+ echo Q8-Large model will be disabled if there will be lack of FlashAttention package!
66
+ echo There will be used SDPA attention if your GPU does not support FlashAttention!
67
+ echo For GTX10xx-16xx use INT4-emulation for faster generation!
68
+ echo Python 3.11 version is more stable to Python 3.10.
69
+ echo =========================================================================================================
70
+ set /p file_choice=Choose action 1-5:
71
+ if "%file_choice%"=="1" goto install_vibe_cu121flashattn_py310
72
+ if "%file_choice%"=="2" goto install_vibe_271cu128flashattn_py310
73
+ if "%file_choice%"=="3" goto install_vibe_cu121flashattn_py311
74
+ if "%file_choice%"=="4" goto install_vibe_271cu128flashattn_py311
75
+ if "%file_choice%"=="5" goto main_menu
76
+ echo Wrong choice. please, try again.
77
+ pause
78
+ goto install_vibe
79
+
80
+ :install_vibe_cu121flashattn_py310
81
+ cls
82
+ echo Preparing for installation: cleaning up old files...
83
+ if exist "%VENV_DIR%" rmdir /s /q "%VENV_DIR%"
84
+ if exist "%REPO_DIR%" rmdir /s /q "%REPO_DIR%"
85
+ if exist "%PYTHONUSERBASE%" rmdir /s /q "%PYTHONUSERBASE%"
86
+ if exist "%TEMP%" rmdir /s /q "%TEMP%"
87
+ if exist "%PYTHON_DIR%" rmdir /s /q "%PYTHON_DIR%"
88
+ if "%CLEAN_PIP_CACHE%"=="1" (
89
+ if exist "%PIP_CACHE_DIR%" rmdir /s /q "%PIP_CACHE_DIR%"
90
+ )
91
+
92
+ if "%CLEAN_HF_HOME%"=="1" (
93
+ if exist "%HF_HOME%" rmdir /s /q "%HF_HOME%"
94
+ )
95
+
96
+ if "%CLEAN_VOICEPACK%"=="1" (
97
+ if exist "%VOICEPACK_DIR%" rmdir /s /q "%VOICEPACK_DIR%"
98
+ )
99
+
100
+ if "%CLEAN_FFMPEG%"=="1" (
101
+ if exist "%FFMPEG_DIR%" rmdir /s /q "%FFMPEG_DIR%"
102
+ )
103
+ mkdir "%TEMP%"
104
+
105
+ set "PATH=%~dp0python_embedded;%~dp0ffmpeg\bin;%PATH%"
106
+
107
+ echo Installing Python...
108
+ if not exist "%PYTHON_DIR%" (
109
+ mkdir "%PYTHON_DIR%"
110
+ call :DownloadFile "%PYTHON310_URL%" "%INSTALL_DIR%python.zip"
111
+ if %errorlevel% neq 0 (
112
+ echo Error: Failed to download Python after %MAX_RETRIES% attempts.
113
+ pause
114
+ exit /b 1
115
+ )
116
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%python.zip' -DestinationPath '%PYTHON_DIR%'"
117
+ del "%INSTALL_DIR%python.zip"
118
+
119
+ echo.
120
+ echo Configuring Python to use pip...
121
+ powershell -Command "(Get-Content '%PYTHON_DIR%\python310._pth') -replace '#import site', 'import site' | Set-Content '%PYTHON_DIR%\python310._pth'"
122
+
123
+ echo Installing pip...
124
+ call :DownloadFile "%GET_PIP_URL%" "%PYTHON_DIR%\get-pip.py"
125
+ if %errorlevel% neq 0 (
126
+ echo Error: Failed to download get-pip.py after %MAX_RETRIES% attempts.
127
+ pause
128
+ exit /b 1
129
+ )
130
+ "%PYTHON_DIR%\python.exe" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
131
+ del "%PYTHON_DIR%\get-pip.py"
132
+ )
133
+
134
+ echo Installing ffmpeg binaries...
135
+ if not exist "%FFMPEG_DIR%" (
136
+ mkdir "%FFMPEG_DIR%"
137
+ call :DownloadFile "%FFMPEG_URL%" "%INSTALL_DIR%ffmpeg.zip"
138
+ if %errorlevel% neq 0 (
139
+ echo Error: Failed to download FFMPEG after %MAX_RETRIES% attempts.
140
+ pause
141
+ exit /b 1
142
+ )
143
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%ffmpeg.zip' -DestinationPath '%FFMPEG_DIR%'"
144
+ del "%INSTALL_DIR%ffmpeg.zip"
145
+ )
146
+
147
+ echo Installing VoicePack...
148
+ if not exist "%VOICEPACK_DIR%" (
149
+ mkdir "%VOICEPACK_DIR%"
150
+ call :DownloadFile "%VOICEPACK_URL%" "%INSTALL_DIR%voice-pack.zip"
151
+ if %errorlevel% neq 0 (
152
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
153
+ pause
154
+ exit /b 1
155
+ )
156
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%voice-pack.zip' -DestinationPath '%VOICEPACK_DIR%'"
157
+ del "%INSTALL_DIR%voice-pack.zip"
158
+ )
159
+
160
+ echo Installing virtualenv...
161
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" virtualenv
162
+ if %errorlevel% neq 0 (
163
+ echo Error: Failed to install virtualenv after %MAX_RETRIES% attempts.
164
+ pause
165
+ exit /b 1
166
+ )
167
+
168
+ echo Installing repository and dependencies...
169
+ if not exist "%REPO_DIR%" (
170
+ mkdir "%REPO_DIR%"
171
+ call :DownloadFile "%VIBEVOICE_URL%" "%INSTALL_DIR%VibeVoice_repo.zip"
172
+ if %errorlevel% neq 0 (
173
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
174
+ pause
175
+ exit /b 1
176
+ )
177
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%VibeVoice_repo.zip' -DestinationPath '%REPO_DIR%'"
178
+ del "%INSTALL_DIR%VibeVoice_repo.zip"
179
+ )
180
+ "%PYTHON_DIR%\python.exe" -m virtualenv --no-download "%VENV_DIR%"
181
+ if %errorlevel% neq 0 (
182
+ echo Error: Failed to create the virtual environment.
183
+ pause
184
+ exit /b 1
185
+ )
186
+
187
+ call "%VENV_DIR%\Scripts\activate"
188
+
189
+ echo Upgrading pip...
190
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" --upgrade pip
191
+ if %errorlevel% neq 0 (
192
+ echo Error: Failed to upgrade pip.
193
+ pause
194
+ exit /b 1
195
+ )
196
+
197
+ echo Checking for uv in virtual environment...
198
+ set "UV_EXE=%VENV_DIR%\Scripts\uv.exe"
199
+ if not exist "%UV_EXE%" (
200
+ echo 'uv' not found. Attempting installation...
201
+
202
+ "%VENV_DIR%\Scripts\python.exe" -m ensurepip --default-pip >nul 2>&1
203
+ if errorlevel 1 (
204
+ echo Failed to bootstrap pip. Trying get-pip.py...
205
+ curl -L -o "%TEMP%\get-pip.py" "%GET_PIP_URL%"
206
+ "%VENV_DIR%\Scripts\python.exe" "%TEMP%\get-pip.py"
207
+ if errorlevel 1 (
208
+ echo Error: Failed to install pip.
209
+ pause
210
+ exit /b 1
211
+ )
212
+ )
213
+
214
+ "%VENV_DIR%\Scripts\python.exe" -m pip install uv
215
+ if errorlevel 1 (
216
+ echo Error: Failed to install uv.
217
+ pause
218
+ exit /b 1
219
+ )
220
+
221
+ if not exist "%UV_EXE%" (
222
+ echo Error: uv.exe not found at expected location: %UV_EXE%
223
+ pause
224
+ exit /b 1
225
+ )
226
+ )
227
+
228
+ echo Installing dependencies.
229
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" -e "%REPO_DIR%"
230
+ if errorlevel 1 (
231
+ echo Error: Failed to install main dependencies.
232
+ pause
233
+ exit /b 1
234
+ )
235
+
236
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" soundfile ffmpeg-python huggingface_hub
237
+ if errorlevel 1 (
238
+ echo Error: Failed to install additional dependencies.
239
+ pause
240
+ exit /b 1
241
+ )
242
+
243
+ call :RunCommandWithRetry pip install --cache-dir "%PIP_CACHE_DIR%" rtx50-compat==3.0.2 --no-deps --index-url https://pypi.org/simple
244
+ if errorlevel 1 (
245
+ echo Error: Failed to install additional dependencies.
246
+ pause
247
+ exit /b 1
248
+ )
249
+
250
+ echo Re-installing PyTorch...
251
+ uv pip uninstall torch torchvision torchaudio
252
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
253
+ if errorlevel 1 (
254
+ echo Error: Failed to install PyTorch with CUDA support.
255
+ pause
256
+ exit /b 1
257
+ )
258
+ echo PyTorch installed successfully.
259
+
260
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show einops >nul 2>&1
261
+ if errorlevel 1 (
262
+ echo Installing einops...
263
+ call :RunCommandWithRetry uv pip install einops --cache-dir "%PIP_CACHE_DIR%"
264
+ )
265
+
266
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show transformers >nul 2>&1
267
+ if errorlevel 1 (
268
+ echo Installing transformers...
269
+ call :RunCommandWithRetry uv pip install transformers --cache-dir "%PIP_CACHE_DIR%"
270
+ )
271
+
272
+ echo Installing FlashAttention...
273
+ set "FLASH_ATTN_URL=https://huggingface.co/datasets/LeeAeron/VobeVoicePrivate/resolve/main/flash_attn-2.7.4+cu124torch2.5.1cxx11abiFALSE-cp310-cp310-win_amd64.whl?download=true"
274
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" ^
275
+ "%FLASH_ATTN_URL%" --force-reinstall --no-deps
276
+ if errorlevel 1 (
277
+ echo Error: Failed to install FlashAttention.
278
+ pause
279
+ exit /b 1
280
+ )
281
+ echo FlashAttention installed successfully.
282
+
283
+ echo Installing Triton-Windows...
284
+ call :RunCommandWithRetry uv pip install triton-windows --cache-dir "%PIP_CACHE_DIR%"
285
+
286
+ echo Installing bitsandbytes for int4 quantization support...
287
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" bitsandbytes
288
+ if errorlevel 1 (
289
+ echo Error: Failed to install bitsandbytes.
290
+ pause
291
+ exit /b 1
292
+ )
293
+ echo bitsandbytes installed successfully.
294
+
295
+ echo Installing ruaccent...
296
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" ruaccent
297
+ if errorlevel 1 (
298
+ echo Error: Failed to install ruaccent.
299
+ pause
300
+ exit /b 1
301
+ )
302
+ echo ruaccent installed successfully.
303
+
304
+ "%VENV_DIR%\Scripts\python.exe" -m pip uninstall gradio -y
305
+ "%VENV_DIR%\Scripts\python.exe" -m pip install gradio==5.49.1
306
+
307
+ echo Copying voice samples...
308
+ if exist "%~dp0voice-pack\" (
309
+ echo Found 'voice-pack' directory. Copying contents...
310
+ xcopy "%~dp0voice-pack" "%REPO_DIR%\demo\voices\" /E /I /Y > nul
311
+ if !errorlevel! neq 0 (
312
+ echo Error: Failed to copy voice samples.
313
+ pause
314
+ ) else (
315
+ echo Voice samples copied successfully.
316
+ if "!CLEAN_VOICEPACK!"=="1" (
317
+ echo Cleaning up 'voice-pack' directory...
318
+ rmdir /s /q "%~dp0voice-pack"
319
+ if exist "%~dp0voice-pack\" (
320
+ echo Warning: Failed to delete 'voice-pack' directory.
321
+ ) else (
322
+ echo 'voice-pack' directory deleted.
323
+ )
324
+ )
325
+ )
326
+ ) else (
327
+ echo Warning: 'voice-pack' not found. Skipping...
328
+ )
329
+
330
+ rmdir /s /q "%TEMP%" 2>nul
331
+ pause
332
+ goto main_menu
333
+
334
+ :install_vibe_271cu128flashattn_py310
335
+ cls
336
+ if exist "%VENV_DIR%" rmdir /s /q "%VENV_DIR%"
337
+ if exist "%REPO_DIR%" rmdir /s /q "%REPO_DIR%"
338
+ if exist "%PYTHONUSERBASE%" rmdir /s /q "%PYTHONUSERBASE%"
339
+ if exist "%TEMP%" rmdir /s /q "%TEMP%"
340
+ if exist "%PYTHON_DIR%" rmdir /s /q "%PYTHON_DIR%"
341
+ if "%CLEAN_PIP_CACHE%"=="1" (
342
+ if exist "%PIP_CACHE_DIR%" rmdir /s /q "%PIP_CACHE_DIR%"
343
+ )
344
+
345
+ if "%CLEAN_HF_HOME%"=="1" (
346
+ if exist "%HF_HOME%" rmdir /s /q "%HF_HOME%"
347
+ )
348
+
349
+ if "%CLEAN_VOICEPACK%"=="1" (
350
+ if exist "%VOICEPACK_DIR%" rmdir /s /q "%VOICEPACK_DIR%"
351
+ )
352
+
353
+ if "%CLEAN_FFMPEG%"=="1" (
354
+ if exist "%FFMPEG_DIR%" rmdir /s /q "%FFMPEG_DIR%"
355
+ )
356
+ mkdir "%TEMP%"
357
+
358
+ set "PATH=%~dp0python_embedded;%~dp0ffmpeg\bin;%PATH%"
359
+
360
+ echo Installing Python...
361
+ if not exist "%PYTHON_DIR%" (
362
+ mkdir "%PYTHON_DIR%"
363
+ call :DownloadFile "%PYTHON310_URL%" "%INSTALL_DIR%python.zip"
364
+ if %errorlevel% neq 0 (
365
+ echo Error: Failed to download Python after %MAX_RETRIES% attempts.
366
+ pause
367
+ exit /b 1
368
+ )
369
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%python.zip' -DestinationPath '%PYTHON_DIR%'"
370
+ del "%INSTALL_DIR%python.zip"
371
+
372
+ echo Configuring Python to use pip...
373
+ powershell -Command "(Get-Content '%PYTHON_DIR%\python310._pth') -replace '#import site', 'import site' | Set-Content '%PYTHON_DIR%\python310._pth'"
374
+
375
+ call :DownloadFile "%GET_PIP_URL%" "%PYTHON_DIR%\get-pip.py"
376
+ if %errorlevel% neq 0 (
377
+ echo Error: Failed to download get-pip.py after %MAX_RETRIES% attempts.
378
+ pause
379
+ exit /b 1
380
+ )
381
+ "%PYTHON_DIR%\python.exe" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
382
+ del "%PYTHON_DIR%\get-pip.py"
383
+ )
384
+
385
+ echo Installing ffmpeg binaries...
386
+ if not exist "%FFMPEG_DIR%" (
387
+ mkdir "%FFMPEG_DIR%"
388
+ call :DownloadFile "%FFMPEG_URL%" "%INSTALL_DIR%ffmpeg.zip"
389
+ if %errorlevel% neq 0 (
390
+ echo Error: Failed to download FFMPEG after %MAX_RETRIES% attempts.
391
+ pause
392
+ exit /b 1
393
+ )
394
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%ffmpeg.zip' -DestinationPath '%FFMPEG_DIR%'"
395
+ del "%INSTALL_DIR%ffmpeg.zip"
396
+ )
397
+
398
+ echo Installing VoicePack...
399
+ if not exist "%VOICEPACK_DIR%" (
400
+ mkdir "%VOICEPACK_DIR%"
401
+ call :DownloadFile "%VOICEPACK_URL%" "%INSTALL_DIR%voice-pack.zip"
402
+ if %errorlevel% neq 0 (
403
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
404
+ pause
405
+ exit /b 1
406
+ )
407
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%voice-pack.zip' -DestinationPath '%VOICEPACK_DIR%'"
408
+ del "%INSTALL_DIR%voice-pack.zip"
409
+ )
410
+
411
+ echo Installing virtualenv...
412
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" virtualenv
413
+ if %errorlevel% neq 0 (
414
+ echo Error: Failed to install virtualenv after %MAX_RETRIES% attempts.
415
+ pause
416
+ exit /b 1
417
+ )
418
+
419
+ echo Installing repository and dependencies...
420
+ if not exist "%REPO_DIR%" (
421
+ mkdir "%REPO_DIR%"
422
+ call :DownloadFile "%VIBEVOICE_URL%" "%INSTALL_DIR%VibeVoice_repo.zip"
423
+ if %errorlevel% neq 0 (
424
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
425
+ pause
426
+ exit /b 1
427
+ )
428
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%VibeVoice_repo.zip' -DestinationPath '%REPO_DIR%'"
429
+ del "%INSTALL_DIR%VibeVoice_repo.zip"
430
+ )
431
+ "%PYTHON_DIR%\python.exe" -m virtualenv --no-download "%VENV_DIR%"
432
+ if %errorlevel% neq 0 (
433
+ echo Error: Failed to create the virtual environment.
434
+ pause
435
+ exit /b 1
436
+ )
437
+
438
+ call "%VENV_DIR%\Scripts\activate"
439
+
440
+ echo Upgrading pip...
441
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" --upgrade pip
442
+ if %errorlevel% neq 0 (
443
+ echo Error: Failed to upgrade pip.
444
+ pause
445
+ exit /b 1
446
+ )
447
+
448
+ echo Checking for uv...
449
+ set "UV_EXE=%VENV_DIR%\Scripts\uv.exe"
450
+
451
+ if not exist "%UV_EXE%" (
452
+ echo 'uv' not found. Attempting installation...
453
+
454
+ "%VENV_DIR%\Scripts\python.exe" -m ensurepip --default-pip >nul 2>&1
455
+ if errorlevel 1 (
456
+ echo Failed to bootstrap pip. Trying get-pip.py...
457
+ curl -L -o "%TEMP%\get-pip.py" "%GET_PIP_URL%"
458
+ "%VENV_DIR%\Scripts\python.exe" "%TEMP%\get-pip.py"
459
+ if errorlevel 1 (
460
+ echo Error: Failed to install pip.
461
+ pause
462
+ exit /b 1
463
+ )
464
+ )
465
+
466
+ "%VENV_DIR%\Scripts\python.exe" -m pip install uv
467
+ if errorlevel 1 (
468
+ echo Error: Failed to install uv.
469
+ pause
470
+ exit /b 1
471
+ )
472
+
473
+ if not exist "%UV_EXE%" (
474
+ echo Error: uv.exe not found at: %UV_EXE%
475
+ pause
476
+ exit /b 1
477
+ )
478
+ )
479
+
480
+ echo Installing dependencies.
481
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" -e "%REPO_DIR%"
482
+ if errorlevel 1 (
483
+ echo Error: Failed to install main dependencies.
484
+ pause
485
+ exit /b 1
486
+ )
487
+
488
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" soundfile ffmpeg-python huggingface_hub
489
+ if errorlevel 1 (
490
+ echo Error: Failed to install additional dependencies.
491
+ pause
492
+ exit /b 1
493
+ )
494
+
495
+ call :RunCommandWithRetry pip install --cache-dir "%PIP_CACHE_DIR%" rtx50-compat==3.0.2 --no-deps --index-url https://pypi.org/simple
496
+ if errorlevel 1 (
497
+ echo Error: Failed to install additional dependencies.
498
+ pause
499
+ exit /b 1
500
+ )
501
+
502
+ echo Re-installing PyTorch...
503
+ uv pip uninstall torch torchvision torchaudio
504
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" torch==2.7.1+cu128 torchvision==0.22.1+cu128 torchaudio==2.7.1+cu128 --index-url https://download.pytorch.org/whl/cu128
505
+ if errorlevel 1 (
506
+ echo Error: Failed to install PyTorch with CUDA support.
507
+ pause
508
+ exit /b 1
509
+ )
510
+ echo PyTorch installed successfully.
511
+
512
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show einops >nul 2>&1
513
+ if errorlevel 1 (
514
+ echo Installing einops...
515
+ call :RunCommandWithRetry uv pip install einops --cache-dir "%PIP_CACHE_DIR%"
516
+ )
517
+
518
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show transformers >nul 2>&1
519
+ if errorlevel 1 (
520
+ echo Installing transformers...
521
+ call :RunCommandWithRetry uv pip install transformers --cache-dir "%PIP_CACHE_DIR%"
522
+ )
523
+
524
+ echo Installing FlashAttention...
525
+ set "FLASH_ATTN_URL=https://huggingface.co/datasets/LeeAeron/VobeVoicePrivate/resolve/main/flash_attn-2.7.4.post1+cu128torch2.7.0cxx11abiFALSE-cp310-cp310-win_amd64.whl?download=true"
526
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" "%FLASH_ATTN_URL%" --force-reinstall --no-deps
527
+ if errorlevel 1 (
528
+ echo Error: Failed to install FlashAttention.
529
+ pause
530
+ exit /b 1
531
+ )
532
+ echo FlashAttention installed successfully.
533
+
534
+ echo Installing Triton-Windows...
535
+ call :RunCommandWithRetry uv pip install triton-windows --cache-dir "%PIP_CACHE_DIR%"
536
+
537
+ echo Installing bitsandbytes for int4 quantization support...
538
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" bitsandbytes
539
+ if errorlevel 1 (
540
+ echo Error: Failed to install bitsandbytes.
541
+ pause
542
+ exit /b 1
543
+ )
544
+ echo bitsandbytes installed successfully.
545
+
546
+ echo Installing ruaccent...
547
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" ruaccent
548
+ if errorlevel 1 (
549
+ echo Error: Failed to install ruaccent.
550
+ pause
551
+ exit /b 1
552
+ )
553
+ echo ruaccent installed successfully.
554
+
555
+ "%VENV_DIR%\Scripts\python.exe" -m pip uninstall gradio -y
556
+ "%VENV_DIR%\Scripts\python.exe" -m pip install gradio==5.49.1
557
+
558
+ echo Copying voice samples...
559
+ if exist "%~dp0voice-pack\" (
560
+ echo Found 'voice-pack'. Copying...
561
+ xcopy "%~dp0voice-pack" "%REPO_DIR%\demo\voices\" /E /I /Y > nul
562
+ if !errorlevel! neq 0 (
563
+ echo Error: Failed to copy voice samples.
564
+ pause
565
+ ) else (
566
+ echo Voice samples copied successfully.
567
+ if "!CLEAN_VOICEPACK!"=="1" (
568
+ echo Cleaning up 'voice-pack' directory...
569
+ rmdir /s /q "%~dp0voice-pack"
570
+ if exist "%~dp0voice-pack\" (
571
+ echo Warning: Failed to delete 'voice-pack' directory.
572
+ ) else (
573
+ echo 'voice-pack' directory deleted.
574
+ )
575
+ )
576
+ )
577
+ ) else (
578
+ echo Warning: 'voice-pack' not found. Skipping...
579
+ )
580
+ rmdir /s /q "%TEMP%" 2>nul
581
+ pause
582
+ goto main_menu
583
+
584
+ :install_vibe_cu121flashattn_py311
585
+ cls
586
+ echo Preparing for installation: cleaning up old files...
587
+ if exist "%VENV_DIR%" rmdir /s /q "%VENV_DIR%"
588
+ if exist "%REPO_DIR%" rmdir /s /q "%REPO_DIR%"
589
+ if exist "%PYTHONUSERBASE%" rmdir /s /q "%PYTHONUSERBASE%"
590
+ if exist "%TEMP%" rmdir /s /q "%TEMP%"
591
+ if exist "%PYTHON_DIR%" rmdir /s /q "%PYTHON_DIR%"
592
+ if "%CLEAN_PIP_CACHE%"=="1" (
593
+ if exist "%PIP_CACHE_DIR%" rmdir /s /q "%PIP_CACHE_DIR%"
594
+ )
595
+
596
+ if "%CLEAN_HF_HOME%"=="1" (
597
+ if exist "%HF_HOME%" rmdir /s /q "%HF_HOME%"
598
+ )
599
+
600
+ if "%CLEAN_VOICEPACK%"=="1" (
601
+ if exist "%VOICEPACK_DIR%" rmdir /s /q "%VOICEPACK_DIR%"
602
+ )
603
+
604
+ if "%CLEAN_FFMPEG%"=="1" (
605
+ if exist "%FFMPEG_DIR%" rmdir /s /q "%FFMPEG_DIR%"
606
+ )
607
+ mkdir "%TEMP%"
608
+
609
+ set "PATH=%~dp0python_embedded;%~dp0ffmpeg\bin;%PATH%"
610
+
611
+ echo Installing Python...
612
+ if not exist "%PYTHON_DIR%" (
613
+ mkdir "%PYTHON_DIR%"
614
+ call :DownloadFile "%PYTHON311_URL%" "%INSTALL_DIR%python.zip"
615
+ if %errorlevel% neq 0 (
616
+ echo Error: Failed to download Python after %MAX_RETRIES% attempts.
617
+ pause
618
+ exit /b 1
619
+ )
620
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%python.zip' -DestinationPath '%PYTHON_DIR%'"
621
+ del "%INSTALL_DIR%python.zip"
622
+
623
+ echo.
624
+ echo Configuring Python to use pip...
625
+ powershell -Command "(Get-Content '%PYTHON_DIR%\python311._pth') -replace '#import site', 'import site' | Set-Content '%PYTHON_DIR%\python311._pth'"
626
+
627
+ echo Installing pip...
628
+ call :DownloadFile "%GET_PIP_URL%" "%PYTHON_DIR%\get-pip.py"
629
+ if %errorlevel% neq 0 (
630
+ echo Error: Failed to download get-pip.py after %MAX_RETRIES% attempts.
631
+ pause
632
+ exit /b 1
633
+ )
634
+ "%PYTHON_DIR%\python.exe" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
635
+ del "%PYTHON_DIR%\get-pip.py"
636
+ )
637
+
638
+ echo Installing ffmpeg binaries...
639
+ if not exist "%FFMPEG_DIR%" (
640
+ mkdir "%FFMPEG_DIR%"
641
+ call :DownloadFile "%FFMPEG_URL%" "%INSTALL_DIR%ffmpeg.zip"
642
+ if %errorlevel% neq 0 (
643
+ echo Error: Failed to download FFMPEG after %MAX_RETRIES% attempts.
644
+ pause
645
+ exit /b 1
646
+ )
647
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%ffmpeg.zip' -DestinationPath '%FFMPEG_DIR%'"
648
+ del "%INSTALL_DIR%ffmpeg.zip"
649
+ )
650
+
651
+ echo Installing VoicePack...
652
+ if not exist "%VOICEPACK_DIR%" (
653
+ mkdir "%VOICEPACK_DIR%"
654
+ call :DownloadFile "%VOICEPACK_URL%" "%INSTALL_DIR%voice-pack.zip"
655
+ if %errorlevel% neq 0 (
656
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
657
+ pause
658
+ exit /b 1
659
+ )
660
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%voice-pack.zip' -DestinationPath '%VOICEPACK_DIR%'"
661
+ del "%INSTALL_DIR%voice-pack.zip"
662
+ )
663
+
664
+ echo Installing virtualenv...
665
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" virtualenv
666
+ if %errorlevel% neq 0 (
667
+ echo Error: Failed to install virtualenv after %MAX_RETRIES% attempts.
668
+ pause
669
+ exit /b 1
670
+ )
671
+
672
+ echo Installing repository and dependencies...
673
+ if not exist "%REPO_DIR%" (
674
+ mkdir "%REPO_DIR%"
675
+ call :DownloadFile "%VIBEVOICE_URL%" "%INSTALL_DIR%VibeVoice_repo.zip"
676
+ if %errorlevel% neq 0 (
677
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
678
+ pause
679
+ exit /b 1
680
+ )
681
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%VibeVoice_repo.zip' -DestinationPath '%REPO_DIR%'"
682
+ del "%INSTALL_DIR%VibeVoice_repo.zip"
683
+ )
684
+ "%PYTHON_DIR%\python.exe" -m virtualenv --no-download "%VENV_DIR%"
685
+ if %errorlevel% neq 0 (
686
+ echo Error: Failed to create the virtual environment.
687
+ pause
688
+ exit /b 1
689
+ )
690
+
691
+ call "%VENV_DIR%\Scripts\activate"
692
+
693
+ echo Upgrading pip...
694
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" --upgrade pip
695
+ if %errorlevel% neq 0 (
696
+ echo Error: Failed to upgrade pip.
697
+ pause
698
+ exit /b 1
699
+ )
700
+
701
+ echo Checking for uv in virtual environment...
702
+ set "UV_EXE=%VENV_DIR%\Scripts\uv.exe"
703
+ if not exist "%UV_EXE%" (
704
+ echo 'uv' not found. Attempting installation...
705
+
706
+ "%VENV_DIR%\Scripts\python.exe" -m ensurepip --default-pip >nul 2>&1
707
+ if errorlevel 1 (
708
+ echo Failed to bootstrap pip. Trying get-pip.py...
709
+ curl -L -o "%TEMP%\get-pip.py" "%GET_PIP_URL%"
710
+ "%VENV_DIR%\Scripts\python.exe" "%TEMP%\get-pip.py"
711
+ if errorlevel 1 (
712
+ echo Error: Failed to install pip.
713
+ pause
714
+ exit /b 1
715
+ )
716
+ )
717
+
718
+ "%VENV_DIR%\Scripts\python.exe" -m pip install uv
719
+ if errorlevel 1 (
720
+ echo Error: Failed to install uv.
721
+ pause
722
+ exit /b 1
723
+ )
724
+
725
+ if not exist "%UV_EXE%" (
726
+ echo Error: uv.exe not found at expected location: %UV_EXE%
727
+ pause
728
+ exit /b 1
729
+ )
730
+ )
731
+
732
+ echo Installing dependencies.
733
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" -e "%REPO_DIR%"
734
+ if errorlevel 1 (
735
+ echo Error: Failed to install main dependencies.
736
+ pause
737
+ exit /b 1
738
+ )
739
+
740
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" soundfile ffmpeg-python huggingface_hub
741
+ if errorlevel 1 (
742
+ echo Error: Failed to install additional dependencies.
743
+ pause
744
+ exit /b 1
745
+ )
746
+
747
+ call :RunCommandWithRetry pip install --cache-dir "%PIP_CACHE_DIR%" rtx50-compat==3.0.2 --no-deps --index-url https://pypi.org/simple
748
+ if errorlevel 1 (
749
+ echo Error: Failed to install additional dependencies.
750
+ pause
751
+ exit /b 1
752
+ )
753
+
754
+ echo Re-installing PyTorch...
755
+ uv pip uninstall torch torchvision torchaudio
756
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
757
+ if errorlevel 1 (
758
+ echo Error: Failed to install PyTorch with CUDA support.
759
+ pause
760
+ exit /b 1
761
+ )
762
+ echo PyTorch installed successfully.
763
+
764
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show einops >nul 2>&1
765
+ if errorlevel 1 (
766
+ echo Installing einops...
767
+ call :RunCommandWithRetry uv pip install einops --cache-dir "%PIP_CACHE_DIR%"
768
+ )
769
+
770
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show transformers >nul 2>&1
771
+ if errorlevel 1 (
772
+ echo Installing transformers...
773
+ call :RunCommandWithRetry uv pip install transformers --cache-dir "%PIP_CACHE_DIR%"
774
+ )
775
+
776
+ echo Installing FlashAttention...
777
+ set "FLASH_ATTN_URL=https://huggingface.co/datasets/LeeAeron/VobeVoicePrivate/resolve/main/flash_attn-2.5.9-cp311-cp311-win_amd64.whl?download=true"
778
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" ^
779
+ "%FLASH_ATTN_URL%" --force-reinstall --no-deps
780
+ if errorlevel 1 (
781
+ echo Error: Failed to install FlashAttention.
782
+ pause
783
+ exit /b 1
784
+ )
785
+ echo FlashAttention installed successfully.
786
+
787
+ echo Installing Triton-Windows...
788
+ call :RunCommandWithRetry uv pip install triton-windows --cache-dir "%PIP_CACHE_DIR%"
789
+
790
+ echo Installing bitsandbytes for int4 quantization support...
791
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" bitsandbytes
792
+ if errorlevel 1 (
793
+ echo Error: Failed to install bitsandbytes.
794
+ pause
795
+ exit /b 1
796
+ )
797
+ echo bitsandbytes installed successfully.
798
+
799
+ echo Installing ruaccent...
800
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" ruaccent
801
+ if errorlevel 1 (
802
+ echo Error: Failed to install ruaccent.
803
+ pause
804
+ exit /b 1
805
+ )
806
+ echo ruaccent installed successfully.
807
+
808
+ "%VENV_DIR%\Scripts\python.exe" -m pip uninstall gradio -y
809
+ "%VENV_DIR%\Scripts\python.exe" -m pip install gradio==5.49.1
810
+
811
+ echo Copying voice samples...
812
+ if exist "%~dp0voice-pack\" (
813
+ echo Found 'voice-pack' directory. Copying contents...
814
+ xcopy "%~dp0voice-pack" "%REPO_DIR%\demo\voices\" /E /I /Y > nul
815
+ if !errorlevel! neq 0 (
816
+ echo Error: Failed to copy voice samples.
817
+ pause
818
+ ) else (
819
+ echo Voice samples copied successfully.
820
+ if "!CLEAN_VOICEPACK!"=="1" (
821
+ echo Cleaning up 'voice-pack' directory...
822
+ rmdir /s /q "%~dp0voice-pack"
823
+ if exist "%~dp0voice-pack\" (
824
+ echo Warning: Failed to delete 'voice-pack' directory.
825
+ ) else (
826
+ echo 'voice-pack' directory deleted.
827
+ )
828
+ )
829
+ )
830
+ ) else (
831
+ echo Warning: 'voice-pack' not found. Skipping...
832
+ )
833
+
834
+ rmdir /s /q "%TEMP%" 2>nul
835
+ pause
836
+ goto main_menu
837
+
838
+ :install_vibe_271cu128flashattn_py311
839
+ cls
840
+ if exist "%VENV_DIR%" rmdir /s /q "%VENV_DIR%"
841
+ if exist "%REPO_DIR%" rmdir /s /q "%REPO_DIR%"
842
+ if exist "%PYTHONUSERBASE%" rmdir /s /q "%PYTHONUSERBASE%"
843
+ if exist "%TEMP%" rmdir /s /q "%TEMP%"
844
+ if exist "%PYTHON_DIR%" rmdir /s /q "%PYTHON_DIR%"
845
+ if "%CLEAN_PIP_CACHE%"=="1" (
846
+ if exist "%PIP_CACHE_DIR%" rmdir /s /q "%PIP_CACHE_DIR%"
847
+ )
848
+
849
+ if "%CLEAN_HF_HOME%"=="1" (
850
+ if exist "%HF_HOME%" rmdir /s /q "%HF_HOME%"
851
+ )
852
+
853
+ if "%CLEAN_VOICEPACK%"=="1" (
854
+ if exist "%VOICEPACK_DIR%" rmdir /s /q "%VOICEPACK_DIR%"
855
+ )
856
+
857
+ if "%CLEAN_FFMPEG%"=="1" (
858
+ if exist "%FFMPEG_DIR%" rmdir /s /q "%FFMPEG_DIR%"
859
+ )
860
+ mkdir "%TEMP%"
861
+
862
+ set "PATH=%~dp0python_embedded;%~dp0ffmpeg\bin;%PATH%"
863
+
864
+ echo Installing Python 3.10...
865
+ if not exist "%PYTHON_DIR%" (
866
+ mkdir "%PYTHON_DIR%"
867
+ call :DownloadFile "%PYTHON311_URL%" "%INSTALL_DIR%python.zip"
868
+ if %errorlevel% neq 0 (
869
+ echo Error: Failed to download Python after %MAX_RETRIES% attempts.
870
+ pause
871
+ exit /b 1
872
+ )
873
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%python.zip' -DestinationPath '%PYTHON_DIR%'"
874
+ del "%INSTALL_DIR%python.zip"
875
+
876
+ echo Configuring Python to use pip...
877
+ powershell -Command "(Get-Content '%PYTHON_DIR%\python311._pth') -replace '#import site', 'import site' | Set-Content '%PYTHON_DIR%\python311._pth'"
878
+
879
+ call :DownloadFile "%GET_PIP_URL%" "%PYTHON_DIR%\get-pip.py"
880
+ if %errorlevel% neq 0 (
881
+ echo Error: Failed to download get-pip.py after %MAX_RETRIES% attempts.
882
+ pause
883
+ exit /b 1
884
+ )
885
+ "%PYTHON_DIR%\python.exe" "%PYTHON_DIR%\get-pip.py" --no-warn-script-location
886
+ del "%PYTHON_DIR%\get-pip.py"
887
+ )
888
+
889
+ echo Installing ffmpeg binaries...
890
+ if not exist "%FFMPEG_DIR%" (
891
+ mkdir "%FFMPEG_DIR%"
892
+ call :DownloadFile "%FFMPEG_URL%" "%INSTALL_DIR%ffmpeg.zip"
893
+ if %errorlevel% neq 0 (
894
+ echo Error: Failed to download FFMPEG after %MAX_RETRIES% attempts.
895
+ pause
896
+ exit /b 1
897
+ )
898
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%ffmpeg.zip' -DestinationPath '%FFMPEG_DIR%'"
899
+ del "%INSTALL_DIR%ffmpeg.zip"
900
+ )
901
+
902
+ echo Installing VoicePack...
903
+ if not exist "%VOICEPACK_DIR%" (
904
+ mkdir "%VOICEPACK_DIR%"
905
+ call :DownloadFile "%VOICEPACK_URL%" "%INSTALL_DIR%voice-pack.zip"
906
+ if %errorlevel% neq 0 (
907
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
908
+ pause
909
+ exit /b 1
910
+ )
911
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%voice-pack.zip' -DestinationPath '%VOICEPACK_DIR%'"
912
+ del "%INSTALL_DIR%voice-pack.zip"
913
+ )
914
+
915
+ echo Installing virtualenv...
916
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" virtualenv
917
+ if %errorlevel% neq 0 (
918
+ echo Error: Failed to install virtualenv after %MAX_RETRIES% attempts.
919
+ pause
920
+ exit /b 1
921
+ )
922
+
923
+ echo Installing repository and dependencies...
924
+ if not exist "%REPO_DIR%" (
925
+ mkdir "%REPO_DIR%"
926
+ call :DownloadFile "%VIBEVOICE_URL%" "%INSTALL_DIR%VibeVoice_repo.zip"
927
+ if %errorlevel% neq 0 (
928
+ echo Error: Failed to download VoicePack after %MAX_RETRIES% attempts.
929
+ pause
930
+ exit /b 1
931
+ )
932
+ powershell -Command "Expand-Archive -Path '%INSTALL_DIR%VibeVoice_repo.zip' -DestinationPath '%REPO_DIR%'"
933
+ del "%INSTALL_DIR%VibeVoice_repo.zip"
934
+ )
935
+ "%PYTHON_DIR%\python.exe" -m virtualenv --no-download "%VENV_DIR%"
936
+ if %errorlevel% neq 0 (
937
+ echo Error: Failed to create the virtual environment.
938
+ pause
939
+ exit /b 1
940
+ )
941
+
942
+ call "%VENV_DIR%\Scripts\activate"
943
+
944
+ echo Upgrading pip...
945
+ call :RunCommandWithRetry "%PYTHON_DIR%\python.exe" -m pip install --cache-dir "%PIP_CACHE_DIR%" --upgrade pip
946
+ if %errorlevel% neq 0 (
947
+ echo Error: Failed to upgrade pip.
948
+ pause
949
+ exit /b 1
950
+ )
951
+
952
+ echo Checking for uv...
953
+ set "UV_EXE=%VENV_DIR%\Scripts\uv.exe"
954
+
955
+ if not exist "%UV_EXE%" (
956
+ echo 'uv' not found. Attempting installation...
957
+
958
+ "%VENV_DIR%\Scripts\python.exe" -m ensurepip --default-pip >nul 2>&1
959
+ if errorlevel 1 (
960
+ echo Failed to bootstrap pip. Trying get-pip.py...
961
+ curl -L -o "%TEMP%\get-pip.py" "%GET_PIP_URL%"
962
+ "%VENV_DIR%\Scripts\python.exe" "%TEMP%\get-pip.py"
963
+ if errorlevel 1 (
964
+ echo Error: Failed to install pip.
965
+ pause
966
+ exit /b 1
967
+ )
968
+ )
969
+
970
+ "%VENV_DIR%\Scripts\python.exe" -m pip install uv
971
+ if errorlevel 1 (
972
+ echo Error: Failed to install uv.
973
+ pause
974
+ exit /b 1
975
+ )
976
+
977
+ if not exist "%UV_EXE%" (
978
+ echo Error: uv.exe not found at: %UV_EXE%
979
+ pause
980
+ exit /b 1
981
+ )
982
+ )
983
+
984
+ echo Installing dependencies.
985
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" -e "%REPO_DIR%"
986
+ if errorlevel 1 (
987
+ echo Error: Failed to install main dependencies.
988
+ pause
989
+ exit /b 1
990
+ )
991
+
992
+ call :RunCommandWithRetry "%UV_EXE%" pip install --cache-dir "%PIP_CACHE_DIR%" soundfile ffmpeg-python huggingface_hub
993
+ if errorlevel 1 (
994
+ echo Error: Failed to install additional dependencies.
995
+ pause
996
+ exit /b 1
997
+ )
998
+
999
+ call :RunCommandWithRetry pip install --cache-dir "%PIP_CACHE_DIR%" rtx50-compat==3.0.2 --no-deps --index-url https://pypi.org/simple
1000
+ if errorlevel 1 (
1001
+ echo Error: Failed to install additional dependencies.
1002
+ pause
1003
+ exit /b 1
1004
+ )
1005
+
1006
+ echo Re-installing PyTorch...
1007
+ uv pip uninstall torch torchvision torchaudio
1008
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" torch==2.7.1+cu128 torchvision==0.22.1+cu128 torchaudio==2.7.1+cu128 --index-url https://download.pytorch.org/whl/cu128
1009
+ if errorlevel 1 (
1010
+ echo Error: Failed to install PyTorch with CUDA support.
1011
+ pause
1012
+ exit /b 1
1013
+ )
1014
+ echo PyTorch installed successfully.
1015
+
1016
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show einops >nul 2>&1
1017
+ if errorlevel 1 (
1018
+ echo Installing einops...
1019
+ call :RunCommandWithRetry uv pip install einops --cache-dir "%PIP_CACHE_DIR%"
1020
+ )
1021
+
1022
+ call "%~dp0system\venv\Scripts\python.exe" -m pip show transformers >nul 2>&1
1023
+ if errorlevel 1 (
1024
+ echo Installing transformers...
1025
+ call :RunCommandWithRetry uv pip install transformers --cache-dir "%PIP_CACHE_DIR%"
1026
+ )
1027
+
1028
+ echo Installing FlashAttention...
1029
+ set "FLASH_ATTN_URL=https://huggingface.co/datasets/LeeAeron/VobeVoicePrivate/resolve/main/flash_attn-2.7.4.post1-cp311-cp311-win_amd64.whl?download=true"
1030
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" "%FLASH_ATTN_URL%" --force-reinstall --no-deps
1031
+ if errorlevel 1 (
1032
+ echo Error: Failed to install FlashAttention.
1033
+ pause
1034
+ exit /b 1
1035
+ )
1036
+ echo FlashAttention installed successfully.
1037
+
1038
+ echo Installing Triton-Windows...
1039
+ call :RunCommandWithRetry uv pip install triton-windows --cache-dir "%PIP_CACHE_DIR%"
1040
+
1041
+ echo Installing bitsandbytes for int4 quantization support...
1042
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" bitsandbytes
1043
+ if errorlevel 1 (
1044
+ echo Error: Failed to install bitsandbytes.
1045
+ pause
1046
+ exit /b 1
1047
+ )
1048
+ echo bitsandbytes installed successfully.
1049
+
1050
+ echo Installing ruaccent...
1051
+ call :RunCommandWithRetry uv pip install --cache-dir "%PIP_CACHE_DIR%" ruaccent
1052
+ if errorlevel 1 (
1053
+ echo Error: Failed to install ruaccent.
1054
+ pause
1055
+ exit /b 1
1056
+ )
1057
+ echo ruaccent installed successfully.
1058
+
1059
+ "%VENV_DIR%\Scripts\python.exe" -m pip uninstall gradio -y
1060
+ "%VENV_DIR%\Scripts\python.exe" -m pip install gradio==5.49.1
1061
+
1062
+ echo Copying voice samples...
1063
+ if exist "%~dp0voice-pack\" (
1064
+ echo Found 'voice-pack'. Copying...
1065
+ xcopy "%~dp0voice-pack" "%REPO_DIR%\demo\voices\" /E /I /Y > nul
1066
+ if !errorlevel! neq 0 (
1067
+ echo Error: Failed to copy voice samples.
1068
+ pause
1069
+ ) else (
1070
+ echo Voice samples copied successfully.
1071
+ if "!CLEAN_VOICEPACK!"=="1" (
1072
+ echo Cleaning up 'voice-pack' directory...
1073
+ rmdir /s /q "%~dp0voice-pack"
1074
+ if exist "%~dp0voice-pack\" (
1075
+ echo Warning: Failed to delete 'voice-pack' directory.
1076
+ ) else (
1077
+ echo 'voice-pack' directory deleted.
1078
+ )
1079
+ )
1080
+ )
1081
+ ) else (
1082
+ echo Warning: 'voice-pack' not found. Skipping...
1083
+ )
1084
+ rmdir /s /q "%TEMP%" 2>nul
1085
+ pause
1086
+ goto main_menu
1087
+
1088
+ :start_vibe
1089
+ REM is user = monkey check
1090
+ if not exist "%PYTHON_DIR%\python.exe" (
1091
+ echo VibeVoice not installed. Going to installation menu...
1092
+ goto install_vibe
1093
+ )
1094
+
1095
+ cls
1096
+ setlocal enabledelayedexpansion
1097
+ cd /d "%~dp0"
1098
+ set "PATH=%~dp0python_embedded;%~dp0ffmpeg\bin;%PATH%"
1099
+ set "TEMP=%~dp0temp"
1100
+ set "TMP=%~dp0temp"
1101
+ set "GRADIO_TEMP_DIR=%~dp0temp"
1102
+ set "HF_HOME=%~dp0huggingface_cache"
1103
+ set "PIP_CACHE_DIR=%~dp0cache"
1104
+ set "PYTHONUSERBASE=%~dp0python_user_base"
1105
+ if not exist "%TEMP%" mkdir "%TEMP%"
1106
+ if not exist "%HF_HOME%" mkdir "%HF_HOME%"
1107
+ if not exist "models" mkdir "models"
1108
+ where ffprobe >nul 2>nul
1109
+ if errorlevel 1 (
1110
+ echo [ERROR] ffprobe not in PATH. Audio features not work.
1111
+ pause
1112
+ )
1113
+ call "system\venv\Scripts\activate.bat"
1114
+ cd VibeVoice
1115
+ echo Starting VibeVoice...
1116
+ python demo\gradio_demo.py --device cuda
1117
+ pause
1118
+
1119
+ :start_vibe_low
1120
+ REM is user = monkey check
1121
+ if not exist "%PYTHON_DIR%\python.exe" (
1122
+ echo VibeVoice not installed. Going to installation menu...
1123
+ goto install_vibe
1124
+ )
1125
+
1126
+ cls
1127
+ setlocal enabledelayedexpansion
1128
+ cd /d "%~dp0"
1129
+ set "PATH=%~dp0python_embedded;%~dp0ffmpeg\bin;%PATH%"
1130
+ set "TEMP=%~dp0temp"
1131
+ set "TMP=%~dp0temp"
1132
+ set "GRADIO_TEMP_DIR=%~dp0temp"
1133
+ set "HF_HOME=%~dp0huggingface_cache"
1134
+ set "PIP_CACHE_DIR=%~dp0cache"
1135
+ set "PYTHONUSERBASE=%~dp0python_user_base"
1136
+ set "PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128"
1137
+ if not exist "%TEMP%" mkdir "%TEMP%"
1138
+ if not exist "%HF_HOME%" mkdir "%HF_HOME%"
1139
+ if not exist "models" mkdir "models"
1140
+ where ffprobe >nul 2>nul
1141
+ if errorlevel 1 (
1142
+ echo [ERROR] ffprobe not in PATH. Audio features not work.
1143
+ pause
1144
+ )
1145
+ call "system\venv\Scripts\activate.bat"
1146
+ cd VibeVoice
1147
+ echo Starting VibeVoice...
1148
+ python demo\gradio_demo.py --device cpu --inference_steps 10
1149
+ pause
1150
+
1151
+ :DownloadFile
1152
+ set "URL=%~1"
1153
+ set "OutputFile=%~2"
1154
+ for /L %%i in (1,1,%MAX_RETRIES%) do (
1155
+ echo Attempt %%i of %MAX_RETRIES% to download %OutputFile%...
1156
+ powershell -Command "(New-Object Net.WebClient).DownloadFile('!URL!', '!OutputFile!')"
1157
+ if !errorlevel! equ 0 (
1158
+ echo Download successful.
1159
+ exit /b 0
1160
+ )
1161
+ echo Download failed. Retrying in %RETRY_DELAY% seconds...
1162
+ timeout /t %RETRY_DELAY% /nobreak > nul
1163
+ )
1164
+ exit /b 1
1165
+
1166
+ :RunCommandWithRetry
1167
+ set "command_to_run=%*"
1168
+ for /L %%i in (1,1,%MAX_RETRIES%) do (
1169
+ echo Attempt %%i of %MAX_RETRIES%: Running '%command_to_run%'...
1170
+ %command_to_run%
1171
+ if !errorlevel! equ 0 (
1172
+ echo Command successful.
1173
+ exit /b 0
1174
+ )
1175
+ echo Command failed. Retrying in %RETRY_DELAY% seconds...
1176
+ timeout /t %RETRY_DELAY% /nobreak > nul
1177
+ )
1178
+ exit /b 1