25.01.2025, 15:10
(25.01.2025, 12:43)Selur Wrote: Since I from time to time need to update the torch-addon to support newer stuff, I need a way to get this working, ideally without you having to build it. If you could write down the instructions on how to build the correlation sample, I could do it myself whenever I need to setup a new torch-addon.
I think that is better to explain how to build Pytorch-Correlation-extension so that you are free to install any pytorch version.
----- INSTALLATION GUIDE for: Pytorch-Correlation-extension -----
To build Pytorch-Correlation-extension it is necessary to have an installation of Microsoft Visual Studio.
I installed the version 2019. This software is necessary to compile the C/C++ code.
Then is necessary to install first the NVDIA SDK
I installed NVIDIA CUDA v12.4: cuda_12.4.0_551.61_windows.exe
during the installation select advanced options and check only CUDA (see picture)
Then is necessary to install cuDNN, I installed the version v.8.9.7.29: cudnn-windows-x86_64-8.9.7.29_cuda12-archive.zip
This is a zip archive that need to be extracted in the same folder of CUDA SDK.
The directories to extract are: lib, include and bin.
For example in my PC I extracted the cudnn directories above in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4.
in this way all the cudnn dlls are stored in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin.
After the installation you should end-up having the following environment variables defined:
CUDA_MODULE_LOADING=LAZY
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4
CUDA_PATH_V12_4=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4
TORCH_CUDA_ARCH_LIST=8.6
If not you have to define them.
Then is necessary create a working folder, for example: colormnet
Next is necessary to create an environment.
I'm using conda, so the commands are the following:
conda create -n colormnet python=3.12
conda activate colormnet
cd colormnet
# you can install the desidered version by changing the command below
conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia
# install Pytorch-Correlation-extension
git clone https://github.com/ClementPinard/Pytorch-Correlation-extension.git
cd Pytorch-Correlation-extension
python setup.py install
This will produce under the directory dist a egg file, like
spatial_correlation_sampler-0.5.0-py3.12-win-amd64.egg
This file have to be converted in wheel with the command (the script wheel to be installed with conda/pip)
wheel convert spatial_correlation_sampler-0.5.0-py3.12-win-amd64.egg
then is necessary to rename the generated file:
spatial_correlation_sampler-0.5.0-py3.12-win-amd64.whl
in: spatial_correlation_sampler-0.5.0-py3.12-win-amd64.whl.zip
so that is possible to open the zip archive.
The files need to be extracted in the directory (no way to install it with pip)
.\Hybrid\64bit\Vapoursynth\Lib\site-packages
Good luck!
Dan
P.S.
Please let me know if this procedure is working on your side.