diff --git a/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-70B/README.md b/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-70B/README.md index 6d0a64e5dfbbf10cbfec819021464a095f9bdab7..c354fa23073a3d679fc6ceee8cd3e20458e12598 100644 --- a/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-70B/README.md +++ b/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-70B/README.md @@ -78,23 +78,18 @@ docker exec -it ${容器名称} bash ## 量化权重生成 ### Atlas 800I A2 w8a8量化 -* 生成量化权重依赖msModelSlim工具,安装方式见[此README](https://gitee.com/ascend/msit/tree/dev/msmodelslim) - -* 量化权重统一使用${ATB_SPEED_HOME_PATH}/examples/convert/model_slim/quantifier.py脚本生成,以下提供Llama模型量化权重生成快速启动命令 +* 生成量化权重依赖msModelSlim工具,安装方式见[此README](https://gitee.com/ascend/msit/blob/master/msmodelslim/README.md#msmodelslim%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F) +* 进入到{msModelSlim工具路径}/msit/msmodelslim/example/Llama的目录 `cd msit/msmodelslim/example/Llama`; * W8A8量化权重请使用以下指令生成 * 注意该量化方式仅支持在Atlas 800I A2服务器上运行 - ```shell # 设置CANN包的环境变量 source /usr/local/Ascend/ascend-toolkit/set_env.sh # 关闭虚拟内存 export PYTORCH_NPU_ALLOC_CONF=expandable_segments:False -# 进入atb-models目录 -cd ${ATB_SPEED_HOME_PATH} -sed -i '167s/m3/m4/' examples/models/llama3/generate_quant_weight.sh -# DeepSeek-R1-Distill-Llama-70B量化 bf16,有回退层,antioutlier使用m4算法配置,使用min-max量化方式,校准数据集使用50条BoolQ数据,在NPU上进行运算 -bash examples/models/llama3/generate_quant_weight.sh -src {浮点权重路径} -dst {W8A8量化权重路径} -type llama3.1_70b_instruct_bf16_w8a8 +# 运行量化转换脚本 +python3 quant_llama.py --model_path {浮点权重路径} --save_directory {W8A8S量化权重路径} --calib_file ../common/boolq.jsonl --device_type npu --disable_level L5 --anti_method m4 --act_method 3 ``` ## 纯模型推理 @@ -109,7 +104,7 @@ cd $ATB_SPEED_HOME_PATH 执行对话测试 ```shell -torchrun --nproc_per_node 2 \ +torchrun --nproc_per_node 8 \ --master_port 20037 \ -m examples.run_pa \ --model_path ${权重路径} \ diff --git a/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-8B/README.md b/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-8B/README.md index 16e5e563cfeddda5962411fcc83c3c99c10b6515..0ec989ff2235bf9f9ce16cc6d4cf033e4d92fc5f 100644 --- a/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-8B/README.md +++ b/MindIE/LLM/DeepSeek/DeepSeek-R1-Distill-Llama-8B/README.md @@ -26,8 +26,8 @@ Using the reasoning data generated by DeepSeek-R1, DeepSeek AI fine-tuned severa | HDK | 24.1.0 | ## 约束条件 -* 部署DeepSeek-R1-Distill-Llama-8B模型至少需要`1台Atlas 800I A2服务器`或者`1台插1张Atlas 300I DUO卡的服务器`或者`1台插1张Atlas 300I Pro推理卡的服务器`或者`1台插1张Atlas 300V视频解析卡的服务器` -* 在使用Atlas 300I DUO/Atlas 300I Pro推理卡和Atlas 300V视频解析卡部署模型时,需要修改权重目录下的config.json文件,"torch_dtype"字段改为"float16" +* 部署DeepSeek-R1-Distill-Llama-8B模型至少需要`1台Atlas 800I A2服务器`或者`1台插1张Atlas 300I DUO卡的服务器` +* 在使用Atlas 300I DUO推理卡部署模型时,需要修改权重目录下的config.json文件,"torch_dtype"字段改为"float16" * 支持TP=1/2/4/8推理 ## 新建容器 @@ -79,7 +79,7 @@ docker exec -it ${容器名称} bash ## 量化权重生成 ### Atlas 800I A2 w8a8量化 -* 生成量化权重依赖msModelSlim工具,安装方式见[此README](https://gitee.com/ascend/msit/tree/dev/msmodelslim) +* 生成量化权重依赖msModelSlim工具,安装方式见[此README](https://gitee.com/ascend/msit/blob/master/msmodelslim/README.md#msmodelslim%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F) * 量化权重统一使用${ATB_SPEED_HOME_PATH}/examples/convert/model_slim/quantifier.py脚本生成,以下提供Llama模型量化权重生成快速启动命令 @@ -97,11 +97,11 @@ cd ${ATB_SPEED_HOME_PATH} bash examples/models/llama3/generate_quant_weight.sh -src {浮点权重路径} -dst {W8A8量化权重路径} -type llama3.1_8b_w8a8 ``` -### Atlas 300I DUO/Atlas 300I Pro/Atlas 300V稀疏量化 +### Atlas 300I DUO稀疏量化 **Step 1 生成W8A8S量化权重** -- 注意该量化方式仅支持在Atlas 300I DUO/Atlas 300I Pro/Atlas 300V卡上运行 +- 注意该量化方式仅支持在Atlas 300I DUO卡上运行 - 修改模型权重config.json中`torch_dtype`字段为`float16` -- 生成量化权重依赖msModelSlim工具,安装方式见[此README](https://gitee.com/ascend/msit/tree/dev/msmodelslim) +- 生成量化权重依赖msModelSlim工具,安装方式见[此README](https://gitee.com/ascend/msit/blob/master/msmodelslim/README.md#msmodelslim%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F) - 进入到{msModelSlim工具路径}/msit/msmodelslim/example/Llama的目录 `cd msit/msmodelslim/example/Llama`; ```shell # 运行量化转换脚本 @@ -109,7 +109,7 @@ python3 quant_llama.py --model_path {浮点权重路径} --save_directory {W8A8S ``` **Step 2 量化权重切分及压缩** -- 该步骤需要在Atlas 300I DUO/Atlas 300I Pro/Atlas 300V上运行 +- 该步骤需要在Atlas 300I DUO卡上运行 ```shell # 执行"jq --version"查看是否安装jq,若返回"bash:jq:command not found",则依次执行"apt-get update"和"apt install jq" jq --version