Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created functional Windows Bat and NVDiffrast windows compiler settings added #72

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions Start_Windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
@echo off

REM Set Python to use UTF-8 encoding by default
set PYTHONUTF8=1

REM Set Python 3.10 installation path
set PYTHON="C:\Program Files\Python310\python.exe"

if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")
if not defined REQUIREMENTS_FILE (set "REQUIREMENTS_FILE=requirements.txt")
if not defined CONDA_INSTALL_DIR (set "CONDA_INSTALL_DIR=%UserProfile%\miniconda3")

set ERROR_REPORTING=TRUE
set CUDA_VERSION=12.1
set DISTUTILS_USE_SDK=1
set NVDIFFRAST_TORCH_LOAD_VERBOSE=1

REM Set VSPATH manually to the path of Visual Studio 2019 installation
set VSPATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community

REM Add Visual Studio 2019 paths
if defined VSPATH (
set "INCLUDE=%VSPATH%\VC\Tools\MSVC\14.29.30133\include;%INCLUDE%"
set "LIB=%VSPATH%\VC\Tools\MSVC\14.29.30133\lib\x64;%LIB%"
)

REM Add Windows SDK paths
set "INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;%INCLUDE%"
set "INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared;%INCLUDE%"
set "INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um;%INCLUDE%"
set "LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64;%LIB%"
set "LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64;%LIB%"

REM Add Python library path
set "PYTHON_LIB_PATH=C:\Program Files\Python310\libs"
set "LIB=%PYTHON_LIB_PATH%;%LIB%"

:start_venv
if ["%VENV_DIR%"] == ["-"] goto :skip_venv
if ["%SKIP_VENV%"] == ["1"] goto :skip_venv

dir "%VENV_DIR%\Scripts\Python.exe" >nul 2>&1
if %ERRORLEVEL% == 0 goto :activate_venv

echo Creating venv in directory %VENV_DIR% using python %PYTHON%
%PYTHON% -m venv "%VENV_DIR%"
if %ERRORLEVEL% == 0 (
echo Virtual environment created successfully.
) else (
echo Failed to create virtual environment.
goto :end
)

:activate_venv
set PYTHON="%VENV_DIR%\Scripts\Python.exe"
echo Activating venv...
call "%VENV_DIR%\Scripts\activate.bat"

REM Disable SSL verification and trust PyPI by default
set PYTHONHTTPSVERIFY=0
%PYTHON% -m pip config set global.trusted-host "pypi.org pypi.python.org files.pythonhosted.org huggingface.co"

REM Check network connectivity within the venv
echo Checking network connectivity within the venv...
%PYTHON% -m pip install --timeout=30 --retries=3 -r %REQUIREMENTS_FILE%
if %ERRORLEVEL% == 0 (
echo Network connectivity within the venv is OK.
) else (
echo Network connectivity issue within the venv. Trying to install packages individually...
for /f "delims=" %%p in (%REQUIREMENTS_FILE%) do (
echo Installing package: %%p
%PYTHON% -m pip install --timeout=30 --retries=3 %%p
if !ERRORLEVEL! NEQ 0 (
echo Failed to install package: %%p
goto :end
)
)
)

:skip_venv
goto :launch

:launch
echo Launching script...
%PYTHON% app.py %*
pause
exit /b

:end
echo.
echo Launch unsuccessful. Exiting.
pause
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
os.environ['CUDA_HOME'] = os.environ.get('CUDA_HOME', r'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4')

import imageio
import numpy as np
import torch
Expand Down Expand Up @@ -380,4 +382,4 @@ def make3d(images):
)

demo.queue(max_size=10)
demo.launch(server_name="0.0.0.0", server_port=43839)
demo.launch(server_name="localhost", server_port=5000)
8 changes: 7 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ bitsandbytes
imageio[ffmpeg]
xatlas
plyfile
git+https://github.com/NVlabs/nvdiffrast/
git+https://github.com/emangamer/nvdiffrast
Ninja
torch @ https://download.pytorch.org/whl/cu121/torch-2.1.0%2Bcu121-cp310-cp310-win_amd64.whl#sha256=6ee083ba804e863af059ea284c1678c1b0628699fb0014c8e043ceed7d4ce930
torchvision==0.16.0
torchaudio==2.1.0
xformers==0.0.22.post7
https://huggingface.co/r4ziel/xformers_pre_built/resolve/main/triton-2.0.0-cp310-cp310-win_amd64.whl