[GH-ISSUE #212] 500G内存只用了18G #129

Closed
opened 2026-10-29 14:34:36 +00:00 by bsakaguchi · 14 comments
Owner

Originally created by @lymanzhao on GitHub (Feb 13, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/212

500G内存
志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。

但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。

安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl

命令:
python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60

Originally created by @lymanzhao on GitHub (Feb 13, 2025). Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/212 500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。 但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。 安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl 命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60
Author
Owner

@murongweibo commented on GitHub (Feb 13, 2025):

500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。

但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。

安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl

命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60

你这个用什么gpu?我的报了错

RuntimeError: CUDA error: invalid device function
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
<!-- gh-comment-id:2655736172 --> @murongweibo commented on GitHub (Feb 13, 2025): > 500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。 > > 但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。 > > 安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl > > 命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60 你这个用什么gpu?我的报了错 ``` RuntimeError: CUDA error: invalid device function CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1 Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions. ```
Author
Owner

@shuchong commented on GitHub (Feb 13, 2025):

500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。
但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。
安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl
命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60

你这个用什么gpu?我的报了错

RuntimeError: CUDA error: invalid device function
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

这个报错是不是和卡有关系,我使用v100也有这个报错

<!-- gh-comment-id:2655737994 --> @shuchong commented on GitHub (Feb 13, 2025): > > 500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。 > > 但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。 > > 安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl > > 命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60 > > 你这个用什么gpu?我的报了错 > > ``` > RuntimeError: CUDA error: invalid device function > CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. > For debugging consider passing CUDA_LAUNCH_BLOCKING=1 > Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions. > ``` 这个报错是不是和卡有关系,我使用v100也有这个报错
Author
Owner

@lymanzhao commented on GitHub (Feb 13, 2025):

500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。
但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。
安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl
命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60

你这个用什么gpu?我的报了错

RuntimeError: CUDA error: invalid device function
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

我是4090,你这个看着是torch的问题,检查是不是版本问题呢

<!-- gh-comment-id:2655780775 --> @lymanzhao commented on GitHub (Feb 13, 2025): > > 500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。 > > 但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。 > > 安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl > > 命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60 > > 你这个用什么gpu?我的报了错 > > ``` > RuntimeError: CUDA error: invalid device function > CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. > For debugging consider passing CUDA_LAUNCH_BLOCKING=1 > Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions. > ``` 我是4090,你这个看着是torch的问题,检查是不是版本问题呢
Author
Owner

@Xxianna commented on GitHub (Feb 13, 2025):

同,加载deepseek r1 q4km后只有大概15g内存和15g显存占用
但是加载过程产生了巨大的cache

<!-- gh-comment-id:2655798881 --> @Xxianna commented on GitHub (Feb 13, 2025): 同,加载deepseek r1 q4km后只有大概15g内存和15g显存占用 但是加载过程产生了巨大的cache
Author
Owner

@futureltj commented on GitHub (Feb 13, 2025):

同样的情况,推理速度很慢。有解吗?

<!-- gh-comment-id:2655808660 --> @futureltj commented on GitHub (Feb 13, 2025): 同样的情况,推理速度很慢。有解吗?
Author
Owner

@shiontao commented on GitHub (Feb 13, 2025):

500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。
但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。
安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl
命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60

你这个用什么gpu?我的报了错

RuntimeError: CUDA error: invalid device function
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

这个报错是不是和卡有关系,我使用v100也有这个报错

一样的,应该是架构太老了的原因

<!-- gh-comment-id:2655870993 --> @shiontao commented on GitHub (Feb 13, 2025): > > > 500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。 > > > 但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。 > > > 安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl > > > 命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60 > > > > > > 你这个用什么gpu?我的报了错 > > ``` > > RuntimeError: CUDA error: invalid device function > > CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. > > For debugging consider passing CUDA_LAUNCH_BLOCKING=1 > > Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions. > > ``` > > 这个报错是不是和卡有关系,我使用v100也有这个报错 一样的,应该是架构太老了的原因
Author
Owner

@murongweibo commented on GitHub (Feb 13, 2025):

500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。
但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。
安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl
命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60

你这个用什么gpu?我的报了错

RuntimeError: CUDA error: invalid device function
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

这个报错是不是和卡有关系,我使用v100也有这个报错

应该是卡的框架原因,我这里用的谷歌colab里面的分的T4,我看别人说V100也不行

<!-- gh-comment-id:2655984068 --> @murongweibo commented on GitHub (Feb 13, 2025): > > > 500G内存 志强CPU,单卡运行,速度还可以8 token每秒,使用了2.5量化模型。 > > > 但只有18g内存用到,猜测需要开启内存载入,同样情况我在llama cpp上遇到过,解决了,但似乎对ktransformers无效。 > > > 安装软件:ktransformers-0.2.0+cu124torch24avx2-cp311-cp311-linux_x86_64.whl > > > 命令: python -m ktransformers.local_chat --model_path "/mnt/data/deepseek/DeepSeek-R1/" --gguf_path "/mnt/data/deepseek/DeepSeek-R1-GGUF/DeepSeek-R1-UD-Q2_K_XL/" --force_think true --cpu_infer 60 > > > > > > 你这个用什么gpu?我的报了错 > > ``` > > RuntimeError: CUDA error: invalid device function > > CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. > > For debugging consider passing CUDA_LAUNCH_BLOCKING=1 > > Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions. > > ``` > > 这个报错是不是和卡有关系,我使用v100也有这个报错 应该是卡的框架原因,我这里用的谷歌colab里面的分的T4,我看别人说V100也不行
Author
Owner

@ipfgao commented on GitHub (Feb 13, 2025):

同,加载deepseek r1 q4km后只有大概15g内存和15g显存占用 但是加载过程产生了巨大的cache

这样的话,不用32g内存也有希望运行deepseek r1 q4km了?

<!-- gh-comment-id:2656667367 --> @ipfgao commented on GitHub (Feb 13, 2025): > 同,加载deepseek r1 q4km后只有大概15g内存和15g显存占用 但是加载过程产生了巨大的cache 这样的话,不用32g内存也有希望运行deepseek r1 q4km了?
Author
Owner

@lymanzhao commented on GitHub (Feb 13, 2025):

同,加载deepseek r1 q4km后只有大概15g内存和15g显存占用 但是加载过程产生了巨大的cache

这样的话,不用32g内存也有希望运行deepseek r1 q4km了?

你满足这点速度吗,这是硬盘缓存限制速度

<!-- gh-comment-id:2656775365 --> @lymanzhao commented on GitHub (Feb 13, 2025): > > 同,加载deepseek r1 q4km后只有大概15g内存和15g显存占用 但是加载过程产生了巨大的cache > > 这样的话,不用32g内存也有希望运行deepseek r1 q4km了? 你满足这点速度吗,这是硬盘缓存限制速度
Author
Owner

@lymanzhao commented on GitHub (Feb 14, 2025):

top可以看到真实使用情况

<!-- gh-comment-id:2658644603 --> @lymanzhao commented on GitHub (Feb 14, 2025): top可以看到真实使用情况
Author
Owner

@allendred commented on GitHub (Feb 22, 2025):

vmvare虚拟机单cpu6530 cpu 占用30% 内存共1t只占用7g
这样速度
prompt eval count: 9 token(s)
prompt eval duration: 1.7904412746429443s
prompt eval rate: 5.026693769553994 tokens/s
eval count: 734 token(s)
eval duration: 158.81343626976013s
eval rate: 4.621775192580238 tokens/s

<!-- gh-comment-id:2676048448 --> @allendred commented on GitHub (Feb 22, 2025): vmvare虚拟机单cpu6530 cpu 占用30% 内存共1t只占用7g 这样速度 prompt eval count: 9 token(s) prompt eval duration: 1.7904412746429443s prompt eval rate: 5.026693769553994 tokens/s eval count: 734 token(s) eval duration: 158.81343626976013s eval rate: 4.621775192580238 tokens/s
Author
Owner

@Xxianna commented on GitHub (Feb 22, 2025):

现在好了,768g内存用了740g。好像是两个numa上各保留了权重镜像。速度是快了😋

<!-- gh-comment-id:2676217653 --> @Xxianna commented on GitHub (Feb 22, 2025): 现在好了,768g内存用了740g。好像是两个numa上各保留了权重镜像。速度是快了😋
Author
Owner

@allendred commented on GitHub (Feb 22, 2025):

现在好了,768g内存用了740g。好像是两个numa上各保留了权重镜像。速度是快了😋

求教怎么解决的

<!-- gh-comment-id:2676241542 --> @allendred commented on GitHub (Feb 22, 2025): > 现在好了,768g内存用了740g。好像是两个numa上各保留了权重镜像。速度是快了😋 求教怎么解决的
Author
Owner

@Xxianna commented on GitHub (Mar 1, 2025):

安装libnuma-dev再重新编译

<!-- gh-comment-id:2692110355 --> @Xxianna commented on GitHub (Mar 1, 2025): 安装libnuma-dev再重新编译
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/ktransformers#129
No description provided.