Tangshitao / QuadTreeAttention

QuadTree Attention for Vision Transformers (ICLR2022)
340 stars 34 forks source link

Install Problem #13

Open lee-vius opened 2 years ago

lee-vius commented 2 years ago

Hi! Appreciated for your work.

Could you provide the environment required to install quadtreeattention module?

I came up with compile errors on both linux and windows system. I have different conda environments including torch1.10 and torch 1.8 (cu11.1), but all envs met different compile problems. Not sure what's the reason.

Tangshitao commented 2 years ago

Can you post the error messages? Usually the problem is caused by cuda and pytorch version mismatch. The codes can be compiled under both cuda 10 or cuda 11. Please make sure use the pytorch version is matched cuda version.

lee-vius commented 2 years ago

Hi, thanks for repy.

I checked the environment following your idea. I found on my Linux machine, I used torch1.10+cu11.1 while the CUDA version is 11.2. I will reinstall torch and try again to see whether it works.

For the windows system, I finally successfully installed the module. First, just like Tang said, we need to check consistency of CUDA and torch version. Second, for anyone using windows and met the problem: error LNK2001: 无法解析的外部符号 "public: long * __cdecl at::Tensor::data<long>(void)const, I recommand you following the guide given by the link: error LNK2001. To summarize, the problem is caused by the "long" type in the source code. "long" is interpreted as "long long"(64bit) on Linux while translated as "int"(32 bit) on Windows system. It is cross-platform problem. Just change every "long" in the code (.cpp .h .cu) to "long long" or "int64_t" should solve the problem for windows system.

Coronal-Halo commented 1 year ago

Hi, my torch version is 2.0.1 and my CUDA is 11.8.0, which are consistent, and I also changed the "long" type to "int64_t", but I am still getting errors on Windows:

ninja: build stopped: subcommand failed. Traceback (most recent call last): File "C:\ProgramData\anaconda3\envs\deeplearning\lib\site-packages\torch\utils\cpp_extension.py", line 1894, in _run_ninja_build subprocess.run( File "C:\ProgramData\anaconda3\envs\deeplearning\lib\subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

Traceback (most recent call last): ...... RuntimeError: Error compiling objects for extension

Do you know how to solve these?