You need to enable JavaScript to run this app.
导航
DeepSeek R1 模型部署快速指南
最近更新时间:2025.02.05 11:07:28首次发布时间:2025.02.04 15:56:58

作为开放的云与 AI 服务提供商,火山引擎同时提供豆包大模型和开源模型方案满足企业的 AI 业务需求。随着开源模型构建复杂度显著上升,火山引擎可以提供包括 DeepSeek 在内的开源模型强化学习精调、蒸馏和大规模推理的整套方案,帮助您实现效率、性能和最优推理成本之间的极致平衡。
DeepSeek 发布的 DeepSeek-R1(MoE 架构,671B)以及系列 DeepSeek-R1-Distill 模型效果达到同类模型相同水平,成本低 90%到 95%,凭借模型开源、算法创新、极致性价比吸引全球注意。
现在,您可以灵活选择火山引擎火山方舟、机器学习平台、GPU 服务器部署调用 DeepSeek-R1 全尺寸模型。接下来一个月,火山引擎会持续推出 PD 分离、性能优化能力,针对您自研垂域模型的训练和推理,提供端到端的满血版 AI Infra 解决方案。
为您提供更好用的开源模型整套解决方案,相信火山引擎也是更好的选择。

使用步骤

提供基于 H20(ml.hpcpni3ln.45xlarge)规格的 DeepSeek-R1-Distill-Llama-70B 模型部署示例,方便您更直观灵活、安全的使用 DeepSeek R1 模型。

资源准备

准备云基础、镜像仓库、VPC、机器学习平台相关产品的资源,创建机器学习平台的队列。具体可联系火山引擎销售或者其他偏好的沟通方式。

模型下载

HuggingFace 下载

如果您从 HuggingFace 下载模型文件,遇到各种网络问题,可以通过 HuggingFace 的国内镜像加快下载速度。这里使用机器学习平台的开发机下载 DeepSeek-R1-Distill-Llama-70B 模型为例,为您自助从 HuggingFace 下载模型文件提供参考。

  1. 在机器学习平台创建开发机,选择好队列计算资源配置、访问配置、挂载共享文件系统后,即可创建。需要用户在镜像入口采用镜像 url 的方式:输入镜像vemlp-cn-beijing.cr.volces.com/preset-images/pytorch:2.4.1-cu12.4.1-py3.10-ubuntu20.04

Image

  1. 登录到机器学习平台开发机的 WebIDE,打开终端,下载模型权重文件:
# 开发机安装tmux并新建一个会话,避免远程连接异常断开,导致模型权重文件下载中断。
sudo apt-get update
yum install tmux -y
tmux new -s model

# 下载HuggingFace_hub 
pip install -U huggingface_hub
 
# 设置HF-mirror环境变量
export HF_ENDPOINT=https://hf-mirror.com
 
# 下载模型,需要指定模型的保存位置
huggingface-cli download --resume-download deepseek-ai/DeepSeek-R1-Distill-Llama-70B --local-dir /file_system/common-models/DeepSeek-R1-Distill-Llama-70B

最后模型 DeepSeek-R1-Distill-Llama-70B: /file_system/common-models/DeepSeek-R1-Distill-Llama-70B可以通过开发机持续进行数据参数、模型参数的调整,进行模型开发构建,然后将模型配置打包生成新的环境镜像。

机器学习平台预置模型下载

针对主流、领先的开源模型,火山引擎也提供 TOS(对象存储)预置模型权重文件,方便您自助复制,加速试验。
登录到机器学习平台开发机的 WebIDE,打开终端,下载预置模型权重文件:

#开发机安装tmux并新建一个会话,避免远程连接异常断开,导致模型权重文件下载中断。
sudo apt-get update
yum install tmux -y
tmux new -s model

#初始化配置,在 access_key_id 和 secret_access_key 分别输入账户对应的 AK、SK
vim ~/.tosutilconfig

# Tosutil 是用于访问和管理火山引擎对象存储(TOS)的命令行工具。开发机内置了 tosutil 工具,仅需简单配置即可使用。
# 查看tos bucket内的文件目录
tosutil ls tos://preset-models-cn-beijing/deepseek-ai //后为配置的远程连接bucket名称
 
