-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: No module named 'fused' #35
Comments
Are you working on linux? Have you tried running the code using the provided conda environment? |
Yes, I am working in Linux and I am using the provided conda environment. |
Weird. I have |
I am using Jupyter Notebook present in the notebooks folder ("inference_playground") and I am getting that error on this import line from models.psp import pSp |
I am not sure what was wrong but now I am not having this error instead I am having an error on this line and error is mentioned below: Code Line: os.path.join(module_path, 'fused_bias_act_kernel.cu') Error: ninja: build stopped: subcommand failed. |
Hmmm. I just ran the notebook in Colab and it worked fine. Ninja can be a pain and there are no really good references to how to fix them. Any chance you can send me the full stack trace? Maybe there is something that can help us there. |
@yuval-alaluf here is the the full stack trace. CalledProcessError Traceback (most recent call last) ~/anaconda3/envs/newEnv/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs) CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: RuntimeError Traceback (most recent call last) /SAM/notebooks/SAM/notebooks/SAM/models/psp.py in /SAM/notebooks/SAM/notebooks/SAM/models/encoders/psp_encoders.py in /SAM/notebooks/SAM/notebooks/SAM/models/stylegan2/model.py in /SAM/notebooks/SAM/notebooks/SAM/models/stylegan2/op/init.py in /SAM/notebooks/SAM/notebooks/SAM/models/stylegan2/op/fused_act.py in ~/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/utils/cpp_extension.py in load(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module) ~/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _jit_compile(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module) ~/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _write_ninja_file_and_build(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda) ~/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _build_extension_module(name, build_directory, verbose) RuntimeError: Error building extension 'fused': [1/3] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /root/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/include -isystem /root/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /root/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/include/TH -isystem /root/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/include/THC -isystem /root/anaconda3/envs/newEnv/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' -std=c++11 -c /SAM/notebooks/SAM/notebooks/SAM/models/stylegan2/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o |
Seems like we're getting somewhere. I noticed the following line: |
I found some other issues that may be of help: |
This is a fresh system and this is first github repo I ran on this machine so can't say for sure about that. |
Thanks @yuval-alaluf , let me have a look at these links and I will update you. |
Cool. In order to isolate the issues with ninja and your machine, I would try to make sure you're able to get |
I tested torch with cuda and it is working fine.
|
Can you please check what version of |
Here is output that I get by running nvcc: NVIDIA (R) Cuda compiler driver |
Yea. I see your problem. It appears that you have multiple CUDA versions instead. If you notice, the result of running
Take a look at the first link here, which will take you to the steps you need for correctly setting your environment to use CUDA 11.1. Just note that in the example there, they use |
Thanks @yuval-alaluf , I have tried these steps to set the Cuda 11.2 in the source file but after setting it up, still it isn't working and giving me the same error. |
@yuval-alaluf I have changed Cuda to 11.2 and luckily I am not getting that error but now I am getting an error on this line, Code: Error: ValueError: invalid literal for int() with base 8: 'ightq\x04ct' During handling of the above exception, another exception occurred: InvalidHeaderError Traceback (most recent call last) ~/anaconda3/envs/newEnv/lib/python3.6/tarfile.py in fromtarfile(cls, tarfile) ~/anaconda3/envs/newEnv/lib/python3.6/tarfile.py in frombuf(cls, buf, encoding, errors) ~/anaconda3/envs/newEnv/lib/python3.6/tarfile.py in nti(s) InvalidHeaderError: invalid header During handling of the above exception, another exception occurred: ReadError Traceback (most recent call last) ~/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/serialization.py in legacy_load(f) ~/anaconda3/envs/newEnv/lib/python3.6/tarfile.py in open(cls, name, mode, fileobj, bufsize, **kwargs) ~/anaconda3/envs/newEnv/lib/python3.6/tarfile.py in taropen(cls, name, mode, fileobj, **kwargs) ~/anaconda3/envs/newEnv/lib/python3.6/tarfile.py in init(self, name, mode, fileobj, format, tarinfo, dereference, ignore_zeros, encoding, errors, pax_headers, debug, errorlevel, copybufsize) ~/anaconda3/envs/newEnv/lib/python3.6/tarfile.py in next(self) ReadError: invalid header During handling of the above exception, another exception occurred: RuntimeError Traceback (most recent call last) ~/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args) ~/anaconda3/envs/newEnv/lib/python3.6/site-packages/torch/serialization.py in _load(f, map_location, pickle_module, **pickle_load_args) RuntimeError: ../pretrained_models/sam_ffhq_aging.pt is a zip archive (did you mean to use torch.jit.load()?)` |
I think, this is because of Pytorch version. |
What torch version are you using? |
I am using this torch version |
Ah. You need to update your torch version to at least |
Yes, I am doing that, I will update you as soon as I get it done. Thanks for your time, much appreciated. |
@yuval-alaluf Thanks for your time, first it was problem-related to Cuda and then the Pytorch version played an important role in giving errors. Now after Cuda setting to 11.3 and Pytorch to 1.9 it is working fine. Cheers |
Hi, I am trying to setup this repo on my own local machine but I am getting this error. I searched on internet but couldn't find a single solution of this. Any help will be appreciated. Thanks
ImportError: No module named 'fused'
The text was updated successfully, but these errors were encountered: