Open Hpjhpjhs opened 3 years ago
I haven't met this error before. Maybe you should try 'python op/rasterize.py' to find whether the operator works fine. The code in 'rasterize.py: line 10~16' should automatically compile the cpp and cu files. Maybe there are some wrong configurations in Windows system. Try to replace 'module_path' and the following paths for cpp and cu files with absolute path in your computer.
@WestlyPark Thank you for your reply. The 'module_path' may be ok like below: 'G:/stylerender/StyleRenderer/op'. But when I debug this issue, there would be a path ''C:\Users\ADMINI~1\AppData\Local\Temp\torch_extensions\rasterize' Whether this is related to CUDA and VS studio version? CUDA 10.0 and VS 2017 were used in my computer
I haven't compiled in windows system, and I use CUDA 9.0 for Linux compilation. The path 'C:\Users\ADMINI~1\AppData\Local\Temp\torch_extensions\rasterize' should be where pytorch install the built libraries and load them automatically when started. Try to compile independently with VS to build the '.dll' file and see what's wrong. You may include folder
${PYTORCH}/include : ${PYTORCH}/include/torch/csrc/api/include: ${PYTORCH}/include/TH: ${PYTORCH}/include/THC
and link libraries in '${PYTORCH}/lib' the following:
caffe2, c10, torch, torch_pytorch
when you compile the cpp and cu files and copy the output to 'C:\Users\ADMINI~1\AppData\Local\Temp\torch_extensions'
The ${PYTORCH} directory can be seen when you execute in python:
from torch.utils.cpp_extension import include_paths import os print(os.path.dirname([p for p in include_paths()][0]))')
@WestlyPark Thank you for you reply. After runing the 'op/fused_act.py', only one file 'build.ninja' appeares in fuse folder like below: """ ninja_required_version = 1.3 cxx = cl nvcc = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\nvcc
cflags = -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include\TH -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include" -IC:\Users\Administrator\anaconda3\envs\styleflow\Include -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 cuda_flags = -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include\TH -IC:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include" -IC:\Users\Administrator\anaconda3\envs\styleflow\Include -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS__ ldflags = /DLL c10.lib caffe2.lib torch.lib torch_python.lib caffe2_gpu.lib _C.lib /LIBPATH:C:\Users\Administrator\anaconda3\envs\styleflow\libs /LIBPATH:C:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib/x64" cudart.lib
rule compile command = cl /showIncludes $cflags -c $in /Fo$out deps = msvc
rule cuda_compile command = $nvcc $cuda_flags -c $in -o $out
rule link command = "C$:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64/link.exe" $in /nologo $ldflags /out:$out
build fused_bias_act.o: compile G$:\stylerender\StyleRenderer\op\fused_bias_act.cpp build fused_bias_act_kernel.cuda.o: cuda_compile G$:\stylerender\StyleRenderer\op\fused_bias_act_kernel.cu
build fused.pyd: link fused_bias_act.o fused_bias_act_kernel.cuda.o
default fused.pyd """
But there still be a error "ImportError: No module named 'fused'" Could you share with me your compiled files? Even if I may not be able to use them. Thank you
Thank you for your great work. But when I run this commond "python uitls_face.py --lmk dlib --bfm BFM.mat --output OUTPUT_PATH DATASET_PATH", I encounter some issues like below: Traceback (most recent call last): File "H:/stylerender/StyleRenderer/utils_face.py", line 522, in
from op import rasterize
File "H:\stylerender\StyleRenderer\op__init__.py", line 3, in
from .rasterize import rasterize
File "H:\stylerender\StyleRenderer\op\rasterize.py", line 15, in
os.path.join(module_path, 'rasterize.cu') \
File "C:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\utils\cpp_extension.py", line 898, in load
is_python_module)
File "C:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\utils\cpp_extension.py", line 1097, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "C:\Users\Administrator\anaconda3\envs\styleflow\lib\site-packages\torch\utils\cpp_extension.py", line 1422, in _import_module_from_library
file, path, description = imp.find_module(module_name, [path])
File "C:\Users\Administrator\anaconda3\envs\styleflow\lib\imp.py", line 302, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'rasterize'
Whether I need to complie rasterize.cpp and rasterize.cu? Or mayebe the CUDA and pytorch version are wrong?