运行该项目需要4x8x64GB显存。硬件资源为K100-AI.
git clone http://developer.sourcefind.cn/codes/modelzoo/deepseek-r1_pytorch.git
1、获取docker镜像
docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.3.0-ubuntu22.04-dtk24.04.3-py3.10
2、创建并运行docker容器
docker run --shm-size 500g --network=host --name=dpskr1 --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v <获取的项目代码地址>:/home/ -v /opt/hyhal:/opt/hyhal:ro -it <上一步获取的docker镜像ID> bash
注意: 可以使用 docker images 获取相应的镜像ID。
3、依赖项安装
cd /home/inference
pip install -r requirements.txt
1、下载模型
有两种方式可下载模型分别是使用SCNet及huggingface下载,具体方式分别为
git clone http://113.200.138.88:18080/aimodels/deepseek-ai/DeepSeek-R1.git
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download --resume-download deepseek-ai/DeepSeek-R1 --local-dir DeepSeek-R1
2、模型转换
cd inference python fp8_cast_bf16.py --input-fp8-hf-path /path/to/fp8_weights --output-bf16-hf-path /path/to/DeepSeek-R1-bf16
注意,这里的/path/to/fp8_weights就是 下载模型 部分得到的模型.
3、模型划分
python convert.py --hf-ckpt-path /path/to/DeepSeek-R1-bf16 --save-path /path/to/DeepSeek-R1-Demo --n-experts 256 --model-parallel 32
4、文件复制
cp /path/to/fp8_weights/*.json /path/to/DeepSeek-R1-Demo
export NCCL_ALGO=Ring
export NCCL_PROTO=Simple
torchrun --nnodes 4 --nproc-per-node 8 --node-rank $RANK --master-addr $ADDR generate.py --ckpt-path /path/to/DeepSeek-V3-Demo --config configs/config_671B.json --interactive --temperature 0.7 --max-new-tokens 200


暂无数据
执行转换精度的脚本产生了如下报错,看样子是python3.7.9版本太老导致的,functools 模块并不包含 cached_property,想问下你转换精度是在物理机上直接转换的吗,以及用的python版本是多少呢。
python3 fp8_cast_bf16.py --input-fp8-hf-path /home/appuser/Deepseek-v3 --output-bf16-hf-path /home/appuser/Deepseek-v3-bf16
Traceback (most recent call last):
File "fp8_cast_bf16.py", line 10, in <module>
from kernel import weight_dequant
File "/home/appuser/kernel.py", line 4, in <module>
import triton
File "/usr/local/lib64/python3.7/site-packages/triton/__init__.py", line 8, in <module>
from .runtime import (
File "/usr/local/lib64/python3.7/site-packages/triton/runtime/__init__.py", line 1, in <module>
from .autotuner import (Autotuner, Config, Heuristics, OutOfResources, autotune, heuristics)
File "/usr/local/lib64/python3.7/site-packages/triton/runtime/autotuner.py", line 7, in <module>
from ..testing import do_bench
File "/usr/local/lib64/python3.7/site-packages/triton/testing.py", line 8, in <module>
from . import language as tl
File "/usr/local/lib64/python3.7/site-packages/triton/language/__init__.py", line 6, in <module>
from .standard import (
File "/usr/local/lib64/python3.7/site-packages/triton/language/standard.py", line 3, in <module>
from ..runtime.jit import jit
File "/usr/local/lib64/python3.7/site-packages/triton/runtime/jit.py", line 10, in <module>
from functools import cached_property
ImportError: cannot import name 'cached_property' from 'functools' (/usr/lib64/python3.7/functools.py)下载的模型要分别放在四个机器上吗?
如可判断网络组网是OK的呢