shengxia/RWKV_Role_Playing

安装torch的时候失败了,为什么呢

drelover opened this issue · 5 comments

pip install torch==1.3.1 Defaulting to user installation because normal site-packages is not writeable ERROR: Could not find a version that satisfies the requirement torch==1.3.1 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0) ERROR: No matching distribution found for torch==1.3.1

找了一下,是几个更新源都下架了windows版本的torch 1.3.1。那么我应当怎么安装依赖呢

测试了一下2.3.0版本的torch不可以,但是2.0.0版本的似乎可以

发现torch和cuda不兼容,报错

Traceback (most recent call last): File "G:\RWKV_Role_Playing-master\webui.py", line 24, in <module> model_util.load_model() File "G:\RWKV_Role_Playing-master\modules\model_utils.py", line 33, in load_model self.model = RWKV(model=self.model_path, strategy=self.strategy) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxx\AppData\Roaming\Python\Python311\site-packages\torch\jit\_script.py", line 292, in init_then_script original_init(self, *args, **kwargs) File "C:\Users\xxx\AppData\Roaming\Python\Python311\site-packages\rwkv\model.py", line 424, in __init__ w[x] = w[x].to(device=DEVICE).contiguous() ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxx\AppData\Roaming\Python\Python311\site-packages\torch\cuda\__init__.py", line 239, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

简单测试了一下torch能否使用gpu

`>>> import torch

print(torch.version)
2.0.0+cpu
print(torch.cuda.is_available())
False
`

发现不可以,研究暂时到此位置,有没有大佬给点建议

pip install torch==1.13.1 --extra-index-url https://download.pytorch.org/whl/cu117 --upgrade

我这边尝试着执行这个命令安装torch 1.13.1,还是可以执行成功的。

  1. 命令行运行nvidia-smi,看下自己显卡支持的 CUDA版本。(我是12.4)

_20240719093859

  1. 然后再修改命令安装torch,一个是torch==2.1.0,一个是cu121(因为最高就12.1)
    pip install torch==2.1.0 --extra-index-url https://download.pytorch.org/whl/cu121 --upgrade

  2. 主要一定要写这里https://download.pytorch.org/whl/torch/有的torch\cu\cp组合
    _20240719095145

从你反馈看,你貌似是装的18.1的CUDA版本?