赞
踩
目录
1、下载NVIDIA 驱动程序、cuda11.8、cudnn8.6.0
请直接拉到最后查看运行失败的原因,如有解决方案欢迎讨论
参考另一篇博客【win10+cuda11.8+cudnn8.6.0安装】
环境名:vim,python版本:3.10.13
conda create -n vim python=3.10.13
conda activate vim
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
如果安装过程中,有部分包指定的版本安装失败,则直接【pip install package】,不指定版本安装即可。
pip install -r vim/vim_requirements.txt
causal_conv1d和mamba-1p1p1
这两个包作者提供的源码里面有,目录结构如下:
进入VIm-main项目文件夹的causal-conv1d文件夹后,利用-e参数安装。
- cd causal-conv1d
- pip install -e .
安装caucal_conv1d的时候,报错:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/
解决方案参考:【已解决】error: Microsoft Visual C++ 14.0 or greater is required
后来发现安装完的版本是1.0.0,但是要求>=1.1.0,所以重新自己下载1.1.3版本之后再安装
causal_conv1d的1.1.3版本的下载链接:GitCode - 开发者的代码家园
下载完之后,进入causal_conv1d文件夹,输入命令【pip install -e .】安装即可。
安装完后,使用命令【pip list】查看如下:
windows无法使用【MAMBA_FORCE_BUILD=TRUE pip install .】命令安装 mamba-ssm
, 需要把Vim-main/mamba-1p1p1/setup.py文件中的两个变量改成 False(原因:改成False后才能强制利用已经下载的本地文件进行编译)。修改的内容如下:
修改完后,在cmd进入mamba-1p1p1文件下,执行安装。
- cd mamba-1p1p1
- pip install -e .
安装成功的话,显示如下
报错:【ModuleNotFoundError: No module named 'selective_scan_cuda'】
解决办法:
找到文件 mamba-1p1p1/mamba_ssm/ops/selective_scan_interface.py,修改三处内容
第一处,注释import语句
# import selective_scan_cuda
第二处,将原来的return语句注释掉,更换成新的return语句
# 将原来的return语句注释掉,更换成新的return语句 def selective_scan_fn(u, delta, A, B, C, D=None, z=None, delta_bias=None, delta_softplus=False, return_last_state=False): """if return_last_state is True, returns (out, last_state) last_state has shape (batch, dim, dstate). Note that the gradient of the last state is not considered in the backward pass. """ # return SelectiveScanFn.apply(u, delta, A, B, C, D, z, delta_bias, delta_softplus, return_last_state) return selective_scan_ref(u, delta, A, B, C, D, z, delta_bias, delta_softplus, return_last_state) # here第三处,将原来的return语句注释掉,更换成新的return语句
# 将原来的return语句注释掉,更换成新的return语句 def mamba_inner_fn( xz, conv1d_weight, conv1d_bias, x_proj_weight, delta_proj_weight, out_proj_weight, out_proj_bias, A, B=None, C=None, D=None, delta_bias=None, B_proj_bias=None, C_proj_bias=None, delta_softplus=True ): # return MambaInnerFn.apply(xz, conv1d_weight, conv1d_bias, x_proj_weight, delta_proj_weight, # out_proj_weight, out_proj_bias, # A, B, C, D, delta_bias, B_proj_bias, C_proj_bias, delta_softplus) return mamba_inner_ref(xz, conv1d_weight, conv1d_bias, x_proj_weight, delta_proj_weight, out_proj_weight, out_proj_bias, A, B, C, D, delta_bias, B_proj_bias, C_proj_bias, delta_softplus) # here
报错1:
File "D:\anaconda\install\envs\vim\lib\site-packages\triton\compiler.py", line 1093, in default_cache_dir return os.path.join(os.environ["HOME"], ".triton", "cache") File "D:\anaconda\install\envs\vim\lib\os.py", line 680, in __getitem__ raise KeyError(key) from None KeyError: 'HOME'
尝试解决:
在D盘下新建了一个HOME目录,然后将HOME环境变量设置为D:\HOME。关闭PyCharm并重启,使环境变量生效。重新运行main.py之后,没有报这个错误,报了另一个error。
报错2:
File "D:\anaconda\install\envs\vim\lib\site-packages\triton\runtime\autotuner.py", line 62, in
File "D:\anaconda\install\envs\vim\lib\site-packages\triton\compiler.py", line 1155, in _build
cuda_lib_dirs = libcuda_dirs()
File "D:\anaconda\install\envs\vim\lib\site-packages\triton\compiler.py", line 1134, in libcuda_dirs
locs = subprocess.check_output(["whereis", "libcuda.so"]).decode().strip().split()[1:]
File "D:\anaconda\install\envs\vim\lib\subprocess.py", line 421, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "D:\anaconda\install\envs\vim\lib\subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\anaconda\install\envs\vim\lib\subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\anaconda\install\envs\vim\lib\subprocess.py", line 1456, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。原因分析: triton 库出现了问题,似乎是在尝试执行 whereis libcuda.so 命令时发生了问题,因为在 Windows 系统中并不存在 libcuda.so 文件。待解决...
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。