---
title: DeepSeek-R1-Distill-Llama-70B-模型库-ModelZoo-昇腾社区
description: DeepSeek-R1-Distill-Llama-70B是DeepSeek AI从DeepSeek-R1模型中蒸馏出来的Llama模型，比经过强化学习训练出来的小型稠密模型拥有更好的推理能力。
keywords: DeepSeek,Distill,Llama,模型库,ModelZoo,昇腾社区,Usage,权重
url: https://www.hiascend.com/software/modelzoo/models/detail/ee3f9897743a4341b43710f8d204733a
section: (其他)
---

# DeepSeek-R1-Distill-Llama-70B-模型库-ModelZoo-昇腾社区

URL: https://www.hiascend.com/software/modelzoo/models/detail/ee3f9897743a4341b43710f8d204733a
描述: DeepSeek-R1-Distill-Llama-70B是DeepSeek AI从DeepSeek-R1模型中蒸馏出来的Llama模型，比经过强化学习训练出来的小型稠密模型拥有更好的推理能力。
关键词: DeepSeek,Distill,Llama,模型库,ModelZoo,昇腾社区,Usage,权重

ModelZoo主页

主页 [了解详情](https://www.hiascend.com/software/modelzoo)大模型 [了解详情](https://www.hiascend.com/software/modelzoo/big-models)模型库 [了解详情](https://www.hiascend.com/software/modelzoo/models)工具库 [了解详情](https://www.hiascend.com/software/modelzoo/tools)权重库 [了解详情](https://www.hiascend.com/software/modelzoo/datasets)ModelShow [了解详情](https://www.hiascend.com/software/modelzoo/modelshow)DeepSeek专区HOT [了解详情](https://www.hiascend.com/developer/deepseek)文档中心论坛交流

主页 [了解详情](https://www.hiascend.com/software/modelzoo)大模型 [了解详情](https://www.hiascend.com/software/modelzoo/big-models)模型库 [了解详情](https://www.hiascend.com/software/modelzoo/models)工具库 [了解详情](https://www.hiascend.com/software/modelzoo/tools)权重库 [了解详情](https://www.hiascend.com/software/modelzoo/datasets)ModelShow [了解详情](https://www.hiascend.com/software/modelzoo/modelshow)DeepSeek专区HOT [了解详情](https://www.hiascend.com/developer/deepseek)文档中心论坛交流

模型库 [了解详情](https://www.hiascend.com/software/modelzoo/models)

DeepSeek-R1-Distill-Llama-70B

## DeepSeek-R1-Distill-Llama-70B

LLMPyTorch推理21257次浏览2026/01/19更新

获取源码

点击DeepSeek专区 [了解详情](https://www.hiascend.com/developer/deepseek)获取更多资源

DeepSeek-R1-Distill-Llama-70B

点击DeepSeek专区 [了解详情](https://www.hiascend.com/developer/deepseek)获取更多资源

查看模型源码

...

# DeepSeek-R1-Distill-Llama-70B

## Usage

Using the reasoning data generated by DeepSeek-R1, DeepSeek AI fine-tuned several dense models that are widely used in the research community, slightly changing their configs and tokenizers. DeepSeek-R1-Distill-Llama-70B is one of them.

## 权重

权重下载

- DeepSeek-R1-Distill-Llama-70B [了解详情](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B/tree/main)

## 加载镜像

前往昇腾社区/开发资源 [了解详情](https://www.hiascend.com/developer/ascendhub/detail/af85b724a7e5469ebd7ea13c3439d48f)下载适配DeepSeek-R1-Distill-Llama-70B的镜像包：1.0.0-800I-A2-py311-openeuler24.03-lts

完成之后，请使用`docker images`命令确认查找具体镜像名称与标签。

镜像中各组件版本配套如下：

| 组件 | 版本 |
| --- | ---|
| MindIE | 1.0.0 |
| CANN | 8.0.0 |
| PTA | 6.0.0 |
| MindStudio | 7.0.0 |
| HDK | 24.1.0 |

## 约束条件

- 部署DeepSeek-R1-Distill-Llama-70B模型至少需要`1台Atlas 800I A2服务器`
- 支持TP=8推理

## 新建容器

目前提供的MindIE镜像预置了DeepSeek-R1-Distill-Llama-70B模型推理脚本，无需再额外下载模型适配代码，直接新建容器即可。

如果您使用的是root用户镜像（例如从Ascend Hub上取得），并且可以使用特权容器，请使用以下命令启动容器：

```
docker run -it -d --net=host --shm-size=1g \
    --privileged \
    --name <container-name> \
    --device=/dev/davinci_manager \
    --device=/dev/hisi_hdc \
    --device=/dev/devmm_svm \
    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver:ro \
    -v /usr/local/sbin:/usr/local/sbin:ro \
    -v /path-to-weights:/path-to-weights:ro \
    mindie:1.0.0-800I-A2-py311-openeuler24.03-lts bash
```

如果您希望使用自行构建的普通用户镜像，并且规避容器相关权限风险，可以使用以下命令指定用户与设备：

```
docker run -it -d --net=host --shm-size=1g \
    --name <container-name> \
    --device=/dev/davinci_manager \
    --device=/dev/hisi_hdc \
    --device=/dev/devmm_svm \
    --device=/dev/davinci0 \
    --device=/dev/davinci1 \
    --device=/dev/davinci2 \
    --device=/dev/davinci3 \
    --device=/dev/davinci4 \
    --device=/dev/davinci5 \
    --device=/dev/davinci6 \
    --device=/dev/davinci7 \
    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver:ro \
    -v /usr/local/sbin:/usr/local/sbin:ro \
    -v /path-to-weights:/path-to-weights:ro \
    mindie:1.0.0-800I-A2-py311-openeuler24.03-lts bash
```

更多镜像使用信息请参考官方镜像仓库文档 [了解详情](https://gitee.com/ascend/ascend-docker-image/tree/dev/mindie#%E5%90%AF%E5%8A%A8%E5%AE%B9%E5%99%A8)。

## 进入容器

```
docker exec -it ${容器名称} bash
```

## 量化权重生成

### Atlas 800I A2 w8a8量化

- 生成量化权重依赖msModelSlim工具，安装方式见此README [了解详情](https://gitee.com/ascend/msit/tree/master/msmodelslim)
- 进入到msit/msmodelslim/example/Llama的目录`cd msit/msmodelslim/example/Llama`；
- W8A8量化权重请使用以下指令生成

- 注意该量化方式仅支持在Atlas 800I A2服务器上运行

```
# 设置CANN包的环境变量
source /usr/local/Ascend/ascend-toolkit/set_env.sh
# 虚拟内存
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:False
# 运行量化转换脚本
python3 quant_llama.py --model_path {浮点权重路径} --save_directory {W8A8量化权重路径} --calib_file ../common/boolq.jsonl  --device_type npu --disable_level L5 --anti_method m4 --act_method 3 
```

## 纯模型推理

### 对话测试

进入llm_model路径

```
cd $ATB_SPEED_HOME_PATH
```

执行对话测试

```
torchrun --nproc_per_node 8 \
         --master_port 20037 \
         -m examples.run_pa \
         --model_path ${权重路径} \
         --input_texts 'What is deep learning?' \
         --max_output_length 20
```

### 性能测试

进入ModelTest路径

```
cd $ATB_SPEED_HOME_PATH/tests/modeltest/
```

运行测试脚本

```
bash run.sh pa_[data_type] performance [case_pair] [batch_size] ([prefill_batch_size]) [model_name] ([is_chat_model]) (lora [lora_data_path]) [weight_dir] ([trust_remote_code]) [chip_num] ([parallel_params]) ([max_position_embedding/max_sequence_length])
```

具体执行batch=1, 输入长度256, 输出长度256用例的8卡并行性能测试命令如下，

Atlas 800I A2:

```
bash run.sh pa_bf16 performance [[256,256]] 1 llama ${weight_path} 8
```

注：ModelTest为大模型的性能和精度提供测试功能。使用文档请参考`${ATB_SPEED_HOME_PATH}/tests/modeltest/README.md`

## 服务化推理

- 打开配置文件

```
vim /usr/local/Ascend/mindie/latest/mindie-service/conf/config.json
```

- 更改配置文件

```
{
...
"ServerConfig" :
{
...
"port" : 1025, #自定义
"managementPort" : 1026, #自定义
"metricsPort" : 1027, #自定义
...
"httpsEnabled" : false,
...
},

"BackendConfig": {
...
"npuDeviceIds" : [[0,1,2,3,4,5,6,7]],
...
"ModelDeployConfig":
{
"ModelConfig" : [
{
...
"modelName" : "llama",
"modelWeightPath" : "/data/datasets/DeepSeek-R1-Distill-Llama-70B",
"worldSize" : 8,
...
}

},
...
}
}
```

- 拉起服务化

```
cd /usr/local/Ascend/mindie/latest/mindie-service/bin
./mindieservice_daemon
```

- 新建窗口测试(VLLM接口)

```
curl 127.0.0.1:1025/generate -d '{
"prompt": "What is deep learning?",
"max_tokens": 32,
"stream": false,
"do_sample":true,
"temperature": 0.6,
"top_p": 0.95,
"model": "llama"
}'
```

注: 服务化推理的更多信息请参考MindIE Service用户指南 [了解详情](https://www.hiascend.com/document/detail/zh/mindie/100/mindieservice/servicedev/mindie_service0001.html)

## 常见问题

1. ImportError: cannot import name 'shard_checkpoint' from 'transformers.modeling_utils'. 降低transformers版本可解决。

```
pip install transformers==4.46.3
pip install numpy==1.26.4
```

## 声明

- 本代码仓提到的数据集和模型仅作为示例，这些数据集和模型仅供您用于非商业目的，如您使用这些数据集和模型来完成示例，请您特别注意应遵守对应数据集和模型的License，如您因使用数据集或模型而产生侵权纠纷，华为不承担任何责任。
- 如您在使用本代码仓的过程中，发现任何问题（包括但不限于功能问题、合规问题），请在本代码仓提交issue，我们将及时审视并解答。

| 版本 | 更新时间 | 精度 | 处理器 | CANN版本 | 操作 |
| --- | --- | --- | --- | --- | ---|

暂无数据

使用模型资源和服务前，请您仔细阅读并理解透彻《昇腾深度学习模型许可协议 3.0》 [了解详情](https://www.hiascend.com/legal/modelzoo_models_license)
