Open luoww1992 opened 1 year ago
now it is sucessful in win10. Thanks for his help: @vitacon
step1: install VS2022 buildtools. https://aka.ms/vs/17/release/vs_BuildTools.exe download it and i choose to install these:
Don't forget add the cl.exe into %PATH% my path is C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\Hostx64\x64 step2: install cuda11.7.1 and cudnn8.5.0 in real main env (the step is to install nvcc)
step3: create conda env conda create --name vtoon_env python=3.9 conda activate vtoon_env conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia -c conda-forge conda install libfaiss=1.7.1 -c conda-forge conda install _libgcc_mutex=0.1 ca-certificates=2022.2.1 certifi=2021.10.8 conda install faiss=1.7.1 m2-libedit libfaiss-avx2=1.7.1 -c conda-forge conda install libffi=3.2.1 -c conda-forge conda install matplotlib-base=3.3.4 conda install python-lmdb=1.2.1 conda install setuptools conda install pip conda install pillow
pip install cmake matplotlib ninja numpy opencv-python==4.5.3.56 scipy tqdm wget conda install dlib=19.21
step4: after activate conda env cd the project path and run python style_transfer.py --scale_image
Wow, I will add a link to this solution in README to help other win users :)
I followed these steps to make the installation successfully,but there was an error when the program ran。
File "E:\code\github\AI\VToonify\style_transfer.py", line 11, in <module> from model.vtoonify import VToonify File "E:\code\github\AI\VToonify\model\vtoonify.py", line 5, in <module> from model.stylegan.model import ConvLayer, EqualLinear, Generator, ResBlock File "E:\code\github\AI\VToonify\model\stylegan\model.py", line 11, in <module> from model.stylegan.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix File "E:\code\github\AI\VToonify\model\stylegan\op\__init__.py", line 1, in <module> from .fused_act import FusedLeakyReLU, fused_leaky_relu File "E:\code\github\AI\VToonify\model\stylegan\op\fused_act.py", line 11, in <module> fused = load( File "C:\Users\xx\.conda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load return _jit_compile( File "C:\Users\xx\.conda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1508, in _jit_compile _write_ninja_file_and_build_library( File "C:\Users\xx\.conda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1623, in _write_ninja_file_and_build_library _run_ninja_build( File "C:\Users\xx\.conda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1915, in _run_ninja_build message += f": {error.output.decode(*SUBPROCESS_DECODE_ARGS)}" # type: ignore[union-attr] File "C:\Users\xx\.conda\envs\vtoon_env\lib\encodings\oem.py", line 15, in decode return oem_decode(input, errors, True) UnicodeDecodeError: 'cp1' codec can't decode bytes in position 0--1: No mapping for the Unicode character exists in the target code page.
My environment is:win10,cuda11.8. cudnn8.7.0 ;
No mapping for the Unicode character exists in the target code page.
Maybe some non-ANSI characters in path?
your env with conda install xxx is compatible with the cuda version in real env?
I know the reason now。Because my CMD window is utf-8 encoding,After modified to GBK, is ok。Thanks!
D:\anaconda\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2]
系统找不到指定的文件。
warnings.warn(f'Error checking compiler version for {compiler}: {error}')
信息: 用提供的模式无法找到文件。
Traceback (most recent call last):
File "finetune_stylegan.py", line 14, in
@qinmingyu134, have you added the cl.exe into %PATH% ?
Yes, I added the cl.exe into %PATH%.
(vtoon_env) E:\VToonify-main\VToonify-main>python style_transfer.py --scale_image Load options backbone: dualstylegan batch_size: 4 ckpt: ./checkpoint/vtoonify_d_cartoon/vtoonify_s_d.pt color_transfer: False content: ./data/077436.jpg cpu: False exstyle_path: ./checkpoint/vtoonify_d_cartoon\exstyle_code.npy faceparsing_path: ./checkpoint/faceparsing.pth output_path: ./output/ padding: [200, 200, 200, 200] parsing_map_path: None scale_image: True style_degree: 0.5 style_encoder_path: ./checkpoint/encoder.pt style_id: 26 video: False
Traceback (most recent call last):
File "E:\VToonify-main\VToonify-main\style_transfer.py", line 63, in
maybe i forget to download training modals
For help, I also followed the instructions, but what is the problem with reporting this error?
(vtoon_env) I:\pycharm_project\VToonify>python style_transfer.py --scale_image
e:\anaconda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py(120)_find_cuda_home() -> if cuda_home and not torch.cuda.is_available(): (Pdb) c No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7' Traceback (most recent call last): File "I:\pycharm_project\VToonify\style_transfer.py", line 11, in
from model.vtoonify import VToonify File "I:\pycharm_project\VToonify\model\vtoonify.py", line 5, in from model.stylegan.model import ConvLayer, EqualLinear, Generator, ResBlock File "I:\pycharm_project\VToonify\model\stylegan\model.py", line 11, in from model.stylegan.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix File "I:\pycharm_project\VToonify\model\stylegan\op__init__.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "I:\pycharm_project\VToonify\model\stylegan\op\fused_act.py", line 11, in fused = load( File "E:\Anaconda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1310, in load return _jit_compile( File "E:\Anaconda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1712, in _jit_compile _write_ninja_file_and_build_library( File "E:\Anaconda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1812, in _write_ninja_file_and_build_library _write_ninja_file_to_build_library( File "E:\Anaconda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 2201, in _write_ninja_file_to_build_library cuda_flags = common_cflags + COMMON_NVCC_FLAGS + _get_cuda_arch_flags() File "E:\Anaconda\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1982, in _get_cuda_arch_flags arch_list[-1] += '+PTX' IndexError: list index out of range
How to handle this issue,”Traceback (most recent call last):
File "C:\Users\23267\Desktop\grop\VToonify-main\style_transfer.py", line 11, in
@liuhongs If you have a problem regarding the cpp extention (fused and upfirdn2d), please refer to https://github.com/williamyang1991/VToonify/tree/main/model/stylegan/op_cpu#readme
Received following error after following the instructions from this youtube video - Vtoonify who nicely followed these instructions and got it working 6 months before.
File "C:\Users\V\miniconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1306, in load return _jit_compile( File "C:\Users\V\miniconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile _write_ninja_file_and_build_library( File "C:\Users\V\miniconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1800, in _write_ninja_file_and_build_library extra_ldflags = _prepare_ldflags( File "C:\Users\V\miniconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1887, in _prepare_ldflags extra_ldflags.append(f'/LIBPATH:{_join_cuda_home("lib", "x64")}') File "C:\Users\V\miniconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 2407, in _join_cuda_home raise OSError('CUDA_HOME environment variable is not set. ' OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
After some research installed the pytorch archived version from this pytorch page
For me v2.0.1 worked
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia
After this I also had to download this resnet file manually and copy it to my .cache folder because it seemed to forcibly stop the download for some reason.
https://download.pytorch.org/models/resnet18-5c106cde.pth
C:\Users\$USER_NAME\.cache\torch\hub\checkpoints\
Two issues when installing on windows 10:
" 报错:ImportError: DLL load failed while importing _imaging: 找不到指定的模块" resolved by downgrade pillow to version 8.0.0
"OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root."
although, I have hte CUDA_HOME enviroment variable as below: CUDA_HOME C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4
could not figure out why
although, I have hte CUDA_HOME enviroment variable as below: CUDA_HOME C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4
That's rather strange syntax. What about some quotes?
set CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4"
some one share the steps for installing to win ?