zsyzzsoft / co-mod-gan

[ICLR 2021, Spotlight] Large Scale Image Completion via Co-Modulated Generative Adversarial Networks
Other
445 stars 67 forks source link

Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Failed! #34

Open guomingjin opened 3 years ago

guomingjin commented 3 years ago

Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Failed! Traceback (most recent call last): File "run_generator.py", line 34, in main() File "run_generator.py", line 31, in main create_from_images(*vars(args)) File "run_generator.py", line 14, in create_fromimages , _, Gs = misc.load_pkl(checkpoint) File "D:\Project\Inpainting\co-mod-gan\training\misc.py", line 30, in load_pkl return pickle.load(file, encoding='latin1') File "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\network.py", line 297, in setstate self._init_graph() File "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\network.py", line 154, in _init_graph out_expr = self._build_func(self.input_templates, **build_kwargs) File "", line 391, in G_synthesis_RegionGAN File "", line 350, in E_fromrgb File "", line 68, in apply_bias_act File "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\ops\fused_bias_act.py", line 68, in fused_bias_act return impl_dict[impl](x=x, b=b, axis=axis, act=act, alpha=alpha, gain=gain) File "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\ops\fused_bias_act.py", line 122, in _fused_bias_act_cuda cuda_kernel = _get_plugin().fused_bias_act File "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\ops\fused_bias_act.py", line 16, in _get_plugin return custom_ops.get_plugin(os.path.splitext(file)[0] + '.cu') File "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\custom_ops.py", line 112, in get_plugin _run_cmd(_prepare_nvcc_cli('"%s" --preprocess -o "%s" --keep --keep-dir "%s"' % (cuda_file, tmp_file, tmp_dir))) File "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\custom_ops.py", line 61, in _run_cmd raise RuntimeError('NVCC returned an error. See below for full command line and output log:\n\n%s\n\n%s' % (cmd, output)) RuntimeError: NVCC returned an error. See below for full command line and output log:

nvcc "D:\Project\Inpainting\co-mod-gan\dnnlib\tflib\ops\fused_bias_act.cu" --preprocess -o "C:\Users\ADMINI~1\AppData\Local\Temp\tmpp_f9al3w\fused_bias_act_tmp.cu" --keep --keep-dir "C:\Users\ADMINI~1\AppData\Local\Temp\tmpp_f9al3w" -- disable-warnings --include-path "C:\Program Files\tensorflow\include" --include-path "C:\Program Files\tensorflow\include\external\protobuf_archive\src" --include-path "C:\Program Files\tensorflow\include\external\com_google_absl" --in clude-path "C:\Program Files\tensorflow\include\external\eigen_archive" --compiler-bindir "C:/Program Files (x86)/Microsoft Visual Studio 14.0/vc/bin" 2>&1

fused_bias_act.cu D:/Project/Inpainting/co-mod-gan/dnnlib/tflib/ops/fused_bias_act.cu(9): fatal error C1083: Cannot open include file: 'tensorflow/core/framework/op.h': No such file or directory

I installed tensorflow-gpu 1.14 on windows pc, please help me with that

zsyzzsoft commented 3 years ago

Better use Ubuntu. Or you can find your tensorflow include path and manually add the path to the build options.

guomingjin commented 3 years ago

@zsyzzsoft I am really sorry I couldn't understand it. In what build options should I add the path? You meant I have to build tensorflow from source or just add the path to somewhere?

zsyzzsoft commented 3 years ago

Can you find the folder where 'tensorflow/core/framework/op.h' is located?

guomingjin commented 3 years ago

No, there are no headers in 'tensorflow/core/framework' directory in site-packages folder.

bananajoe182 commented 3 years ago

If you installed tensorflow in a conda env you need to copy this folder:

C:\Users\USERNAME\anaconda3\envs\comod\Lib\site-packages\tensorflow

to

C:\Program Files.

That worked for me. Also using tensorflow-gpu.1.14 makes using GPU easy. Good Luck!

STLBOX commented 2 years ago

anyone solve this problem?

abysslover commented 2 years ago

@MoZhengyang If the above mentioned solution does not work, the problem could be caused by the GCC compilation option while generating the so library. The GCC version of greater than 4 supports the c++11 standard itself, so the option -D_GLIBCXX_USE_CXX11_ABI = 0 is not required.

Change the line 127 code in ./dnnlib/tflib/custom_op.py.

from: - -compiler-options '-fPIC -D_GLIBCXX_USE_CXX11_ABI=0 to: --compiler-options '-fPIC -D_GLIBCXX_USE_CXX11_ABI=1

manhnguyen92 commented 1 year ago

is there any new update? same on macOS

manhnguyen92 commented 1 year ago

can I disable CUDA to run on Mac OS ?