当前位置:   article > 正文

2024.5.4 mamba环境搭建TypeError: causal_conv1d_fwd_running setup.py clean for causal-conv1d failed to

running setup.py clean for causal-conv1d failed to build causal-conv1d insta

2024.5.4 mamba环境搭建TypeError: causal_conv1d_fwd

报错:https://github.com/state-spaces/mamba

Traceback (most recent call last):
  File "/home/zzy/code/mamba/test.py", line 13, in <module>
    y = model(x)
  File "/home/zzy/local/anaconda3/envs/mambagraph/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/zzy/local/anaconda3/envs/mambagraph/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/zzy/code/mamba/mamba_ssm/modules/mamba_simple.py", line 146, in forward
    out = mamba_inner_fn(
  File "/home/zzy/code/mamba/mamba_ssm/ops/selective_scan_interface.py", line 323, in mamba_inner_fn
    return MambaInnerFn.apply(xz, conv1d_weight, conv1d_bias, x_proj_weight, delta_proj_weight,
  File "/home/zzy/local/anaconda3/envs/mambagraph/lib/python3.10/site-packages/torch/autograd/function.py", line 539, in apply
    return super().apply(*args, **kwargs)  # type: ignore[misc]
  File "/home/zzy/local/anaconda3/envs/mambagraph/lib/python3.10/site-packages/torch/cuda/amp/autocast_mode.py", line 113, in decorate_fwd
    return fwd(*args, **kwargs)
  File "/home/zzy/code/mamba/mamba_ssm/ops/selective_scan_interface.py", line 190, in forward
    conv1d_out = causal_conv1d_cuda.causal_conv1d_fwd(
TypeError: causal_conv1d_fwd(): incompatible function arguments. The following argument types are supported:
    1. (arg0: torch.Tensor, arg1: torch.Tensor, arg2: Optional[torch.Tensor], arg3: Optional[torch.Tensor], arg4: bool) -> torch.Tensor

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

其实原因就是版本不对,不用去查其他博客了
作者的 https://github.com/state-spaces/mamba 更新了适应新版本的causal_conv1d
在这里插入图片描述
安装:

pip install causal_conv1d-1.2.0.post2.tar.gz
  • 1

失败:

Building wheels for collected packages: causal_conv1d
  Building wheel for causal_conv1d (setup.py) ... error
  error: subprocess-exited-with-error

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


      torch.__version__  = 2.1.1+cu118


      running bdist_wheel
      Guessing wheel URL:  https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.2.0.post2/causal_conv1d-1.2.0.post2+cu118torch2.1cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
      error: <urlopen error [Errno 110] Connection timed out>
      [end of output]

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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

通过提示直接下载whl文件
https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.2.0.post2/causal_conv1d-1.2.0.post2+cu118torch2.1cxx11abiFALSE-cp310-cp310-linux_x86_64.whl

可以去找对应自己版本的whl,直接安装
测试

(mamba) zzy@ustc-gpu:~/code/mamba/tests$ python ../test.py
Mamba(
  (in_proj): Linear(in_features=16, out_features=64, bias=False)
  (conv1d): Conv1d(32, 32, kernel_size=(4,), stride=(1,), padding=(3,), groups=32)
  (act): SiLU()
  (x_proj): Linear(in_features=32, out_features=33, bias=False)
  (dt_proj): Linear(in_features=1, out_features=32, bias=True)
  (out_proj): Linear(in_features=32, out_features=16, bias=False)
)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/677708
推荐阅读
相关标签
  

闽ICP备14008679号