k2-fsa / fast_rnnt

A torch implementation of a recursion which turns out to be useful for RNN-T.
Other
136 stars 22 forks source link

Error while installing #21

Closed Ujs113 closed 1 year ago

Ujs113 commented 1 year ago

While installing fast_rnnt, I get the following error, both while installing via pip as well as for the manual installation:

-- Found Torch: /home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/lib/libtorch.so  
-- PyTorch version: 1.13.1+cu117
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ujjwaleshwar/fast_rnnt/build/temp.linux-x86_64-cpython-310
[ 16%] Building CUDA object fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/mutual_information_cpu.cu.o
[ 33%] Building CUDA object fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/mutual_information_cuda.cu.o
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h: In function ‘typename pybind11::detail::type_caster<typename pybind11::detail::intrinsic_type<T>::type>::cast_op_type<T> pybind11::detail::cast_op(make_caster<T>&)’:
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:120: error: expected template-name before ‘<’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                        ^
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:120: error: expected identifier before ‘<’ token
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:123: error: expected primary-expression before ‘>’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                           ^
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:126: error: expected primary-expression before ‘)’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                              ^
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h: In function ‘typename pybind11::detail::type_caster<typename pybind11::detail::intrinsic_type<T>::type>::cast_op_type<T> pybind11::detail::cast_op(make_caster<T>&)’:
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:120: error: expected template-name before ‘<’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                        ^
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:120: error: expected identifier before ‘<’ token
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:123: error: expected primary-expression before ‘>’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                           ^
/home/ujjwaleshwar/Projects/py/FYP/venv/lib/python3.10/site-packages/torch/include/pybind11/cast.h:42:126: error: expected primary-expression before ‘)’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                              ^
make[3]: *** [fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/build.make:77: fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/mutual_information_cpu.cu.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/build.make:92: fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/mutual_information_cuda.cu.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:180: fast_rnnt/csrc/CMakeFiles/mutual_information_core.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:213: fast_rnnt/python/csrc/CMakeFiles/_fast_rnnt.dir/rule] Error 2
make: *** [Makefile:137: _fast_rnnt] Error 2

I am using pytorch 1.13 + cu11.7. nvcc --version returns the following:

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Feb__7_19:32:13_PST_2023
Cuda compilation tools, release 12.1, V12.1.66
Build cuda_12.1.r12.1/compiler.32415258_0

Any help is appreciated.

csukuangfj commented 1 year ago

Which version of gcc and PyTorch are you using?

Ujs113 commented 1 year ago

As I have mentioned, it is pytorch 1.13.1.

Ujs113 commented 1 year ago

For gcc it is 12. I am not currently at my system so I don't know the minor version numbers. I will update once I am on it.

Edit: It is 12.2.1

csukuangfj commented 1 year ago

I am using pytorch 1.13 + cu11.7.

Your PyTorch is compiled against cuda 11.7.

Build cuda_12.1.r12.1/compiler.32415258_0

However, your nvcc shows you are using cuda 12.1

Edit: It is 12.2.1

Is there only one GCC on your system?

Could you remove the build directory and run the installation again? It will display the actual GCC that it is using in the log.

Ujs113 commented 1 year ago

This is what it gives when running it again:

-- C++ Standard version: 14
-- Enabled languages: CXX;CUDA
-- The CXX compiler identification is GNU 12.2.1
-- The CUDA compiler identification is NVIDIA 12.1.66
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /opt/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features

However, your nvcc shows you are using cuda 12.1

Does this mean that I have to install cuda 11.7 to use this library?

Ujs113 commented 1 year ago

It works when I do it within a container using CUDA 11.7. Thanks!