# 执行命令,把预置模型权重文件从对象存储bucket拷贝到当前账号的vePFS。以cn-beijing region的预置模型权重文件为例,桶名称:tos://preset-models-cn-beijing
# 更多预置模型权重文件可以联系火山引擎获取
# 700GB约需要8m17s
tosutil cp tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1-Distill-Llama-70B/ /file_system/common-models/ -r -u -j=32 -p=4 -nfj=16 

# 同样如果需要将模型权重文件同步到自己账号的对象存储。可以执行命令反向操作
tosutil cp /file_system/common-models/DeepSeek-R1-Distill-Llama-70B/ tos://${repleace_with_your_tos_bucket_name} -r -u -j=32 -p=4 -nfj=16 

模型部署

服务配置

创建在线服务,并部署模型实例。在部署模型实例过程中,选择您专属 VPC 网络环境、API 网关、镜像、配置入口命令、挂载模型权重文件的共享文件系统路径和计算资源即可实现一键模型部署。
在镜像入口选择输入镜像地址:vemlp-cn-beijing.cr.volces.com/preset-images/dockerhub-vllm:v0.7.1
入口命令:

# vllm 的 DeepSeek-R1-Distill-Llama-70B 蒸馏模型的入口命令
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model  /file_system/common-models/DeepSeek-R1-Distill-Llama-70B --served-model-name DeepSeek-R1-Distill-Llama-70B  --tensor-parallel-size 2   --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

# DeepSeek-R1-Distill-Llama-70B 蒸馏模型FP8 quantization启动的入口命令
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model  /file_system/common-models/DeepSeek-R1-Distill-Llama-70B --served-model-name DeepSeek-R1-Distill-Llama-70B  --tensor-parallel-size 2 --quantization fp8 --kv-cache-dtype fp8_e4m3  --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

# DeepSeek R1 推荐使用SGLang镜像,显存占用消耗更少、推理性能优化更好
# vemlp-cn-beijing.cr.volces.com/preset-images/sglang:0.4.2
python3 -m sglang.launch_server --model-path  /file_system/common-models/DeepSeek-R1 --tp 8 --trust-remote-code --mem-fraction-static 0.9 --host 0.0.0.0 --port 50050
sleep inf

提交服务,等待环境初始化后,服务进入运行中状态。
Image

服务调用

在线服务详情页-部署页面获取实例的公网调用地址,配置调用参数,然后进入服务实例的 WebShell,发起服务调用测试。
Image

# curl语句 DeepSeek-R1-Distill-Llama-70B 配置调用参数
curl https://xx.apigateway-cn-beijing.volceapi.com/mlp/s-20250202183843-***/v1/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "DeepSeek-R1-Distill-Llama-70B",
        "prompt": "San Francisco is a",
        "max_tokens": 7,
        "temperature": 0
    }'
    
# curl语句 DeepSeek-R1-Distill-Llama-70B 也可以使用IP:Port的形式
curl 192.168.32.*:50050/v1/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "DeepSeek-R1-Distill-Llama-70B",
        "prompt": "San Francisco is a",
        "max_tokens": 7,
        "temperature": 0
    }'

# curl语句 DeepSeek-R1 或者V3 参考调用示例  
  curl -X POST \
  "192.168.32.*:50050/v1/chat/completio
  ns" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer EMPTY" \
  -d '{
    "model": "DeepSeek-R1",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful AI assistant"
      },
      {
        "role": "user",
        "content": "你是谁"
      }
    ],
    "temperature": 0,
    "max_tokens": 8192
  }'

随后即可在服务详情页的实时日志中查看服务的吞吐指标。
Image

如需公网访问请确认网络配置。

  1. 私有网络、子网、安全组,选择负载均衡器所在私有网络,并为该安全组放通入向端口,例如 50050 。
  2. 端口,添加自定义端口,监听端口 50050,调用端口任意,用途 HTTP。
  3. 负载均衡,选择公网类型的负载均衡以支持公网访问。

交流与预约体验

