-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.cmd
More file actions
168 lines (149 loc) · 6.46 KB
/
Copy pathinstall.cmd
File metadata and controls
168 lines (149 loc) · 6.46 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
@echo off
:: =============================================================================
:: install.cmd : HAVC DiT Server : environment installer (Windows)
::
:: Installs all required Python packages into the currently active virtual
:: environment (or the conda environment specified below).
::
:: Recommended usage:
:: 1. Create and activate a venv first:
:: python -m venv .venv
:: .venv\Scripts\activate
:: 2. Then run this script:
:: install.cmd
::
:: Edit the USER CONFIGURATION block below only if you are NOT using a venv
:: and want to target a specific conda environment instead.
:: =============================================================================
:: ---------------------------------------------------------------------------
:: USER CONFIGURATION : leave CONDA_ENV empty if you are using a plain venv
:: ---------------------------------------------------------------------------
:: Conda environment name : used only when PYTHON_EXE is not set and no venv
:: is active. Leave empty to rely on the currently active environment.
set CONDA_ENV=
:: Explicit path to python.exe : leave empty for auto-detection
:: Example: set PYTHON_EXE=C:\Users\YourName\.venv\Scripts\python.exe
set PYTHON_EXE=
:: Directory containing install.cmd, patch_nunchaku.py and the packages\ folder
:: Leave empty to use the directory of this script
set INSTALL_DIR=
:: ---------------------------------------------------------------------------
:: RESOLVE PATHS
:: ---------------------------------------------------------------------------
if "%INSTALL_DIR%"=="" set INSTALL_DIR=%~dp0
if "%INSTALL_DIR:~-1%"=="\" set INSTALL_DIR=%INSTALL_DIR:~0,-1%
set PATCH_SCRIPT=%INSTALL_DIR%\patch_nunchaku.py
set DIFFUSERS_WHEEL=%INSTALL_DIR%\packages\diffusers-0.37.0.dev0-py3-none-any.whl
if not exist "%PATCH_SCRIPT%" (
echo [ERROR] patch_nunchaku.py not found in: %INSTALL_DIR%
pause & exit /b 1
)
if not exist "%DIFFUSERS_WHEEL%" (
echo [ERROR] diffusers wheel not found: %DIFFUSERS_WHEEL%
pause & exit /b 1
)
:: ---------------------------------------------------------------------------
:: RESOLVE PYTHON EXECUTABLE
:: ---------------------------------------------------------------------------
if not "%PYTHON_EXE%"=="" goto :run
:: If a venv is active, use it directly
if defined VIRTUAL_ENV (
set PYTHON_EXE=%VIRTUAL_ENV%\Scripts\python.exe
goto :run
)
:: Try conda environment if specified
if not "%CONDA_ENV%"=="" (
where conda >nul 2>&1
if %errorlevel%==0 (
echo [INFO] Activating conda environment: %CONDA_ENV%
call conda activate %CONDA_ENV% 2>nul
if %errorlevel%==0 (
set PYTHON_EXE=python
goto :run
)
echo [WARN] conda activate failed : falling back to base python
)
)
set PYTHON_EXE=python
:run
:: ---------------------------------------------------------------------------
:: BANNER
:: ---------------------------------------------------------------------------
echo ============================================================
echo HAVC DiT Server : Environment Installer
echo Python : %PYTHON_EXE%
echo Dir : %INSTALL_DIR%
echo ============================================================
echo.
:: ---------------------------------------------------------------------------
:: STEP 1 — PyTorch 2.10 + CUDA 13.0
:: ---------------------------------------------------------------------------
echo [1/6] Installing PyTorch 2.10 + CUDA 13.0 ...
"%PYTHON_EXE%" -m pip install ^
torch==2.10.0+cu130 ^
torchvision==0.25.0+cu130 ^
torchaudio==2.10.0+cu130 ^
--index-url https://download.pytorch.org/whl/cu130
if %errorlevel% neq 0 ( echo [ERROR] PyTorch install failed. & pause & exit /b 1 )
echo.
:: ---------------------------------------------------------------------------
:: STEP 2 — Nunchaku
:: ---------------------------------------------------------------------------
echo [2/6] Installing Nunchaku 1.2.1 ...
:: Nunchaku pulls torch>=2.0 via accelerate; the next step re-pins 2.10
"%PYTHON_EXE%" -m pip install ^
https://github.com/nunchaku-ai/nunchaku/releases/download/v1.2.1/nunchaku-1.2.1+cu13.0torch2.10-cp312-cp312-win_amd64.whl
if %errorlevel% neq 0 ( echo [ERROR] Nunchaku install failed. & pause & exit /b 1 )
echo.
:: ---------------------------------------------------------------------------
:: STEP 2b — Re-pin PyTorch 2.10 (nunchaku may have upgraded it to 2.12)
:: ---------------------------------------------------------------------------
echo [2b/6] Re-pinning PyTorch 2.10 ...
"%PYTHON_EXE%" -m pip install ^
torch==2.10.0+cu130 ^
torchvision==0.25.0+cu130 ^
torchaudio==2.10.0+cu130 ^
--index-url https://download.pytorch.org/whl/cu130 ^
--force-reinstall
if %errorlevel% neq 0 ( echo [ERROR] PyTorch re-pin failed. & pause & exit /b 1 )
echo.
:: ---------------------------------------------------------------------------
:: STEP 3 — Patch Nunchaku
:: ---------------------------------------------------------------------------
echo [3/6] Applying Nunchaku compatibility patch ...
"%PYTHON_EXE%" "%PATCH_SCRIPT%"
if %errorlevel% neq 0 ( echo [ERROR] Nunchaku patch failed. & pause & exit /b 1 )
echo.
:: ---------------------------------------------------------------------------
:: STEP 4 — Diffusers (local wheel)
:: ---------------------------------------------------------------------------
echo [4/6] Installing Diffusers 0.37.0.dev0 (local wheel) ...
"%PYTHON_EXE%" -m pip install "%DIFFUSERS_WHEEL%"
if %errorlevel% neq 0 ( echo [ERROR] Diffusers install failed. & pause & exit /b 1 )
echo.
:: ---------------------------------------------------------------------------
:: STEP 5 — Remaining dependencies
:: ---------------------------------------------------------------------------
echo [5/6] Installing remaining dependencies ...
"%PYTHON_EXE%" -m pip install ^
transformers==4.57.6 ^
accelerate==1.12.0 ^
"huggingface_hub>=0.26.0" ^
"Pillow>=10.0.0" ^
scipy ^
av ^
torchsde ^
gguf ^
comfy-aimdo==0.4.7 ^
comfy-kitchen
if %errorlevel% neq 0 ( echo [ERROR] Dependency install failed. & pause & exit /b 1 )
echo.
:: ---------------------------------------------------------------------------
:: DONE
:: ---------------------------------------------------------------------------
echo ============================================================
echo Installation complete.
echo Activate the environment and start the server with:
echo start_server.cmd
echo ============================================================
pause