mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #928] per_layer_prefill_intput_threshold参数设置为非0都报错 #660
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#660
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 @riou-chen on GitHub (Mar 19, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/928
检查清单
问题描述
如题,per_layer_prefill_intput_threshold这个参数在yaml中,默认配置为0,但是修改为其他值,例如128,1024等都报错,请问这个参数是用来控制什么的?怎样使用它才能生效?
复现步骤
name: "^model$"
replace:
class: "ktransformers.operators.models.KDeepseekV2Model"
kwargs:
per_layer_prefill_intput_threshold: 1024 # 0 is close layer wise prefill
transfer_map:
30: "cuda:1"
类似于这样修改,会报self.up is None这种错误
环境信息
AMD 9A54+4090*2+1.5TDRAM
@Atream commented on GitHub (Mar 19, 2025):
此参数用于在输入prompt非常长时,将权重逐层转移到GPU上进行prefill,因为非常长的阈值很大,此功能有一段时间没有维护了,目前暂时通过设置0来禁用了。
@riou-chen commented on GitHub (Mar 19, 2025):
通过这种方法可以加速prefill吗?目前的版本0.2.3开启这个功能会报错,有哪个版本或者方法开启这个功能吗?
@Atream commented on GitHub (Mar 19, 2025):
只能在10K以上的prompt时加速prefill,目前我们不知道哪个版本可以开启此功能且能跑DeepSeek-V3/R1. 后续会修复此功能
@KingZypp0821 commented on GitHub (Apr 7, 2025):
是否意味着,配置文件中的 prefill_device: "cuda" prefill_op: "KExpertsTorch"其实实际并没有生效呢?我走读代码发现,虽然配置了KExpertsTorch,但是实际参数加载和推理过程中,并没有执行到其中的load和forward逻辑。 @Atream
@weiyongsen commented on GitHub (May 29, 2025):
应该是的,我看operators/models下的KDeepseekV2Model类中,设置不同层推理阶段是prefill还是generate的set_inference_mode函数只有load_layer_to()中有,但是per_layer_prefill_intput_threshold=0进不到这个load_layer_to()函数中。默认传的InferenceState好像都是Generate,只用到配置文件中的generate_op和generate_device,应该是这样吧。