@@ -41,6 +41,8 @@ dlinfer提供了一套将国产硬件接入大模型推理框架的解决方案
4141pip install dlinfer-ascend
4242```
4343
44+ 目前只有华为支持pip安装。沐曦请使用源码安装。
45+
4446## 源码安装
4547
4648### 华为Atlas 800T A2
@@ -58,26 +60,40 @@ pip install dlinfer-ascend
5860 DEVICE=ascend python3 setup.py develop
5961 ```
6062
63+ ### 沐曦C500
64+
65+ 1 . 沐曦软件栈请自行联系沐曦相关人员。
66+
67+ 2 . 沐曦版本的dlinfer安装命令如下:
68+
69+ ``` shell
70+ cd /path_to_dlinfer
71+ DEVICE=maca python3 setup.py develop
72+ ```
73+
6174# 支持模型框架列表
6275
6376## LMDeploy
6477
65- | | 华为Atlas 800T A2 | 沐曦C500(待开源) | 寒武纪云端智能加速卡(开发中) |
78+ | | 华为Atlas 800T A2(bf16, w4a16) | 沐曦C500 | 寒武纪云端智能加速卡(开发中) |
6679| --- | --- | --- | --- |
67- | InternLM2.5-7B/20B | √ | | |
68- | InternLM2-7B/20B | √ | √ | |
69- | InternVL2-2B | √ | | |
70- | InternVL1-5 | √ | √ | |
71- | Llama3-8B | √ | √ | |
72- | Mixtral8x7B | √ | √ | |
73- | Qwen2-7B | √ | √ | |
74- | Qwen2-57B-A14B | √ | | |
75- | CogVLM | √ | | |
76- | CogVLM2 | | √ | |
80+ | InternLM2.5-7B/20B | √,√ | √ | |
81+ | InternLM2-7B/20B | √,√ | √ | |
82+ | InternVL2-2B | √,√ | √ | |
83+ | InternVL1-5 | √,√ | √ | |
84+ | Llama3-8B | √,√ | √ | |
85+ | Mixtral8x7B | √,X | √ | |
86+ | Qwen2-7B | √,X | √ | |
87+ | Qwen2-57B-A14B | √,X | √ | |
88+ | CogVLM | √,X | √ | |
89+ | CogVLM2 | √,X | √ | |
7790
7891### 使用LMDeploy
7992
80- 只需要指定pytorch engine后端为ascend,不需要其他任何修改即可。详细可参考lmdeploy文档。
93+ 只需要指定pytorch engine后端为ascend/maca,不需要其他任何修改即可。详细可参考lmdeploy文档。
94+
95+ > [ !CAUTION]
96+ > 沐曦环境下必须把` PytorchEnginConfig ` 中的` block_size ` 设为` 256 ` 。
8197
8298示例代码如下:
8399
@@ -87,11 +103,17 @@ from lmdeploy import PytorchEngineConfig
87103if __name__ == " __main__" :
88104 pipe = lmdeploy.pipeline(" /path_to_model" ,
89105 backend_config = PytorchEngineConfig(tp = 1 ,
90- cache_max_entry_count = 0.4 , device_type = " ascend" ))
106+ cache_max_entry_count = 0.4 , device_type = " ascend" , eager_mode = True ))
91107 question = [" Shanghai is" , " Please introduce China" , " How are you?" ]
92108 response = pipe(question, request_output_len = 256 , do_preprocess = False )
93109 for idx, r in enumerate (response):
94110 print (f " Q: { question[idx]} " )
95111 print (f " A: { r.text} " )
96112 print ()
97113```
114+
115+ > [ !TIP]
116+ > 图模式已经支持了Atlas 800T A2。目前,单卡下的InternLM2-7B/LLaMa2-7B/Qwen2-7B已经通过测试。
117+ > 用户可以在离线模式下设定` PytorchEngineConfig ` 中的` eager_mode=False ` 来开启图模式,或者设定` eager_mode=True ` 来关闭图模式。
118+ > 在线模式下默认开启图模式,请添加` --eager-mode ` 来关闭图模式。
119+ > (启动图模式需要事先` source /usr/local/Ascend/nnal/atb/set_env.sh ` )
0 commit comments