lbcb-sci / RiNALMo

RiboNucleic Acid (RNA) Language Model
https://sikic-lab.github.io/
Apache License 2.0
57 stars 9 forks source link

error when running small inference code: "list_to_cuuint64_array" #3

Closed WeiminWu2000 closed 4 months ago

WeiminWu2000 commented 6 months ago

/tmp/tmp5oe3edsd/main.c: In function ‘list_to_cuuint64_array’: /tmp/tmp5oe3edsd/main.c:354:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (Py_ssize_t i = 0; i < len; i++) { ^ /tmp/tmp5oe3edsd/main.c:354:3: note: use option -std=c99 or -std=gnu99 to compile your code /tmp/tmp5oe3edsd/main.c: In function ‘list_to_cuuint32_array’: /tmp/tmp5oe3edsd/main.c:365:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (Py_ssize_t i = 0; i < len; i++) { ^ Traceback (most recent call last): File "/projects/p32327/RNAFOLD/RiNALMo-main/try.py", line 13, in outputs = model(tokens) ^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/projects/p32327/RNAFOLD/RiNALMo-main/rinalmo/model/model.py", line 26, in forward representation, attn_weights = self.transformer( ^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/projects/p32327/RNAFOLD/RiNALMo-main/rinalmo/model/modules.py", line 58, in forward x, attn = checkpoint.checkpoint( ^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/_compile.py", line 24, in inner return torch._dynamo.disable(fn, recursive)(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/_dynamo/eval_frame.py", line 489, in _fn return fn(args, kwargs) ^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/_dynamo/external_utils.py", line 17, in inner return fn(*args, kwargs) ^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/utils/checkpoint.py", line 489, in checkpoint ret = function(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/projects/p32327/RNAFOLD/RiNALMo-main/rinalmo/model/modules.py", line 125, in forward mh_out, attn = self.mh_attn(x, key_padding_mask=key_padding_mask, return_attn_probs=need_attn_weights) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/projects/p32327/RNAFOLD/RiNALMo-main/rinalmo/model/attention.py", line 193, in forward qkv = self.rotary_emb(qkv, seqlen_offset=0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/flash_attn/layers/rotary.py", line 438, in forward return apply_rotary_embqkv( ^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/flash_attn/layers/rotary.py", line 233, in apply_rotary_embqkv return ApplyRotaryEmbQKV_.apply(qkv, cos, sin, cos_k, sin_k, interleaved, seqlen_offsets) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/autograd/function.py", line 553, in apply return super().apply(args, kwargs) # type: ignore[misc] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/flash_attn/layers/rotary.py", line 151, in forward apply_rotary( File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/flash_attn/ops/triton/rotary.py", line 213, in apply_rotary rotary_kernel[grid]( File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/runtime/jit.py", line 550, in run bin.c_wrapper( ^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/compiler/compiler.py", line 692, in getattribute self._init_handles() File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/compiler/compiler.py", line 670, in _init_handles bin_path = {driver.HIP: "hsaco_path", driver.CUDA: "cubin"}[driver.backend] ^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/runtime/driver.py", line 157, in getattr self._initialize_obj() File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/runtime/driver.py", line 154, in _initialize_obj self._obj = self._init_fn() ^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/runtime/driver.py", line 187, in initialize_driver return CudaDriver() ^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/runtime/driver.py", line 77, in init self.utils = CudaUtils() ^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/runtime/driver.py", line 47, in init so = _build("cuda_utils", src_path, tmpdir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/common/build.py", line 106, in _build ret = subprocess.check_call(cc_cmd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/usr/bin/gcc', '/tmp/tmp5oe3edsd/main.c', '-O3', '-I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/triton/common/../third_party/cuda/include', '-I/home/vqc8153/miniconda3/envs/rna/include/python3.11', '-I/tmp/tmp5oe3edsd', '-shared', '-fPIC', '-lcuda', '-o', '/tmp/tmp5oe3edsd/cuda_utils.cpython-311-x86_64-linux-gnu.so', '-L/.singularity.d/libs']' returned non-zero exit status 1.

RJPenic commented 6 months ago

Hello, thank you for using RiNALMo! 😄

WeiminWu2000 commented 6 months ago

Hi, thanks for your reply! The answers are as the following:

  1. try.py: import torch from rinalmo.pretrained import get_pretrained_model

DEVICE = "cuda"

model, alphabet = get_pretrained_model(model_name="giga-v1") model = model.to(device=DEVICE) seqs = ["ACUUUGGCCA", "CCCGGU"]

tokens = torch.tensor(alphabet.batch_tokenize(seqs), dtype=torch.int64, device=DEVICE) print(tokens) with torch.no_grad(), torch.cuda.amp.autocast(): outputs = model(tokens)

print(outputs["representation"])

  1. I can not install 2.3.2, so I install 2.5.6 or 2.5.2. When I install 2.3.2, I met the error as the next comment.

  2. My cuda version is 12.4

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2024 NVIDIA Corporation Built on Tue_Feb_27_16:19:38_PST_2024 Cuda compilation tools, release 12.4, V12.4.99 Build cuda_12.4.r12.4/compiler.33961263_0

Thanks very much!

WeiminWu2000 commented 6 months ago

The error when installing 2.3.2:

  /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:10:23: fatal error: string_view: No such file or directory
   #include <string_view>
                         ^
  compilation terminated.
  fatal   : Could not open input file /tmp/tmpxft_00034b5a_00000000-8_flash_fwd_split_hdim224_fp16_sm80.compute_80.cpp1.ii
  [49/49] /home/vqc8153/miniconda3/envs/rna/bin/nvcc --generate-dependencies-with-compile --dependency-output /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/build/temp.linux-x86_64-cpython-311/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.o.d -I/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn -I/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src -I/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/cutlass/include -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/TH -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/THC -I/home/vqc8153/miniconda3/envs/rna/include -I/home/vqc8153/miniconda3/envs/rna/include/python3.11 -c -c /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu -o /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/build/temp.linux-x86_64-cpython-311/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.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_HALF2_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ --expt-relaxed-constexpr --expt-extended-lambda --use_fast_math -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=flash_attn_2_cuda -D_GLIBCXX_USE_CXX11_ABI=0
  FAILED: /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/build/temp.linux-x86_64-cpython-311/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.o
  /home/vqc8153/miniconda3/envs/rna/bin/nvcc --generate-dependencies-with-compile --dependency-output /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/build/temp.linux-x86_64-cpython-311/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.o.d -I/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn -I/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src -I/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/cutlass/include -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/TH -I/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/THC -I/home/vqc8153/miniconda3/envs/rna/include -I/home/vqc8153/miniconda3/envs/rna/include/python3.11 -c -c /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu -o /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/build/temp.linux-x86_64-cpython-311/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.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_HALF2_OPERATORS__ -U__CUDA_NO_BFLOAT16_CONVERSIONS__ --expt-relaxed-constexpr --expt-extended-lambda --use_fast_math -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=flash_attn_2_cuda -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 /usr/include/c++/4.8.2/cstdint:35:0,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContextLight.h:4,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:3,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_launch_template.h:7,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu:5:
  /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   #error This file requires compiler and library support for the \
    ^
  In file included from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:5,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/core/Device.h:5,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/core/Allocator.h:6,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContextLight.h:18,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:3,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_launch_template.h:7,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu:5:
  /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:10:23: fatal error: string_view: No such file or directory
   #include <string_view>
                         ^
  compilation terminated.
  In file included from /usr/include/c++/4.8.2/cstdint:35:0,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContextLight.h:4,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:3,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_launch_template.h:7,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu:5:
  /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   #error This file requires compiler and library support for the \
    ^
  In file included from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:5,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/core/Device.h:5,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/core/Allocator.h:6,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContextLight.h:18,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:3,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_launch_template.h:7,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu:5:
  /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:10:23: fatal error: string_view: No such file or directory
   #include <string_view>
                         ^
  compilation terminated.
  In file included from /usr/include/c++/4.8.2/cstdint:35:0,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContextLight.h:4,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:3,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_launch_template.h:7,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu:5:
  /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   #error This file requires compiler and library support for the \
    ^
  In file included from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/StringUtil.h:6:0,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/Exception.h:5,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/core/Device.h:5,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/core/Allocator.h:6,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContextLight.h:18,
                   from /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:3,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_launch_template.h:7,
                   from /tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/csrc/flash_attn/src/flash_fwd_hdim128_bf16_sm80.cu:5:
  /home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/include/c10/util/string_view.h:10:23: fatal error: string_view: No such file or directory
   #include <string_view>
                         ^
  compilation terminated.
  fatal   : Could not open input file /tmp/tmpxft_000345da_00000000-8_flash_fwd_hdim128_bf16_sm80.compute_80.cpp1.ii
  ninja: build stopped: subcommand failed.
  Traceback (most recent call last):
    File "/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/setup.py", line 268, in run
      urllib.request.urlretrieve(wheel_url, wheel_filename)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/urllib/request.py", line 241, in urlretrieve
      with contextlib.closing(urlopen(url, data)) as fp:
                              ^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/urllib/request.py", line 216, in urlopen
      return opener.open(url, data, timeout)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/urllib/request.py", line 525, in open
      response = meth(req, response)
                 ^^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/urllib/request.py", line 634, in http_response
      response = self.parent.error(
                 ^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/urllib/request.py", line 563, in error
      return self._call_chain(*args)
             ^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/urllib/request.py", line 496, in _call_chain
      result = func(*args)
               ^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/urllib/request.py", line 643, in http_error_default
      raise HTTPError(req.full_url, code, msg, hdrs, fp)
  urllib.error.HTTPError: HTTP Error 404: Not Found

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 2096, in _run_ninja_build
      subprocess.run(
    File "/home/vqc8153/miniconda3/envs/rna/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 "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/setup.py", line 288, in <module>
      setup(
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-udcof__h/flash-attn_49ef8916c17542d4a5acc0a3bf1d5d55/setup.py", line 285, in run
      super().run()
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
      self.run_command(cmd_name)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 91, in run
      _build_ext.run(self)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
      self.build_extensions()
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 871, in build_extensions
      build_ext.build_extensions(self)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
      self._build_extensions_serial()
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
      self.build_extension(ext)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 252, in build_extension
      _build_ext.build_extension(self, ext)
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
      objects = self.compiler.compile(
                ^^^^^^^^^^^^^^^^^^^^^^
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 684, in unix_wrap_ninja_compile
      _write_ninja_file_and_compile_objects(
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
      _run_ninja_build(
    File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 2112, 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 flash-attn Running setup.py clean for flash-attn Failed to build flash-attn ERROR: Could not build wheels for flash-attn, which is required to install pyproject.toml-based projects

RJPenic commented 6 months ago
RJPenic commented 6 months ago

Also, please check your gcc/g++ versions with g++ --version and gcc --version. According to this issue you might want to update your gcc/g++ compiler if you have an outdated version (apt install g++).

WeiminWu2000 commented 6 months ago

Thanks for your reply, my pytorch version is : 2.2.2+cu121 My g++ version is : g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) My gcc version is : gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

When I use: apt install g++, it shows that: bash: apt: command not found

WeiminWu2000 commented 6 months ago

Yes, I have tried "fresh" Conda environment

RJPenic commented 6 months ago

I think it is very possible that outdated gcc version is creating problems for flash-attention package (hence the C code errors). Try updating g++ version. Not sure how complicated that is on RedHat OS but I guess you can try doing it via conda (conda install -c conda-forge gxx)? Once you update the version, confirm that you have an updated version with g++ --version and try repeating RiNALMo's installation process.

WeiminWu2000 commented 6 months ago

Thanks very much, I will try it!

ylzdmm commented 5 months ago

Hello, I encountered the same problem, have you solved it?

WeiminWu2000 commented 5 months ago

No, I didn't. It maybe the model donot support the newest version of Falsh-attn. I want to ask for help from thr author as well

ylzdmm commented 5 months ago

Maybe the problem isn't here I try: conda env create -f environment.yml and pip list Package Version


absl-py 2.0.0 appdirs 1.4.4 biopython 1.81 bleach 6.1.0 Brotli 1.1.0 certifi 2024.2.2 charset-normalizer 3.3.0 click 8.1.7 colorama 0.4.6 contextlib2 21.6.0 docker-pycreds 0.4.0 einops 0.7.0 filelock 3.12.4 flash-attn 2.3.2 fsspec 2023.9.2 gitdb 4.0.10 GitPython 3.1.40 gmpy2 2.1.2 idna 3.4 Jinja2 3.1.2 joblib 1.3.2 kaggle 1.5.16 lightning 2.2.0.post0 lightning-utilities 0.10.1 lmdb 1.4.1 MarkupSafe 2.1.3 ml-collections 0.1.1 mpmath 1.3.0 networkx 3.2 ninja 1.11.1.1 numpy 1.26.0 packaging 23.2 pandas 2.1.1 pathtools 0.1.2 pip 23.3 protobuf 4.24.4 psutil 5.9.5 PySocks 1.7.1 python-dateutil 2.8.2 python-slugify 8.0.1 pytorch-lightning 2.1.3 pytz 2023.3.post1 PyYAML 6.0.1 requests 2.31.0 scikit-learn 1.3.1 scipy 1.11.3 sentry-sdk 1.32.0 setproctitle 1.3.3 setuptools 68.2.2 six 1.16.0 smmap 3.0.5 sympy 1.12 text-unidecode 1.3 threadpoolctl 3.2.0 torch 2.1.0 torchmetrics 1.2.1 tqdm 4.66.1 triton 2.1.0 typingextensions 4.8.0 tzdata 2023.3 urllib3 2.0.7 wandb 0.15.12 webencodings 0.5.1 wheel 0.41.2 So the version of Falsh-attn is 2.3.2,but I encountered the same problem raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/usr/bin/gcc', '/tmp/tmprzdhcrd/main.c', '-O3',........

ylzdmm commented 5 months ago

你好,我已经解决了我的问题,不知道对你有没有帮助, python test.py /usr/bin/ld: skipping incompatible /lib/i386-linux-gnu/libcuda.so when searching for -lcuda /usr/bin/ld: skipping incompatible /lib/i386-linux-gnu/libcuda.so when searching for -lcuda /usr/bin/ld: cannot find -lcuda collect2: error: ld returned 1 exit status Traceback (most recent call last): File "/projects/p32327/RNAFOLD/RiNALMo-main/try.py", line 13, in outputs = model(tokens) ^^^^^^^^^^^^^ File "/home/vqc8153/miniconda3/envs/rna/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 也就是说明我运行test.py(跟你的try.py是一样的,只不过我用的预训练权重是直接下载到我的卡上面,然后修改了一下路径)的时候,出现你上面的问题之前还出现了: /usr/bin/ld: skipping incompatible /lib/i386-linux-gnu/libcuda.so when searching for -lcuda /usr/bin/ld: skipping incompatible /lib/i386-linux-gnu/libcuda.so when searching for -lcuda /usr/bin/ld: cannot find -lcuda collect2: error: ld returned 1 exit status 不过Traceback后面跟你问题时一模一样的,对于我的: /usr/bin/ld: skipping incompatible /lib/i386-linux-gnu/libcuda.so when searching for -lcuda 问题,是因为我将CUDA从10.1换到11.8的时候,没有配置好libcuda.so,导致用的是/lib/i386-linux-gnu/libcuda.so,i386是32位的,而我装的是64位的,把libcuda.so配置好后解决了我的问题,希望对你有帮助。 不过我的环境装的是和作者一样的,使用conda env create -f environment.yml,flash-attn 2.3.2,我觉得你应该解决的问题是: /tmp/tmp5oe3edsd/main.c: In function ‘list_to_cuuint64_array’: /tmp/tmp5oe3edsd/main.c:354:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (Py_ssize_t i = 0; i < len; i++) { ^ /tmp/tmp5oe3edsd/main.c:354:3: note: use option -std=c99 or -std=gnu99 to compile your code /tmp/tmp5oe3edsd/main.c: In function ‘list_to_cuuint32_array’: /tmp/tmp5oe3edsd/main.c:365:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (Py_ssize_t i = 0; i < len; i++) { ^ 我是直接python test.py,我不清楚你为什么还有main.c代码,你这个可能是你的编译器比较老,使用的不是C99标准,也许你可以试一下: gcc -std=c99 -o outputfile main.c 以便与C99兼容,或者把你的变量提前定义好,比如: Py_ssize_t i; for (i = 0; i < len; i++) { ... }

WeiminWu2000 commented 5 months ago

非常感谢! 我也去试一下!