StyleFlow
StyleFlow copied to clipboard
Can not run it on Windows 10
I have tried to run this for almost 5 hours.I am about to give up.Any help on this?
(styleflow) C:\StyleFlow>python main.py
----------------- Options ---------------
batchSize: 1
checkpoints_dir: ./checkpoints
dataroot: ./data/datasetX
gpu_ids: 0
max_result_snapshots: 30
model: xxxx
name: XXXX
network_pkl: gdrive:networks/stylegan2-ffhq-config-f.pkl
only_for_test: ...
phase: test
----------------- End -------------------
Loading networks from "gdrive:networks/stylegan2-ffhq-config-f.pkl"...
Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Failed!
Traceback (most recent call last):
File "main.py", line 365, in
try my PR repo: https://github.com/justinjohn0306/StyleFlow-Windows-10
Hi, I'd like to share my experience for making it work (at least the UI launch so far) on Windows 10. @justinjohn0306 repo helped me as I used 2 of his file for this.
So if i remember (sorry didn't write my step, I tell from head)
-
You need anaconda for windows : https://www.anaconda.com/products/individual
-
Launch Anaconda PowerShell Prompt (a shortcut is create when installing, if you don't find it, here is mine for example
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'E:\IA\anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'E:\IA\anaconda3' "
, with E:\IA\ is where I installed Anaconda on step 1) ) -
from anaconda prompt (you should see something like
(base) PS C:\Users\[your_username]>
) type : cd [wherever you clone styleflow git] You should see something like :(base) PS [whereever you clone styleflow git]
(for me for example :(base) PS E:\IA\StyleFlow>
) -
before running
conda create env
, you have to get 2 files from @justinjohn0306 repo : https://github.com/justinjohn0306/StyleFlow-Windows-10/blob/master/env_windows.yml and https://github.com/justinjohn0306/StyleFlow-Windows-10/blob/master/dnnlib/tflib/custom_ops.py and copy paste them on you StyleFlow git clone (replace custom_ops.py with new, you can make a bakeup if you want) -
I had other issue myself involving modifing this 2 files even more :
-
a) For env_windows.yml I had to add this under pip dependency :
- brotli==1.0.9
- bis) and change this file too :
[wherever you installed anaconda]\anaconda3\Lib\site-packages\pip\_vendor\urllib3\response.py
Comment line 389 + 390 :# if brotli is not None: #DECODER_ERROR_CLASSES += (brotli.error,)
- bis) and change this file too :
-
b) For custom_ops.py, as I have a non-ascii username, I ended up adding this workaround in the script : https://stackoverflow.com/questions/67954898/how-to-get-temp-directory-in-python-with-a-non-ascii-windows-username (adding the _getutempdir() in the script, and call it on begin of
get_plugin(cuda_file)
function :tempdir = _getutempdir()
. Then inside this function below, there are 2 time you can seewith tempfile.TemporaryDirectory() as tmp_dir:
(line 126 and 162 on @justinjohn0306 script version). You just have to replace after tmp_dir with my "non-ascii" tempdir version :tmp_dir = tempdir
-
c) I manage to get my VS 2019 compiler to work by modifying custom_ops.py again (may need some clean up, didn't test yet a cleanup version) :
compiler_bindir_search_path = [ 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64', r'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\Hostx64\x64', 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64', 'C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin', ]
on line 31. Especially pay attention that the version number under[...]/Tools/MSVC/14.XX.YYYYY/bin/Hostx64/x64
math the one YOU have on your computer (just check via windows explorer the correponding MSVC folder). -
d) As I ended up with another error with universal C runtime ( missing corecrt.h, for Qt ui I guess), I have to lauch Visual Studio Installer, choose
Modify
and add : [Individual Component]- Windows Universal C Runtime
- Windows 10 SDK Kit
- Windows Universal CRT SDK
- MSVC v142 - VS 2019 C++ x64/x86 Build Tools
-
Now you can get back to you conda PS prompt and type
conda env create -f env_windows.yml
-
when finished swith to the new env create :
conda activate styleflow
- bis) if ever you still have brotli error (now or after when execution main.py script I'm not sure), modify by commenting like above this 2 lines on
[wherever you installed anaconda]\anaconda3\envs\styleflow\lib\site-packages\pip\_vendor\urllib3\response.py
Comment line 376 + 377 :# if brotli is not None: #DECODER_ERROR_CLASSES += (brotli.error,)
Or any other response.py
file that the prompt will yell at you.
-
Now like @justinjohn0306 explain on his repo type
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
-
Finally run
python main.py
Sorry for this out of my head, and not a precise guide, but I hope it may help some of you after having myself stuck on this last days.
내 PR 리포지토리 시도: https://github.com/justinjohn0306/StyleFlow-Windows-10
I took a good look at your repo. However, I do not understand the docker part while following the installation. It would be of great help if you explain how to install nvidia-docker2 on Windows. Thank you.
“Installation (Docker)” is another way of installation??? or it is necessary.