如您需进一步交流,可直接联系火山引擎销售人员预约体验。火山引擎为您提供最佳的框架选型及优化选项建议,加速 AI 创新实验。

附录

模型权重清单

模型名

模型大小

机型(推荐)

模型权重文件地址(cn-beijing 为例)

推理引擎启动参数配置(推荐)

DeepSeek-V3

FP8:
700 GB

Hopper GPU 96GiB * 8

  • https://huggingface.co/deepseek-ai/DeepSeek-V3
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-V3
# 使用SGLang
python3 -m sglang.launch_server --model-path  /file_system/common-models/DeepSeek-V3 --tp 8 --trust-remote-code --mem-fraction-static 0.9 --host 0.0.0.0 --port  50050
sleep inf

DeepSeek-R1

FP8:
700 GB

Hopper GPU 96GiB * 8

  • https://huggingface.co/deepseek-ai/DeepSeek-R1/tree/main
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1
# 使用SGLang
python3 -m sglang.launch_server --model-path  /file_system/common-models/DeepSeek-R1 --tp 8 --trust-remote-code --mem-fraction-static 0.9 --host 0.0.0.0 --port  50050
sleep inf

DeepSeek-R1-Distill-Qwen-1.5B

BF16:
3.55 GB

Hopper GPU 96GiB * 1

  • https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B/
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model /file_system/common-models/DeepSeek-R1-Distill-Qwen-1.5B --served-model-name DeepSeek-R1-Distill-Qwen-1.5B  --tensor-parallel-size 2   --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

DeepSeek-R1-Distill-Qwen-7B

BF16: 15.23 GB

Hopper GPU 96GiB * 1

  • https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B/
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model /file_system/common-models/DeepSeek-R1-Distill-Qwen-7B --served-model-name DeepSeek-R1-Distill-Qwen-7B  --tensor-parallel-size 2   --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

DeepSeek-R1-Distill-Llama-8B

BF16:
16.06 GB

Hopper GPU 96GiB * 1

  • https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1-Distill-Llama-8B/
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model /file_system/common-models/DeepSeek-R1-Distill-Llama-8B --served-model-name DeepSeek-R1-Distill-Llama-8B --tensor-parallel-size 2   --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

DeepSeek-R1-Distill-Qwen-14B

BF16:
29.54 GB

Hopper GPU 96GiB * 1

  • https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B/
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model /file_system/common-models/DeepSeek-R1-Distill-Qwen-14B --served-model-name DeepSeek-R1-Distill-Qwen-14B --tensor-parallel-size 2   --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

DeepSeek-R1-Distill-Qwen-32B

BF16:
65.53 GB

Hopper GPU 96GiB * 1

  • https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B/
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model /file_system/common-models/DeepSeek-R1-Distill-Qwen-32B --served-model-name DeepSeek-R1-Distill-Qwen-32B --tensor-parallel-size 2   --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

DeepSeek-R1-Distill-Llama-70B

BF16:
150 GB

Hopper GPU 96GiB * 2

  • https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B
  • tos://preset-models-cn-beijing/deepseek-ai/DeepSeek-R1-Distill-Llama-70B/
python3 -m vllm.entrypoints.openai.api_server --port 50050 --model  /file_system/common-models/DeepSeek-R1-Distill-Llama-70B --served-model-name DeepSeek-R1-Distill-Llama-70B  --tensor-parallel-size 2 --quantization fp8 --kv-cache-dtype fp8_e4m3  --max-num-seqs 64 --max_model_len=2048
sleep inf 30d

推理引擎镜像

环境要求

docker 镜像地址

基础环境镜像

cuda124+pytorch2.4
vemlp-cn-beijing.cr.volces.com/preset-images/pytorch:2.4.1-cu12.4.1-py3.10-ubuntu20.04

vLLM 的预置镜像

Version: 0.7.1-post1
vemlp-cn-beijing.cr.volces.com/preset-images/dockerhub-vllm:v0.7.1

SGLang 预置镜像

Version: 0.4.2.post1
vemlp-cn-beijing.cr.volces.com/preset-images/sglang:0.4.2

部署实例

您可以在实例列表页签查看部署的实例运行状态及其他信息。
Image