mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #850] [Bug] 部署 r1 server 成功后,请求接口,一直无法返回响应 #611
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#611
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lessmore991 on GitHub (Mar 10, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/850
Originally assigned to: @KMSorSMS on GitHub.
Checklist
Describe the bug
部署命令:
ktransformers --model_path "/deepseek/DeepSeek-R1"
--gguf_path "/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-Q4_K_M"
--cpu_infer 82
--model_name deepseek-r1-671b --port 9093
--paged true --use_cuda_graph --no_flash_attn false
--max_new_tokens 16384 --max_response_tokens 16384 --batch_size 5
--optimize_config_path /workspace/ktransformers/ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat.yaml
请求:
url:http://0.0.0.0:9093/v1/chat/completions
body:
{
"model": "deepseek-r1-671b",
"max_tokens": 4,
"stream": true,
"messages": [
{
"role": "user",
"content": "讲个笑话"
}
]
}
结果一直无法接收到响应,后台日志显示请求已接收到,但是没有其它日志:

Reproduction
ktransformers服务化部署命令
Environment
v0.2.2版本、GPU环境
@qiuqiu10 commented on GitHub (Mar 10, 2025):
@KMSorSMS
@KMSorSMS commented on GitHub (Mar 10, 2025):
可能是你cpu_infer设置高了,你的cpu有多少核?超过物理核数上下文开销以及过多线程同步的开销会导致输出很慢。你改小之后再多花时间等等
@ubergarm commented on GitHub (Mar 10, 2025):
@lessmore991
--batch_size 5这个参数是从哪里来的?我的理解是,如果使用 CUDA 图(CUDA graphs),应该不需要调整这个参数。可以尝试使用已知有效的命令,例如这份非官方指南中的示例。
另外,你构建或安装的版本是什么?可通过以下命令检查:
git rev-parse --short HEADpip freeze | grep ktrans如果问题解决,请告知我们。若满意请关闭此 issue。
lessmore991
--batch_size 5where did you get this from? My impression was to use cuda graphs you have to leave that alone.Try a known working command such as the one in this unofficial guide
Also what version did you build or install? You can check with
git rev-parse --short HEADorpip freeze | grep ktrans.Let us know if you get it working and please close this issue if you are satisfied.
@lessmore991 commented on GitHub (Mar 11, 2025):
cpu2个,物理核各44个,版本是0.2.2rc2+cu121torch23avx512
@lessmore991 commented on GitHub (Mar 11, 2025):
现在把部署命令简化了之后,可以正常推理了:
ktransformers --model_path "/deepseek/DeepSeek-R1" --gguf_path "/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-Q4_K_M" --cpu_infer 82 --model_name deepseek-r1-671b --port 9093 --max_new_tokens 16384 --max_response_tokens 16384
等了十来分钟之后,后台日志才显示有结果生成出来,但是生成的速度很慢,大概一两分钟一个token
@KMSorSMS commented on GitHub (Mar 11, 2025):
调整一下cpu infer的数量,你lscpu查看一下当前的核数,如果没有USE_NUMA 编译时开启功能的话,你需要设置cpu infer数量和自己单个numa上的核数相当
@lessmore991 commented on GitHub (Mar 11, 2025):
/workspace# lscpu | grep numa -i
NUMA node(s): 2
NUMA node0 CPU(s): 0-87
NUMA node1 CPU(s): 88-175
感谢大佬,我查看了一下配置信息如上所示,那请问是需要将cpu infer数量设置成87还是175,我现在设置的84,略小于一个numa node的核心数
@KMSorSMS commented on GitHub (Mar 11, 2025):
87合适,你编译的时候没有export USE_NUMA=1就行。另外,max_response_tokens这个参数应该是无效的
@lessmore991 commented on GitHub (Mar 11, 2025):
enen好的,感谢指导,我也把max new tokens参数调小点试试