-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.bat
97 lines (76 loc) · 1.99 KB
/
start.bat
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
@echo off
chcp 65001
set USE_MIRROR=true
set PYTHONPATH=%~dp0
set PYTHON_CMD=python
if exist "fishenv" (
set PYTHON_CMD=%cd%\fishenv\env\python
)
set API_FLAG_PATH=%~dp0API_FLAGS.txt
set KMP_DUPLICATE_LIB_OK=TRUE
setlocal enabledelayedexpansion
set "HF_ENDPOINT=https://huggingface.co"
set "no_proxy="
if "%USE_MIRROR%" == "true" (
set "HF_ENDPOINT=https://hf-mirror.com"
set "no_proxy=localhost, 127.0.0.1, 0.0.0.0"
)
echo "HF_ENDPOINT: !HF_ENDPOINT!"
echo "NO_PROXY: !no_proxy!"
echo "%CD%"| findstr /R /C:"[!#\$%&()\*+,;<=>?@\[\]\^`{|}~\u4E00-\u9FFF ] " >nul && (
echo.
echo There are special characters in the current path, please make the path of fish-speech free of special characters before running. && (
goto end
)
)
%PYTHON_CMD% .\tools\download_models.py
set "API_FLAGS="
set "flags="
if exist "%API_FLAG_PATH%" (
for /f "usebackq tokens=*" %%a in ("%API_FLAG_PATH%") do (
set "line=%%a"
if not "!line:~0,1!"=="#" (
set "line=!line: =<SPACE>!"
set "line=!line:\=!"
set "line=!line:<SPACE>= !"
if not "!line!"=="" (
set "API_FLAGS=!API_FLAGS!!line! "
)
)
)
)
if not "!API_FLAGS!"=="" set "API_FLAGS=!API_FLAGS:~0,-1!"
set "flags="
echo !API_FLAGS! | findstr /C:"--api" >nul 2>&1
if !errorlevel! equ 0 (
echo.
echo Start HTTP API...
set "mode=api"
goto process_flags
)
echo !API_FLAGS! | findstr /C:"--infer" >nul 2>&1
if !errorlevel! equ 0 (
echo.
echo Start WebUI Inference...
set "mode=infer"
goto process_flags
)
:process_flags
for %%p in (!API_FLAGS!) do (
if not "%%p"=="--!mode!" (
set "flags=!flags! %%p"
)
)
if not "!flags!"=="" set "flags=!flags:~1!"
echo Debug: flags = !flags!
if "!mode!"=="api" (
%PYTHON_CMD% -m tools.api !flags!
) else if "!mode!"=="infer" (
%PYTHON_CMD% -m tools.webui !flags!
)
echo.
echo Next launch the page...
%PYTHON_CMD% fish_speech\webui\manage.py
:end
endlocal
pause