shengxia / RWKV_Role_Playing

使用Gradio制作的基于RWKV的角色扮演的webui
GNU General Public License v3.0
222 stars 27 forks source link

Error building extension 'wkv_cuda' 报错 #18

Open LiangWei88 opened 1 year ago

LiangWei88 commented 1 year ago

已经按照说明安装, 但是用 cuda 时报错

` Using C:\Users\Admin\AppData\Local\torch_extensions\torch_extensions\Cache\py310_cu117 as PyTorch extensions root... Detected CUDA files, patching ldflags Emitting ninja build file C:\Users\Admin\AppData\Local\torch_extensions\torch_extensions\Cache\py310_cu117\wkv_cuda\build.ninja... Building extension module wkv_cuda... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc --generate-dependencies-with-compile --dependency-output operators.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=wkv_cuda -DTORCH_API_INCLUDE_EXTENSION_H -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include\torch\csrc\api\include -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include\TH -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -IE:\Programs\Python\Python310\Include -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 "-t 4" -std=c++17 --use_fast_math -O3 --extra-device-vectorization -c E:\RWKV_Role_Playing\Env\lib\site-packages\rwkv\cuda\operators.cu -o operators.cuda.o FAILED: operators.cuda.o C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc --generate-dependencies-with-compile --dependency-output operators.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=wkv_cuda -DTORCH_API_INCLUDE_EXTENSION_H -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include\torch\csrc\api\include -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include\TH -IE:\RWKV_Role_Playing\Env\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -IE:\Programs\Python\Python310\Include -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 "-t 4" -std=c++17 --use_fast_math -O3 --extra-device-vectorization -c E:\RWKV_Role_Playing\Env\lib\site-packages\rwkv\cuda\operators.cu -o operators.cuda.o nvcc fatal : Unknown option '-t 4' ninja: build stopped: subcommand failed. Traceback (most recent call last): File "E:\RWKV_Role_Playing\Env\lib\site-packages\torch\utils\cpp_extension.py", line 1900, in _run_ninja_build subprocess.run( File "E:\Programs\Python\Python310\lib\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 "E:\RWKV_Role_Playing\webui.py", line 20, in from modules.model_utils import ModelUtils File "E:\RWKV_Role_Playing\modules\model_utils.py", line 6, in from rwkv.model import RWKV File "E:\RWKV_Role_Playing\Env\lib\site-packages\rwkv\model.py", line 29, in load( File "E:\RWKV_Role_Playing\Env\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load return _jit_compile( File "E:\RWKV_Role_Playing\Env\lib\site-packages\torch\utils\cpp_extension.py", line 1508, in _jit_compile _write_ninja_file_and_build_library( File "E:\RWKV_Role_Playing\Env\lib\site-packages\torch\utils\cpp_extension.py", line 1623, in _write_ninja_file_and_build_library _run_ninja_build( File "E:\RWKV_Role_Playing\Env\lib\site-packages\torch\utils\cpp_extension.py", line 1916, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'wkv_cuda' (Env) `

shengxia commented 1 year ago

老实讲我也不太能看出来,不过“subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.”这一句,我好像在哪儿见过,是版本的问题,你方便说一下pytorch的版本吗?

ms-KuroNeko commented 1 year ago

问题根本不在Pytorch,问题在ninja

subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

ninja -v 报错 检查 ninja 是否正确安装并可运行

我 Ubuntu 同样的错误是在安装好 PythonDev 之后解决的 建议把 PythonDev GCC G++ ninja 都检查一遍 Windows检查一下 MSVC 编译器,实在不行装个 Visual Studio 配个 C++ 开发环境暴力解决

1014670860 commented 11 months ago

按照楼上的说的, 安装了python-devtools, 还是不行,点解

shengxia commented 11 months ago

这个编译好像需要装cudnn(反正我之前没装报错了),你这个装了吗?

lty365 commented 7 months ago

环境变量 配置 ,C++ CUDA 什么的

shengxia commented 7 months ago

虽然有点晚,但是我最近才闹明白这个该怎么看,你这个报错主要的地方是: nvcc fatal : Unknown option '-t 4' 这一句,就是不识别这个编译参数,不过鉴于这是去年的事儿了,rwkv库也升级了好几版了,我也不确定现在这个版本还有没有这个编译参数了,你要不更新到最新版再试试,看看行不行。