ctrLoRA环境配置(win11, linux)

发布于:2025-04-18 ⋅ 阅读:(25) ⋅ 点赞:(0)

注1:我没有安装与CtrLoRA的requirements完全对应的库版本,所以后续可能需要修改部分代码。
注2:以下我没有区分linux系统与windows系统的地方代表两者使用了相同的命令。

创建conda环境

conda create -n zxy-pl python=3.10
conda activate zxy-pl

安装torch和pytorch-lightning

查询torch版本和torch-lightning版本对应信息,在这个网站

torch安装

可以根据命令nvidia-smi查询自己的cuda版本,安装torch时,如果使用gpu,需要安装的torch版本所需的cuda低于自己电脑的cuda。在pytorch官网查询。

conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=11.8 -c pytorch -c nvidia

pytorch-lightning安装

lightning安装需要指定版本,这里我参考了网页
根据我安装的torch版本,我的lightning安装命令如下:

conda install pytorch-lightning==2.1.0 torchmetrics==0.11.4 -c conda-forge

安装opencv

这里我是用pip进行安装,如果使用conda安装,会找不到包,报错如下:
在这里插入图片描述
所以使用pip安装

pip install opencv-python

transformers安装

使用官网提供的安装命令(windows):

conda install conda-forge::transformers

在linux上使用该命令,报错:
LibMambaUnsatisfiableError: Encountered problems while solving:

  • package transformers-4.51.3-pyhd8ed1ab_0 is excluded by strict repo priority
    说已经在其他的channel找到了这个包,但是由于我设置了channel_priority: strict,所以没法安装,我尝试conda config --set channel_priority flexible,可以安装,但是在安装过程中报错,所以最终我是用pip安装了transformers
pip install transformers

skicit-learn

conda install scikit-learn

在linux上会报一会儿错,但是能安装,可能是我之前调整了channel_priority的原因

numpy

numpy需要小于2的版本,因此

pip install numpy==1.26.4

剩余的部分

全部都可以使用pip来下载。


网站公告

今日签到

点亮在社区的每一天
去签到