OpenGVLab / OmniQuant

[ICLR2024 spotlight] OmniQuant is a simple and powerful quantization technique for LLMs.
MIT License
663 stars 50 forks source link

Failed to compile AutoGPTQ-bugfix #23

Closed caseylai closed 4 months ago

caseylai commented 11 months ago

Error occurs when running pip install -v . in AutoGPTQ-bugfix, could someone help?

…… running build_ext building 'autogptq_cuda_64' extension creating /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10 creating /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/autogptq_extension creating /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/autogptq_extension/cuda_64 Emitting ninja build file /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] g++ -MMD -MF /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/autogptq_extension/cuda_64/autogptq_cuda_64.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.10/dist-packages/torch/include -I/usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.10/dist-packages/torch/include/TH -I/usr/local/lib/python3.10/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/OmniQuants/AutoGPTQ-bugfix/autogptq_cuda -I/usr/include/python3.10 -c -c /OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_64.cpp -o /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/autogptq_extension/cuda_64/autogptq_cuda_64.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1016"' -DTORCH_EXTENSION_NAME=autogptq_cuda_64 -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++17 [2/2] /usr/local/cuda/bin/nvcc -I/usr/local/lib/python3.10/dist-packages/torch/include -I/usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.10/dist-packages/torch/include/TH -I/usr/local/lib/python3.10/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/OmniQuants/AutoGPTQ-bugfix/autogptq_cuda -I/usr/include/python3.10 -c -c /OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu -o /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1016"' -DTORCH_EXTENSION_NAME=autogptq_cuda_64 -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_72,code=sm_72 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_87,code=sm_87 -gencode=arch=compute_90,code=compute_90 -gencode=arch=compute_90,code=sm_90 -ccbin g++ -std=c++17 FAILED: /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.o /usr/local/cuda/bin/nvcc -I/usr/local/lib/python3.10/dist-packages/torch/include -I/usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.10/dist-packages/torch/include/TH -I/usr/local/lib/python3.10/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/OmniQuants/AutoGPTQ-bugfix/autogptq_cuda -I/usr/include/python3.10 -c -c /OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu -o /OmniQuants/AutoGPTQ-bugfix/build/temp.linux-x86_64-3.10/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1016"' -DTORCH_EXTENSION_NAME=autogptq_cuda_64 -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_72,code=sm_72 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_87,code=sm_87 -gencode=arch=compute_90,code=compute_90 -gencode=arch=compute_90,code=sm_90 -ccbin g++ -std=c++17 /OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(1167): error: identifier "hfma2" is undefined res2 = hfma2(__hfma2(deq2[(tmp >> 0) & 0xf][off], scale, zero), blockvec[k + 0], res2); ^

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(1167): error: identifier "hfma2" is undefined res2 = hfma2(__hfma2(deq2[(tmp >> 0) & 0xf][off], scale, zero), blockvec[k + 0], res2); ^

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(1301): error: identifier "hfma2" is undefined res2 = hfma2(__hfma2(deq2[(tmp1 >> 0) & 0x3f][off], scale, zero), blockvec[k + 0], res2); ^

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(1301): error: identifier "hfma2" is undefined res2 = hfma2(__hfma2(deq2[(tmp1 >> 0) & 0x3f][off], scale, zero), blockvec[k + 0], res2); ^

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(1419): error: identifier "hfma2" is undefined res2 = hfma2(__hfma2(deq2[(tmp >> 0) & 0xff][off], scale, zero), blockvec[k + 0], res2); ^

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(1419): error: identifier "hfma2" is undefined res2 = hfma2(__hfma2(deq2[(tmp >> 0) & 0xff][off], scale, zero), blockvec[k + 0], res2); ^

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(332): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant2MatMulKernel(const scalar_t , const int , scalar_t , const scalar_t , const int , const int , int, int, int, int, int) [with scalar_t=double]" at line 270

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(477): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant3MatMulKernel(const scalar_t , const int , scalar_t , const scalar_t , const int , const int , int, int, int, int, int) [with scalar_t=double]" at line 357

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(565): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant4MatMulKernel(const scalar_t , const int , scalar_t , const scalar_t , const int , const int , int, int, int, int, int) [with scalar_t=double]" at line 502

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(652): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant8MatMulKernel(const scalar_t , const int , scalar_t , const scalar_t , const int , const int , int, int, int, int, int) [with scalar_t=double]" at line 590

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(750): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant2MatMulKernel_old(const scalar_t , const int , scalar_t , const scalar_t , const int *, int, int, int, int, int, int) [with scalar_t=double]" at line 679

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(909): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant3MatMulKernel_old(const scalar_t , const int , scalar_t , const scalar_t , const int *, int, int, int, int, int, int) [with scalar_t=double]" at line 774

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(996): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant4MatMulKernel_old(const scalar_t , const int , scalar_t , const scalar_t , const int *, int, int, int, int, int, int) [with scalar_t=double]" at line 933

