安装指南

备注

在本示例之前,请确保已经安装了 昇腾环境PyTorch 环境。

1. 安装DeepSpeed

安装DeepSpeed最简单的方式是通过 pip

1pip install deepspeed

2. 通过源码安装

GitHub 克隆DeepSpeed项目后,可以通过 pip 来通过源码编译。

1pip install .

3. 预编译DeepSpeed算子(可选)

如果不想使用JIT编译模式,而想要预编译DeepSpeed算子,可以通过设置环境变量的方式完成算子的预编译。

1DS_BUILD_OPS=1 pip install deepspeed

4. 安装验证

安装完成后,可以通过 ds_report 命令查看安装结果

 1--------------------------------------------------
 2DeepSpeed C++/CUDA extension op report
 3--------------------------------------------------
 4NOTE: Ops not installed will be just-in-time (JIT) compiled at
 5    runtime if needed. Op compatibility means that your system
 6    meet the required dependencies to JIT install the op.
 7--------------------------------------------------
 8JIT compiled ops requires ninja
 9ninja .................. [OKAY]
10--------------------------------------------------
11op name ................ installed .. compatible
12--------------------------------------------------
13deepspeed_not_implemented  [NO] ....... [OKAY]
14async_io ............... [NO] ....... [OKAY]
15cpu_adagrad ............ [NO] ....... [OKAY]
16cpu_adam ............... [NO] ....... [OKAY]
17cpu_lion ............... [NO] ....... [OKAY]
18fused_adam ............. [NO] ....... [OKAY]
19transformer_inference .. [NO] ....... [OKAY]
20--------------------------------------------------
21DeepSpeed general environment info:
22torch install path ............... ['/root/miniconda3/envs/ds/lib/python3.10/site-packages/torch']
23torch version .................... 2.2.0
24deepspeed install path ........... ['/root/miniconda3/envs/ds/lib/python3.10/site-packages/deepspeed']
25deepspeed info ................... 0.14.4, unknown, unknown
26deepspeed wheel compiled w. ...... torch 2.2
27torch_npu install path ........... ['/root/miniconda3/envs/ds/lib/python3.10/site-packages/torch_npu']
28torch_npu version ................ 2.2.0
29ascend_cann version .............. 8.0.RC2.alpha002
30shared memory (/dev/shm) size .... 20.00 GB