最近在用Qwen做毕设,在微调时搞deepspeed搞了好久,在这里码下来安装过程
1.首先是直接使用pip install deepspeed,反复尝试以失败告终
2.然后尝试了在仓库拉取源码,克隆github一直失败,也没找出来原因
后面拉取gitee仓库
git clone https://gitee.com/mirrors/DeepSpeed.git
3.拉取成功后,安装Visual Studio,这里参考Win10安装DeepSpeed 实测成功_windows deepspeed-优快云博客
安装完VS后一定要在环境变量Path里添加cl.exe的路径,我这里是D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64
4.接下来参考这篇博客Windows下安装DeepSpeed报错_error: failed building wheel for deepspeed-优快云博客
修改了setup.py之后在进入git bash,输入cmd.exe /c build_win.bat,然后输入.\build_win.bat
就可以部署成功了
5.最后一步,找到DeepSpeed\dist的wheel文件,安装轮子
pip install "E:\pyproject\Qwen\DeepSpeed\dist\deepspeed-0.16.5+38327e07-py3-none-any.whl"
安装完之后deepspeed就已经导入了