/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu(1079): error: no instance of overloaded function "atomicAdd" matches the argument list argument types are: (double , double) atomicAdd(&mul[b width + w], res); ^ detected during instantiation of "void VecQuant8MatMulKernel_old(const scalar_t , const int , scalar_t , const scalar_t , const int *, int, int, int, int, int, int) [with scalar_t=double]" at line 1020

14 errors detected in the compilation of "/OmniQuants/AutoGPTQ-bugfix/autogptq_extension/cuda_64/autogptq_cuda_kernel_64.cu". ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1917, in _run_ninja_build subprocess.run( File "/usr/lib/python3.10/subprocess.py", line 526, 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 "", line 2, in File "", line 34, in File "/OmniQuants/AutoGPTQ-bugfix/setup.py", line 167, in setup( File "/usr/local/lib/python3.10/dist-packages/setuptools/init.py", line 103, in setup return distutils.core.setup(**attrs) File "/usr/lib/python3.10/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 989, in run_command super().run_command(command) File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.10/dist-packages/wheel/bdist_wheel.py", line 364, in run self.run_command("build") File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 989, in run_command super().run_command(command) File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 989, in run_command super().run_command(command) File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.10/dist-packages/setuptools/command/build_ext.py", line 88, in run _build_ext.run(self) File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 865, in build_extensions build_ext.build_extensions(self) File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "/usr/local/lib/python3.10/dist-packages/setuptools/command/build_ext.py", line 249, in build_extension _build_ext.build_extension(self, ext) File "/usr/local/lib/python3.10/dist-packages/Cython/Distutils/build_ext.py", line 127, in build_extension super(build_ext, self).build_extension(ext) File "/usr/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension objects = self.compiler.compile(sources, File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 678, in unix_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1590, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1933, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. full command: /usr/bin/python -u -c ' exec(compile('"'"''"'"''"'"'

This is -- a caller that pip uses to run setup.py

#

- It imports setuptools before invoking setup.py, to enable projects that directly

import from distutils.core to work with newer packaging standards.

- It provides a clear error message when setuptools is not installed.

- It sets sys.argv[0] to the underlying setup.py, when invoking setup.py so

setuptools doesn'"'"'t think the script is -c. This avoids the following warning:

manifest_maker: standard file '"'"'-c'"'"' not found".

- It generates a shim setup.py, for handling setup.cfg-only projects.

import os, sys, tokenize

try: import setuptools except ImportError as error: print( "ERROR: Can not execute setup.py since setuptools is not available in " "the build environment.", file=sys.stderr, ) sys.exit(1)

file = %r sys.argv[0] = file

if os.path.exists(file): filename = file with tokenize.open(file) as f: setup_py_code = f.read() else: filename = "" setup_py_code = "from setuptools import setup; setup()"

exec(compile(setup_py_code, filename, "exec")) '"'"''"'"''"'"' % ('"'"'/OmniQuants/AutoGPTQ-bugfix/setup.py'"'"',), "", "exec"))' bdist_wheel -d /tmp/pip-wheel-4jtubafy cwd: /OmniQuants/AutoGPTQ-bugfix/ Building wheel for auto-gptq (setup.py) ... error ERROR: Failed building wheel for auto-gptq


Build Env is in docker nvcr.io/nvidia/pytorch:23.09-py3 NVIDIA-SMI 515.105.01 Driver Version: 515.105.01 CUDA Version: 12.2

lqzzy commented 5 months ago

You just need to run pip install -v . in the folder of OmniQuant. You should not cd into the folder of AutoGPTQ-bugfix.