mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #693] gpu 利用率为0,不知道为什么? #505
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#505
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 @xiaohangguo on GitHub (Feb 26, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/693
您好,我按照官方给出的教程https://github.com/kvcache-ai/ktransformers/blob/main/doc/en/install.md
配置了环境,并且正常跑起来了。但是显卡的利用率始终为0,感觉是有问题的。推理全靠cpu,token吐的速度很慢很慢。
加载完模型花费了一个小时。然后大概四五分钟推理出一个token。
运行时会输出一堆的:
详细见后面附件中的图


一些背景信息:
服务器:centos8
内存:256G
cpus core :40
Model name: Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz
GPU:4090 48G
运行时信息:
环境版本如下:
@ubergarm commented on GitHub (Feb 27, 2025):
@xiaohangguo
查看您在另一工单 #641 提供的命令,似乎未包含
--optimize_config_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat.yaml。您需要编辑该.yaml文件,或选择与您的GPU配置及CUDA设备编号匹配的配置文件。参考此指南查看完整命令示例及讨论。祝顺利!
xiaohangguo
Looking at your command that you gave in a different ticket #641 it seems like you did not include
--optimize_config_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat.yaml. You must edit that.yamlfile or choose one that matches your GPU setup and CUDA device numbers.Check out this guide for full command examples and discussion. Good luck!
@xiaohangguo commented on GitHub (Feb 28, 2025):
没有用。加了优化器相关设置之后,GPU的利用率仍然是0,相当于推理都用的是cpu。不知道怎么解决
python -m ktransformers.local_chat --model_path deepseek-ai/DeepSeek-R1 --gguf_path /home/lvshuhang/.cache/modelscope/hub/models/unsloth/DeepSeek-R1-GGUF/DeepSeek-R1-Q4_K_M --hf_token hf_*** --optimize_config_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat.yaml --cpu_infer 24
@Azure-Tang commented on GitHub (Feb 28, 2025):
改过yaml么,load的时候输出的日志显示是load到哪个device上了呢?
您具体的decode和prefill速度是多少;可以和ollama进行一次对比,如果确实是ollama的2~3倍说明只是您的驱动显示不准,换一个统计工具试一下。
@xiaohangguo commented on GitHub (Feb 28, 2025):
没有改yaml,就用的官方给出的V3的默认配置。日志是load到cuda:0,也就是这里的4090上。
您具体的decode和prefill速度是多少,这个我没测,但我感知上面就是纯cpu在跑,我一直在看GPU的利用率,始终是0,然后大概1-2分钟才出来一个token。
另外我从0~60层全部加载完要花费一个小时,不知道这个时间是否合理。
我怀疑就是GPU没有工作,但是不知道怎么debug。我可以尝试用小模型来debug,您有好的debug方案吗?
@ubergarm commented on GitHub (Feb 28, 2025):
@xiaohangguo
你指望在256GB系统内存中运行
unsloth/DeepSeek-R1-GGUF/DeepSeek-R1-Q4_K_M(377GB模型)能怎样?它居然能运行已经是mmap()的 功劳了。瓶颈在于你的磁盘驱动页缓存缓冲I/O——毕竟GPU根本无事可做,只能干等最高不过几GB/s的磁盘读写。可用
btop或iotop等工具检查磁盘I/O。建议改用
UD-Q2_K_XL量化版(212GB模型),它能轻松载入内存,在保证质量的同时获得可用速度。我自己就在用。祝好运!
xiaohangguo
What do you expect trying to run
unsloth/DeepSeek-R1-GGUF/DeepSeek-R1-Q4_K_M377GB model size in 256GB system RAM? It is amazing it works at all thanks tommap(). The bottleneck is your disk drive page cache buffered i/o. Of course the GPU is not doing any work waiting on a few GB/s disk drive at best.You can check disk i/o with
btoporiotopetc.I advise you use the
UD-Q2_K_XLquant at 212 GB model size it will fit comfortably in memory and you will get a usable speed with good quality. I use it myself.Good luck!
@xiaohangguo commented on GitHub (Mar 12, 2025):
我把内存加大了,现在成功了。