mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #890] [Bug] 0ut of memory: Killed process 2583(python) #643
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#643
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 @qufujun on GitHub (Mar 14, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/890
检查清单
问题描述
加载DeepSeek-R1-Q4_K_M量化文件gguf的时候报错,之前512G内存的时候,加载到blk23的时候就内存溢出,后来增加到1T内存的时候,加载到blk42的时候还是报内存溢出,错误描述:
0ut of memory: Killed process 2583(python)
tal-ym:1481207384kB,anon-rss:1044530552kB,file-rss:2335124kB, shmem-rss:46
72kB,UID:0 pgtables:2593200kB oom score adj:0
oom reaper: reaped process 2583(python),now
anon-rss:0kB,file-rss:64784kB.
shmem-rss:4672kB
复现步骤
git clone https://github.com/kvcache-ai/ktransformers.git
cd ktransformers
git submodule init
git submodule update
export USE_NUMA=1
make dev_install # or sh ./install.sh
python ./ktransformers/local_chat.py --model_path /root/DeepSeek-R1/ --gguf_path /root/DeepSeek-R1/DeepSeek-R1-Q4_K_M/ --cpu_infer 65 --max_new_tokens 1000
环境信息
环境是:
OS:Ubuntu 22.04 LTS
CPU:INTEL(R) XEON(R) GOLD 6530 * 2
MEMORY:1TB DDR5 4800MHz
GPU:GTX 3090 24G
nvcc:
Cuda compilation tools, release 12.6, V12.6.85
Build cuda_12.6.r12.6/compiler.35059454_0
VIDIA-SMI 570.124.06 Driver Version: 570.124.06 CUDA Version: 12.8
Name: ktransformers
Version: 0.2.3.post1+cu126torch26fancy
@Atream commented on GitHub (Mar 15, 2025):
After enabling USE_NUMA, double the memory space is required. Through actual testing, it has been confirmed that a system with 1TB of memory can run normally. Additionally, mmap will occupy a portion of the memory. It is recommended to check the system settings related to mmap. Future versions will further optimize memory usage, and systems with multiple NUMA nodes will no longer require larger memory.
开启USE_NUMA后需要两倍的内存空间,经实际测试,1T内存是可以正常运行的,同时还会有mmap占据部分内存,建议检查系统有关mmap的设置。后续版本会进一步优化内存占用,多numa不再需要更大的内存。
@merries711 commented on GitHub (Mar 15, 2025):
如何检查mmap设置,网上的资料基本都是提及mmap()函数和原理。
重启系统后,内存使用1.8GB左右,空闲1020GB左右,
运行双插槽install.sh后的ktransformers(0.2.3.post1+cu126torch26fancy)
加载gguf的时候,感觉很异常,速度很慢。
在同样的硬件软件环境下,使用单插槽的方式进行install.sh后,加载guff就正常,模型可以正常运行。
双插槽安装之前,USR_NUMA变量已经正确设置,libnuma-dev也提前安装好了。
$ apt list --installed | grep libnuma
libnuma-dev/jammy,now 2.0.14-3ubuntu2 amd64 [installed]
libnuma1/jammy,now 2.0.14-3ubuntu2 amd64 [installed,automatic]
numactl -Hardware 显示系统有4个 NUMA node(s) ,每个node 大概分配了252GB内存,
不知道是不是这个原因导致的,kt为每个NUMA node加载全部的模型文件?
@FrySong commented on GitHub (Mar 21, 2025):
应该是的, 我是INTEL(R) XEON(R) PLATINUM 8581C, 有4个节点, 配了1T的5600 DRAM, 也是疯狂被爆内存.
@SugarmanZhu commented on GitHub (Apr 8, 2025):
把NUMA Node减少到两个就可以了
Intel CPU可以在BIOS里关掉NUMA Sub Cluster