-
Notifications
You must be signed in to change notification settings - Fork 274
Expand file tree
/
Copy pathbuild_windows_wheel.cmd
More file actions
64 lines (52 loc) · 1.9 KB
/
Copy pathbuild_windows_wheel.cmd
File metadata and controls
64 lines (52 loc) · 1.9 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
@echo off
setlocal enabledelayedexpansion
:: get arguments
set PYTHON_VERSION=%1
set TORCH_VERSION=%2
set CUDA_VERSION=%3
set CUDA_SHORT_VERSION=%CUDA_VERSION:.=%
echo %CUDA_SHORT_VERSION%
:: setup some variables
if "%TORCH_VERSION%"=="2.5" (
set TORCHVISION_VERSION=0.20
set TORCHAUDIO_VERSION=2.5
) else if "%TORCH_VERSION%"=="2.6" (
set TORCHVISION_VERSION=0.21
set TORCHAUDIO_VERSION=2.6
) else if "%TORCH_VERSION%"=="2.7" (
set TORCHVISION_VERSION=0.22
set TORCHAUDIO_VERSION=2.7
) else if "%TORCH_VERSION%"=="2.8" (
set TORCHVISION_VERSION=0.23
set TORCHAUDIO_VERSION=2.8
) else if "%TORCH_VERSION%"=="2.9" (
set TORCHVISION_VERSION=0.24
set TORCHAUDIO_VERSION=2.9
) else (
echo TORCH_VERSION is not 2.5, 2.6, 2.7, 2.8 or 2.9, no changes to versions.
)
echo setting TORCHVISION_VERSION to %TORCHVISION_VERSION% and TORCHAUDIO_VERSION to %TORCHAUDIO_VERSION%
:: conda environment name
set ENV_NAME=build_env_%PYTHON_VERSION%_%TORCH_VERSION%
echo Using conda environment: %ENV_NAME%
:: create conda environment
call conda create -y -n %ENV_NAME% python=%PYTHON_VERSION%
call conda activate %ENV_NAME%
:: install dependencies
call pip install ninja setuptools wheel build
call pip install --no-cache-dir torch==%TORCH_VERSION% torchvision==%TORCHVISION_VERSION% torchaudio==%TORCHAUDIO_VERSION% --index-url "https://download.pytorch.org/whl/cu%CUDA_SHORT_VERSION%/"
:: set environment variables
set NUNCHAKU_INSTALL_MODE=ALL
set NUNCHAKU_BUILD_WHEELS=1
:: cd to the parent directory
cd /d "%~dp0.."
if exist build rd /s /q build
:: set up Visual Studio compilation environment
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat" -startdir=none -arch=x64 -host_arch=x64
set DISTUTILS_USE_SDK=1
:: build wheels
python -m build --wheel --no-isolation
:: exit conda
call conda deactivate
call conda remove -y -n %ENV_NAME% --all
echo Build complete!