-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
DeepSpeed | ||
=========== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
install.rst | ||
quick_start.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
安装DeepSpeed | ||
============== | ||
|
||
.. note:: | ||
在本示例之前,请确保已经安装了 `昇腾环境 <../ascend/quick_install.html>`_ 和 `PyTorch <../pytorch/install.html>`_ 环境。 | ||
|
||
1. 安装DeepSpeed | ||
----------------- | ||
安装DeepSpeed最简单的方式是通过 ``pip`` 。 | ||
|
||
.. code-block:: shell | ||
:linenos: | ||
pip install deepspeed | ||
2. 通过源码安装 | ||
------------------ | ||
从 `GitHub <https://github.com/microsoft/DeepSpeed>`_ 克隆DeepSpeed项目后,可以通过 ``pip`` 来通过源码编译。 | ||
|
||
.. code-block:: shell | ||
:linenos: | ||
pip install . | ||
3. 预编译DeepSpeed算子(可选) | ||
---------------------------------- | ||
如果不想使用JIT编译模式,而想要预编译DeepSpeed算子,可以通过设置环境变量的方式完成算子的预编译。 | ||
|
||
.. code-block:: shell | ||
:linenos: | ||
DS_BUILD_OPS=1 pip install deepspeed | ||
4. 安装验证 | ||
----------- | ||
|
||
安装完成后,可以通过 ``ds_report`` 命令查看安装结果 | ||
|
||
.. code-block:: shell | ||
:linenos: | ||
-------------------------------------------------- | ||
DeepSpeed C++/CUDA extension op report | ||
-------------------------------------------------- | ||
NOTE: Ops not installed will be just-in-time (JIT) compiled at | ||
runtime if needed. Op compatibility means that your system | ||
meet the required dependencies to JIT install the op. | ||
-------------------------------------------------- | ||
JIT compiled ops requires ninja | ||
ninja .................. [OKAY] | ||
-------------------------------------------------- | ||
op name ................ installed .. compatible | ||
-------------------------------------------------- | ||
deepspeed_not_implemented [NO] ....... [OKAY] | ||
async_io ............... [NO] ....... [OKAY] | ||
cpu_adagrad ............ [NO] ....... [OKAY] | ||
cpu_adam ............... [NO] ....... [OKAY] | ||
cpu_lion ............... [NO] ....... [OKAY] | ||
fused_adam ............. [NO] ....... [OKAY] | ||
transformer_inference .. [NO] ....... [OKAY] | ||
-------------------------------------------------- | ||
DeepSpeed general environment info: | ||
torch install path ............... ['/root/miniconda3/envs/ds/lib/python3.10/site-packages/torch'] | ||
torch version .................... 2.2.0 | ||
deepspeed install path ........... ['/root/miniconda3/envs/ds/lib/python3.10/site-packages/deepspeed'] | ||
deepspeed info ................... 0.14.4, unknown, unknown | ||
deepspeed wheel compiled w. ...... torch 2.2 | ||
torch_npu install path ........... ['/root/miniconda3/envs/ds/lib/python3.10/site-packages/torch_npu'] | ||
torch_npu version ................ 2.2.0 | ||
ascend_cann version .............. 8.0.RC2.alpha002 | ||
shared memory (/dev/shm) size .... 20.00 GB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
快速开始 | ||
========== | ||
|
||
.. note:: | ||
在本示例之前,请确保已经安装了 `DeepSpeed <./install.html>`_ 环境。 如果还未安装,可以执行 ``pip install deepspeed`` 完成安装。 | ||
|
||
|
||
1. 使用DeepSpeed多卡并行训练 | ||
------------------------------- | ||
以下代码使用了cifar10数据集,使用DeepSpeed训练模型在多张NPU卡上进行模型训练(来自 `DeepSpeed Examples <https://github.com/microsoft/DeepSpeedExamples/blob/master/training/cifar/cifar10_deepspeed.py>`_),自DeepSpeed v0.12.6之后,代码无需任何修改,即可自动检测NPU并进行训练。 | ||
|
||
.. rli:: https://raw.githubusercontent.com/microsoft/DeepSpeedExamples/master/training/cifar/cifar10_deepspeed.py | ||
:language: python | ||
:linenos: | ||
|
||
2. 训练结果查看 | ||
---------------- | ||
训练完成后,会打印模型对图像识别的结果。 | ||
|
||
.. code-block:: shell | ||
:linenos: | ||
Finished Training | ||
Accuracy of the network on the 10000 test images: 57 % | ||
Accuracy of plane : 65 % | ||
Accuracy of car : 67 % | ||
Accuracy of bird : 52 % | ||
Accuracy of cat : 34 % | ||
Accuracy of deer : 52 % | ||
Accuracy of dog : 49 % | ||
Accuracy of frog : 59 % | ||
Accuracy of horse : 66 % | ||
Accuracy of ship : 66 % | ||
Accuracy of truck : 56 % |