chu-tianxiang / llama-cpp-torch

llama.cpp to PyTorch Converter
Other
26 stars 5 forks source link

does not compile #2

Open h-lunah opened 4 months ago

h-lunah commented 4 months ago

traceback:

FAILED: /home/luna/llama-cpp-torch/build/temp.linux-x86_64-cpython-311/llamacpp_kernel.o
/opt/cuda/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/luna/llama-cpp-torch/build/temp.linux-x86_64-cpython-311/llamacpp_kernel.o.d -I/home/luna/aienv/lib/python3.11/site-packages/torch/include -I/home/luna/aienv/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/luna/aienv/lib/python3.11/site-packages/torch/include/TH -I/home/luna/aienv/lib/python3.11/site-packages/torch/include/THC -I/opt/cuda/include -I/home/luna/aienv/include -I/usr/include/python3.11 -c -c /home/luna/llama-cpp-torch/llamacpp_kernel.cu -o /home/luna/llama-cpp-torch/build/temp.linux-x86_64-cpython-311/llamacpp_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -g -Xcompiler -rdynamic -lineinfo -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=llamacpp_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++17
/home/luna/aienv/lib/python3.11/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:42:103: error: expected primary-expression before ‘>’ token
   42 | struct has_ivalue_to<T, std::void_t<decltype(std::declval<IValue>().to<T>())>>
      |                                                                                                       ^
/home/luna/aienv/lib/python3.11/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:42:106: error: expected primary-expression before ‘)’ token
   42 | struct has_ivalue_to<T, std::void_t<decltype(std::declval<IValue>().to<T>())>>
      |                                                                                                          ^
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/luna/aienv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 2107, in _run_ninja_build
    subprocess.run(
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/luna/llama-cpp-torch/setup.py", line 4, in <module>
    setup(name='llamacpp_cuda',
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
    self.run_command(cmd)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/command/install.py", line 74, in run
    self.do_egg_install()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/command/install.py", line 123, in do_egg_install
    self.run_command('bdist_egg')
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
    self.distribution.run_command(command)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/command/bdist_egg.py", line 165, in run
    cmd = self.call_command('install_lib', warn_dir=0)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/command/bdist_egg.py", line 151, in call_command
    self.run_command(cmdname)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
    self.distribution.run_command(command)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/command/install_lib.py", line 112, in build
    self.run_command('build_ext')
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
    self.distribution.run_command(command)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
    _build_ext.run(self)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
    self.build_extensions()
  File "/home/luna/aienv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 870, in build_extensions
    build_ext.build_extensions(self)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
    self._build_extensions_serial()
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/luna/aienv/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 547, in build_extension
    objects = self.compiler.compile(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/luna/aienv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 683, in unix_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "/home/luna/aienv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1783, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "/home/luna/aienv/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 2123, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
chu-tianxiang commented 4 months ago

It seems to be related to new torch version. Could you please check if the solution in the reply works?

h-lunah commented 4 months ago

It seems to be related to new torch version. Could you please check if the solution in the reply works?

I'll try compiling with CUDA 12.3.2 instead of current Arch version, sure.

CUDA 12.3.2 (Arch Linux)