Windows Support
Phylliida opened this issue · comments
Currently my build of gs errors on Windows saying these symbols are not defined, so I need to replace them in `gs/src/include/common.h with defines like this and then it compiles ok
#define EPS 1e-6
#define MIN_RADIAL -85.0f
#define gs_coeff_3d 0.06349363593424097f // 1 / (2 * pi) ** (3/2)
#define gs_coeff_2d 0.15915494309189535f // 1 / (2 * pi)
#define MAX_N_FLOAT_SM 12000 // 48KB
#define MIN_RENDER_ALPHA 0.00392156862745098f // 1 / 255.0f
Note for the owners: The reason for needing #define is stated here: https://stackoverflow.com/a/56974843:
"On windows it is using the Microsoft compiler for that. So the Microsoft compiler is correct to disallow VLA, and there is no way to avoid this AFAIK. Your code works on linux, because on linux nvcc uses the g++ host compiler, and it allows (in a non-standard-compliant way) the use of a VLA in C++ host code."
To give full setup instructions on Windows:
Try cloning from my repo via the command
git clone https://github.com/Phylliida/gsgen.git
I fixed the aux issue, the issue mentioned here, and uncommented out a line in setup.py that enables CUB_HOME to actually add to include.
Now open Developer command prompt for VS 2019 (for me this is equivalent to calling
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
in a regular command prompt, note the quotes. Though ur paths may be different)
These steps are optional now thanks to the -DWIN32_LEAN_AND_MEAN which is automatically applied if you use my repo:
Download cub (go into releases and pick the most recent) and extract it somewhere.
In the command prompt call
SET CUB_HOME=pathuextractedcubto
for example, for me it is
SET CUB_HOME=C:\Users\yams\Programs\cub
Also call this
SET DISTUTILS_USE_SDK=1
Stuff that isn't optional:
Now cd into the cloned directory and install requirements
cd gsgen
pip install -r requirements.txt
Then cd into the gs subdirectory
cd gs
Now call
pip install -e .
If that succeeded than you can go back to the gsgen directory via
cd ..
and the scripts in the repo README should now work.
By default it'll download and install stable diffusion every time you run the code, to fix this, modify conf/guidance/sd.yaml to point to a local directory. The easiest way to do this is to run example code from here, specifically this:
from diffusers import StableDiffusionPipeline
import torch
model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
then look in C:\Users\<you>\.cache\huggingface\hub\models--runwayml--stable-diffusion-v1-5\snapshots\<some id>
You can copy that folder to somewhere else and modify the path in sd.yaml to point to that. You might also need to change this line.
Also, if your prompt is long I recommend setting this to true so the direction modifiers go in the front of your prompt instead of the back
Note that it'll take about 3 hours (15000 steps) to create the 3D model. While it is running you can see the results in outputs/<date>/<date>/checkpoints/<prompt>/<date>/<id>/eval, look in the image and video folders. How frequently it shows you progress pictures/video is in base.yaml in eval, image_period and video_period
Hi Phylliida,
Thank you so much for identifying and resolving these issues. However, I currently do not have access to a Windows computer, so it may take a few days before I can merge your Pull Request. Once again, thank you for your assistance! 🥰
To give full setup instructions on Windows:
Try cloning from my repo via the command
git clone https://github.com/Phylliida/gsgen.git
I fixed the aux issue, the issue mentioned here, and uncommented out a line in setup.py that enables CUB_HOME to actually add to include.
Now open Developer command prompt for VS 2019 (for me this is equivalent to calling
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
in a regular command prompt, note the quotes. Though ur paths may be different)
Download cub (go into releases and pick the most recent) and extract it somewhere.
In the command prompt call
SET CUB_HOME=pathuextractedcubto
for example, for me it is
SET CUB_HOME=C:\Users\yams\Programs\cub
Also call this
SET DISTUTILS_USE_SDK=1
Now cd into the cloned directory and install requirements
cd gsgen pip install -r requirements.txt
Then cd into the gs subdirectory
cd gs
Now call
pip install -e .
If that succeeded than you can go back to the gsgen directory via
cd ..
and the scripts in the repo README should now work.
By default it'll download and install stable diffusion every time you run the code, to fix this, modify conf/guidance/sd.yaml to point to a local directory. The easiest way to do this is to run example code from here, specifically this:
from diffusers import StableDiffusionPipeline import torch model_id = "runwayml/stable-diffusion-v1-5" pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
then look in
C:\Users\<you>\.cache\huggingface\hub\models--runwayml--stable-diffusion-v1-5\snapshots\<some id>
You can copy that folder to somewhere else and modify the path in sd.yaml to point to that. You might also need to change this line.
Also, if your prompt is long I recommend setting this to true so the direction modifiers go in the front of your prompt instead of the back
Note that it'll take about 3 hours (15000 steps) to create the 3D model. While it is running you can see the results in outputs///checkpoints////eval, look in the image and video folders. How frequently it shows you progress pictures/video is in base.yaml in eval, image_period and video_period
PLEASEEEEEEEEEE!!!! I have slow computer >>>>I REALLY BEG YOU<<<< PLEASE RELEASE THE MODEL I WANNA DIE PLEASE WITHOUT MODEL I CANT DO ANYTHING I WANNA DIE WANNA DIE PLEASE RELEASE IT I CANT TRAIN MODEL ON THIS PC
These directions don't seem to work for me. To get gsgen building on my Windows 10 machine I ended up just having to add a flag to nvcc (after installing CUDA 11.8):
if os.name == "nt":
nvcc_flags.append("-DWIN32_LEAN_AND_MEAN")
As shown here: sometimesacoder@5179c22, which I learned from here: facebookresearch/pytorch3d#1614 (comment). I don't have to download and set CUB_HOME since the compilers use the one found at C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include
, and I don't need the DISTUTILS_USE_SDK, I just need the one -DWIN32_LEAN_AND_MEAN
flag. I wonder what the difference is between your environment and mine. Maybe this flag works for both of us and would be a simpler way to get things working for Windows users.
edit: to clarify, I did need to replace the const
variables with #define
, and renamed aux to auxiliary, it's just this CUB stuff I only needed the extra nvcc flag. Also I installed Microsoft Visual C++ build tools from https://visualstudio.microsoft.com/visual-cpp-build-tools/.
These directions don't seem to work for me. To get gsgen building on my Windows 10 machine I ended up just having to add a flag to nvcc (after installing CUDA 11.8):
if os.name == "nt": nvcc_flags.append("-DWIN32_LEAN_AND_MEAN")
As shown here: sometimesacoder@5179c22, which I learned from here: facebookresearch/pytorch3d#1614 (comment). I don't have to download and set CUB_HOME since the compilers use the one found at
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include
, and I don't need the DISTUTILS_USE_SDK, I just need the one-DWIN32_LEAN_AND_MEAN
flag. I wonder what the difference is between your environment and mine. Maybe this flag works for both of us and would be a simpler way to get things working for Windows users.edit: to clarify, I did need to replace the
const
variables with#define
, and renamed aux to auxiliary, it's just this CUB stuff I only needed the extra nvcc flag. Also I installed Microsoft Visual C++ build tools from https://visualstudio.microsoft.com/visual-cpp-build-tools/.
Hey very cool, that's much easier. I added that change to my repo/PR and can confirm it works for me without needing to do all that manual stuff, you can just checkout, get requirements, then pip install -e . in the gsgen/gs directory. I also modified my instructions above.
PLEASEEEEEEEEEE!!!! I have slow computer >>>>I REALLY BEG YOU<<<< PLEASE RELEASE THE MODEL I WANNA DIE PLEASE WITHOUT MODEL I CANT DO ANYTHING I WANNA DIE WANNA DIE PLEASE RELEASE IT I CANT TRAIN MODEL ON THIS PC
So, the model is released? gsgen uses stable diffusion 1.5 and point-e, both of which it'll automatically download if you don't have them installed. @spacewalkingninja
You may find this thread useful to read