kvcache-ai / kvcache-ai/ktransformers

[Bug] run deepseek-r1-0528 cpu memory so high

Open
#1,481 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
19.5k
Forks
1.6k
Avg merge
19h 32m
Merged PRs (30d)
27

Description

### 检查清单

- [x] 1. 我已经搜索过相关问题,但未能获得预期的帮助
- [x] 2. 该问题在最新版本中尚未修复
- [x] 3. 请注意,如果您提交的BUG相关 issue 缺少对应环境信息和最小可复现示例,我们将难以复现和定位问题,降低获得反馈的可能性
- [x] 4. 如果您提出的不是bug而是问题,请在讨论区发起讨论 https://github.com/kvcache-ai/ktransformers/discussions。否则该 issue 将被关闭
- [x] 5. 为方便社区交流,我将使用中文/英文或附上中文/英文翻译(如使用其他语言)。未附带翻译的非中文/英语内容可能会被关闭

### 问题描述

loading model.layers.40.self_attn.q_a_layernorm.weight to cuda:2
loading model.layers.40.self_attn.kv_a_layernorm.weight to cuda:2
loading model.layers.40.self_attn.kv_b_proj.weight to cuda:2
loading model.layers.40.input_layernorm.weight to cuda:2
loading model.layers.40.post_attention_layernorm.weight to cuda:2
loading model.layers.41.self_attn.q_a_layernorm.weight to cuda:2
loading model.layers.41.self_attn.kv_a_layernorm.weight to cuda:2
loading model.layers.41.self_attn.kv_b_proj.weight to cuda:2
在加载模型时,memory一致升高,在第41层时,内存占用过高,直接卡掉,内存变为0。(内存总量为1T,可用如下)

Image

Image

### 复现步骤

CUDA_VISIBLE_DEVICES=1,2,3,4 \
python3 ktransformers/server/main.py \
--gguf_path /localnvme/application/lilw/weights/unsloth/DeepSeek-R1-0528-GGUF/Q4_K_M/ \
--model_path /localnvme/application/lilw/weights/deepseek-ai/DeepSeek-R1-0528 \
--model_name DeepSeek-R1-0528-GGUF \
--cpu_infer 128 \
--max_new_tokens 8192 \
--cache_lens 32768 \
--temperature 0.6 \
--top_p 0.95 \
--optimize_config_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-multi-gpu-4.yaml

### 环境信息

GPU:NVIDIA A800 8张
CPU: Intel(R) Xeon(R) Platinum 8358P CPU @ 2.60GHz
操作系统:ubuntu22.04

编译的ktransformers
ktransformers: 0.3.1+cu124torch26fancy

Contributor guide

Open the contributing guide

Research direction

Start with ktransformers/server/main.py and the DeepSeek-V3-Chat-multi-gpu-4.yaml optimization configuration, then reproduce the supplied command with the listed model paths and hardware. Trace memory growth while layers 40 and 41 load; done means the model finishes loading without exhausting host memory or being killed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.