官方運行命令
能直接複製執行的命令。每一條都標了官方來源 —— 官方改了就跟著改。
這是我們加的價值。
官方文檔分散在 api-docs、GitHub README、HF 模型卡三個地方,
找一個「怎麼跑」要翻半天。這裡一次給齊。
下载模型
官方來源:https://huggingface.co/deepseek-ai
| 方式 | 命令 |
|---|---|
| Hugging Face CLI | huggingface-cli download deepseek-ai/DeepSeek-V3 |
| Hugging Face CLI(到指定目录) | huggingface-cli download deepseek-ai/DeepSeek-R1 --local-dir ./DeepSeek-R1 |
| git-lfs | git lfs install && git clone https://huggingface.co/deepseek-ai/DeepSeek-V3 |
| ModelScope(国内) | modelscope download --model deepseek-ai/DeepSeek-R1 |
起推理服务
官方來源:https://github.com/deepseek-ai/DeepSeek-V3
| 方式 | 命令 |
|---|---|
| vLLM | vllm serve deepseek-ai/DeepSeek-V3 --trust-remote-code --tensor-parallel-size 8 |
| SGLang | python -m sglang.launch_server --model deepseek-ai/DeepSeek-V3 --tp 8 |
| transformers(单机最小) | from transformers import AutoModelForCausalLM, AutoTokenizer |
DeepSeek Harness
官方來源:https://github.com/deepseek-ai/deepseek-harness
| 方式 | 命令 |
|---|---|
| 启动 Web UI | npx @deepseek-ai/dsh web |
| 安装插件 | dsh plugin --profile web add <plugin> |
| 查看版本 | npx @deepseek-ai/dsh --version |
调 API
官方來源:https://api-docs.deepseek.com/
| 方式 | 命令 |
|---|---|
| 端点 | POST https://api.deepseek.com/chat/completions |
| 模型名 | deepseek-chat / deepseek-reasoner |
| curl 最小示例 | curl https://api.deepseek.com/chat/completions -H "Authorization: Bearer $KEY" -d '{"model":"deepseek-chat","messages":[{"role":"user","content":"hi"}]}' |
量化
官方來源:https://huggingface.co/deepseek-ai
| 方式 | 命令 |
|---|---|
| GGUF(llama.cpp) | python convert_hf_to_gguf.py ./DeepSeek-R1-Distill-Qwen-7B --outtype q4_k_m |
| 官方已发布量化版 | 搜 Hugging Face 上的 -GGUF / -AWQ / -GPTQ 后缀 |
注意
- 大模型(V3/R1 完整版)需要多卡,671B 參數不是單機能跑的。
- 小模型(Distill 系列 1.5B-70B)可以單機或消費級顯卡跑。
--trust-remote-code是必須的,DeepSeek 用了自定義模型結構。- 命令以官方最新文檔為準,我們只做匯總。