Skip to content

Instantly share code, notes, and snippets.

@thepirat000
Last active January 11, 2023 05:52
Show Gist options
  • Save thepirat000/ae9c9acf0e9d98b1aa14571cf2197341 to your computer and use it in GitHub Desktop.
Save thepirat000/ae9c9acf0e9d98b1aa14571cf2197341 to your computer and use it in GitHub Desktop.
# Install sber-swap pre-requisites for Windows 10 on an Azure VM of type NC (GPU)
# NVIDIA TeslaK80 / Radeon
Set-ExecutionPolicy Bypass -Scope Process -Force;
# Install chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
refreshenv
# Install GIT
Write-Host "Installing GIT" -foregroundcolor "green";
choco install git -y --no-progress
# Install wget
Write-Host "Installing wget" -foregroundcolor "green";
remove-item alias:wget
choco install wget -y --no-progress
# Install CUDA drivers
Write-Host "Installing CUDA drivers (this can take some time)" -foregroundcolor "green";
choco install cuda --version=10.1 -y --no-progress
refreshenv
# Install newer NVidia Tesla driver (this step requires user interaction)
$file = './42.50-tesla-desktop-win10-64bit-international.exe';
Start-BitsTransfer -Source http://us.download.nvidia.com/tesla/442.50/442.50-tesla-desktop-win10-64bit-international.exe -Destination $file
& $file -y --no-progress
pause
# Configure GPU
& "C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" -fdm 0
# Install Conda
Write-Host "Installing miniconda3 (this can take some time)" -foregroundcolor "green";
choco install miniconda3 -y --no-progress
# Create conda environment
& 'C:\tools\miniconda3\shell\condabin\conda-hook.ps1';
conda activate 'C:\tools\miniconda3';
conda update -n base -c defaults conda -y
conda create -n sber python=3.7 conda -y
conda activate sber
# Clone and prepare project
mkdir C:\GIT
cd C:\GIT
git clone https://github.com/sberbank-ai/sber-swap.git
cd sber-swap
git submodule init
git submodule update
# Install sber-swap
pip install pip --upgrade
# Workaround to fix requirements.txt (remove requests lib version)
$file = 'requirements.txt'
$regex = 'requests==.*'
(Get-Content $file) -replace $regex, 'requests' | Set-Content $file
# Install dependencies
pip install -r requirements.txt
# Download models
copy download_models.sh download_models.cmd
& ./download_models.cmd
# Test
python inference.py --source_paths examples/images/elon_musk.jpg --target_faces_paths examples/images/tgt1.png --target_video examples/videos/dirtydancing.mp4
# Deactivate conda
conda deactivate
conda deactivate
Write-Host "Done..." -foregroundcolor "green";
@illtellyoulater
Copy link

illtellyoulater commented May 26, 2022

Is there a way to make it work with CUDA 11.6 ?

As it is now, when I run the inference script it will error out saying it can't load mxnet DLL.

According to stackoverflow this happens because the installed mxnet lib has a dependance on a different CUDA Toolkit version than the one installed.
This can be checked with dumpbin.exe /dependents C:\Users\my-username\.conda\envs\sber-swap\Lib\site-packages\mxnet\libmxnet.dll which will tell you the exact CUDA version that mxnet lib is expecting to find in order to work.

So yes, I could see how those two versions don't match... but I don't want to downgrade CUDA just for this single app...
I would rather prefer to make the app work with the newer CUDA toolkit version I'm using...
However at https://dist.mxnet.io/python I couldn't find a mxnet package supporting such a newer version...

Highest version I could install is mxnet_cu102 with the following command: pip install mxnet_cu102mkl -f https://dist.mxnet.io/python but then I have the same problem...

Anyone sees a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment