Official pytorch implementation of “Mamba-YOLO:SSMs-based for Object Detection”

# pip install required packages
conda create -n mambayolo -y python=3.11
conda activate mambayolo
pip3 install torch===2.3.0 torchvision torchaudio
pip install seaborn thop timm einops
cd selective_scan && pip install . && cd ..
pip install -v -e .

执行

cd selective_scan && pip install . && cd ..

的时候报错:

    RuntimeError: Error compiling objects for extension
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for selective_scan
  Running setup.py clean for selective_scan
Failed to build selective_scan

详细报错信息:

Building wheel for selective_scan (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [250 lines of output]

  torch.__version__  = 2.3.0+cu118
  
  
  
  
  CUDA_HOME = /usr/local/cuda-11.8
  
  
  CUDA version:  11.8
  running bdist_wheel
  running build
  running build_ext
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/utils/cpp_extension.py:428: UserWarning: There are no g++ version bounds defined for CUDA version 11.8
    warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
  building 'selective_scan_cuda_core' extension
  creating /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build
  creating /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311
  creating /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc
  creating /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan
  creating /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus
  Emitting ninja build file /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/build.ninja...
  Compiling objects...
  Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
  [1/3] /usr/local/cuda-11.8/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_fwd.o.d -I/home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/TH -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/home/rjxy/anaconda3/envs/mambayolo1/include/python3.11 -c -c /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu -o /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_fwd.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 -std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_BFLOAT16_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ -U__CUDA_NO_BFLOAT162_OPERATORS__ -U__CUDA_NO_BFLOAT162_CONVERSIONS__ --expt-relaxed-constexpr --expt-extended-lambda --use_fast_math --ptxas-options=-v -lineinfo -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_90,code=sm_90 --threads 4 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=selective_scan_cuda_core -D_GLIBCXX_USE_CXX11_ABI=0
  FAILED: /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_fwd.o
  /usr/local/cuda-11.8/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_fwd.o.d -I/home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/TH -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/home/rjxy/anaconda3/envs/mambayolo1/include/python3.11 -c -c /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu -o /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_fwd.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 -std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_BFLOAT16_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ -U__CUDA_NO_BFLOAT162_OPERATORS__ -U__CUDA_NO_BFLOAT162_CONVERSIONS__ --expt-relaxed-constexpr --expt-extended-lambda --use_fast_math --ptxas-options=-v -lineinfo -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_90,code=sm_90 --threads 4 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=selective_scan_cuda_core -D_GLIBCXX_USE_CXX11_ABI=0
  nvcc warning : The -std=c++17 flag is not supported with the configured host compiler. Flag will be ignored.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_fwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                         ^
  compilation terminated.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_fwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                         ^
  compilation terminated.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_fwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                         ^
  compilation terminated.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_fwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                    ^
  compilation terminated.
  fatal   : Could not open input file /tmp/tmpxft_00006261_00000000-9_selective_scan_core_fwd.compute_70.cpp1.ii
  [2/3] /usr/local/cuda-11.8/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_bwd.o.d -I/home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/TH -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/home/rjxy/anaconda3/envs/mambayolo1/include/python3.11 -c -c /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu -o /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_bwd.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 -std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_BFLOAT16_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ -U__CUDA_NO_BFLOAT162_OPERATORS__ -U__CUDA_NO_BFLOAT162_CONVERSIONS__ --expt-relaxed-constexpr --expt-extended-lambda --use_fast_math --ptxas-options=-v -lineinfo -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_90,code=sm_90 --threads 4 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=selective_scan_cuda_core -D_GLIBCXX_USE_CXX11_ABI=0
  FAILED: /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_bwd.o
  /usr/local/cuda-11.8/bin/nvcc --generate-dependencies-with-compile --dependency-output /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_bwd.o.d -I/home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/TH -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/home/rjxy/anaconda3/envs/mambayolo1/include/python3.11 -c -c /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu -o /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan_core_bwd.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 -std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_BFLOAT16_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ -U__CUDA_NO_BFLOAT162_OPERATORS__ -U__CUDA_NO_BFLOAT162_CONVERSIONS__ --expt-relaxed-constexpr --expt-extended-lambda --use_fast_math --ptxas-options=-v -lineinfo -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_90,code=sm_90 --threads 4 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=selective_scan_cuda_core -D_GLIBCXX_USE_CXX11_ABI=0
  nvcc warning : The -std=c++17 flag is not supported with the configured host compiler. Flag will be ignored.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_bwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                         ^
  compilation terminated.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_bwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                         ^
  compilation terminated.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_bwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                         ^
  compilation terminated.
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:6,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:7,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_bwd_kernel.cuh:9,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu:4:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:12:23: fatal error: string_view: 没有那个文件或目录
   #include 
                         ^
  compilation terminated.
  fatal   : Could not open input file /tmp/tmpxft_00006260_00000000-9_selective_scan_core_bwd.compute_70.cpp1.ii
  [3/3] c++ -MMD -MF /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan.o.d -pthread -B /home/rjxy/anaconda3/envs/mambayolo1/compiler_compat -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/rjxy/anaconda3/envs/mambayolo1/include -fPIC -O2 -isystem /home/rjxy/anaconda3/envs/mambayolo1/include -fPIC -I/home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/TH -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/home/rjxy/anaconda3/envs/mambayolo1/include/python3.11 -c -c /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan.cpp -o /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan.o -O3 -std=c++17 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=selective_scan_cuda_core -D_GLIBCXX_USE_CXX11_ABI=0
  FAILED: /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan.o
  c++ -MMD -MF /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan.o.d -pthread -B /home/rjxy/anaconda3/envs/mambayolo1/compiler_compat -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/rjxy/anaconda3/envs/mambayolo1/include -fPIC -O2 -isystem /home/rjxy/anaconda3/envs/mambayolo1/include -fPIC -I/home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/TH -I/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/home/rjxy/anaconda3/envs/mambayolo1/include/python3.11 -c -c /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan.cpp -o /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/build/temp.linux-x86_64-cpython-311/csrc/selective_scan/cus/selective_scan.o -O3 -std=c++17 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=selective_scan_cuda_core -D_GLIBCXX_USE_CXX11_ABI=0
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/CallOnce.h:8,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/ATen/Context.h:21,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:6,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan.cpp:5:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/util/C++17.h:13:2: error: #error "You're trying to build PyTorch with a too old version of GCC. We need GCC 9 or later."
   #error \
    ^~~~~
  In file included from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/impl/PyInterpreter.h:4,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/impl/GPUTrace.h:3,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAFunctions.h:11,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContextLight.h:25,
                   from /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:3,
                   from /home/rjxy/fyl/Mamba-YOLO-main/selective_scan/csrc/selective_scan/cus/selective_scan.cpp:5:
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:752:73:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradCPU)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:752:73: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_cpu_ks = DispatchKeySet(DispatchKey::AutogradCPU);
                                                                           ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:753:73:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradIPU)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:753:73: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_ipu_ks = DispatchKeySet(DispatchKey::AutogradIPU);
                                                                           ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:754:73:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradXPU)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:754:73: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_xpu_ks = DispatchKeySet(DispatchKey::AutogradXPU);
                                                                           ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:755:75:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradCUDA)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:755:75: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_cuda_ks = DispatchKeySet(DispatchKey::AutogradCUDA);
                                                                             ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:756:73:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradXLA)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:756:73: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_xla_ks = DispatchKeySet(DispatchKey::AutogradXLA);
                                                                           ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:757:75:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradLazy)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:757:75: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_lazy_ks = DispatchKeySet(DispatchKey::AutogradLazy);
                                                                             ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:758:75:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradMeta)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:758:75: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_meta_ks = DispatchKeySet(DispatchKey::AutogradMeta);
                                                                             ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:759:73:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradMPS)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:759:73: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_mps_ks = DispatchKeySet(DispatchKey::AutogradMPS);
                                                                           ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:760:73:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradHPU)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:760:73: error: overflow in constant expression [-fpermissive]
   constexpr auto autograd_hpu_ks = DispatchKeySet(DispatchKey::AutogradHPU);
                                                                           ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:762:52:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradPrivateUse1)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:762:52: error: overflow in constant expression [-fpermissive]
       DispatchKeySet(DispatchKey::AutogradPrivateUse1);
                                                      ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:764:52:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradPrivateUse2)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:764:52: error: overflow in constant expression [-fpermissive]
       DispatchKeySet(DispatchKey::AutogradPrivateUse2);
                                                      ^
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:766:52:   in ‘constexpr’ expansion of ‘c10::DispatchKeySet(AutogradPrivateUse3)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:236:42:   in ‘constexpr’ expansion of ‘c10::toBackendComponent(k)’
  /home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/include/c10/core/DispatchKeySet.h:766:52: error: overflow in constant expression [-fpermissive]
       DispatchKeySet(DispatchKey::AutogradPrivateUse3);
                                                      ^
  ninja: build stopped: subcommand failed.
  Traceback (most recent call last):
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 2107, in _run_ninja_build
      subprocess.run(
    File "/home/rjxy/anaconda3/envs/mambayolo1/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 "", line 2, in 
    File "", line 34, in 
    File "/home/rjxy/fyl/Mamba-YOLO-main/selective_scan/setup.py", line 142, in 
      setup(
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 184, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
      dist.run_commands()
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 132, in run
      self.run_command(cmd_name)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 91, in run
      _build_ext.run(self)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
      self.build_extensions()
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 870, in build_extensions
      build_ext.build_extensions(self)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
      self._build_extensions_serial()
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
      self.build_extension(ext)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 252, in build_extension
      _build_ext.build_extension(self, ext)
    File "/home/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 560, in build_extension
      objects = self.compiler.compile(
                ^^^^^^^^^^^^^^^^^^^^^^
    File "/home/rjxy/anaconda3/envs/mambayolo1/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/rjxy/anaconda3/envs/mambayolo1/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1783, in _write_ninja_file_and_compile_objects
      _run_ninja_build(
    File "/home/rjxy/anaconda3/envs/mambayolo1/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
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for selective_scan
Running setup.py clean for selective_scan
Failed to build selective_scan
ERROR: Could not build wheels for selective_scan, which is required to install pyproject.toml-based projects

安装的版本信息:

torch 2.3.0+cu118
torchaudio 2.3.0+cu118
torchvision 0.18.0+cu118
cuda version=11.8

求大佬指点

你可能感兴趣的:(pytorch,YOLO,目标检测)