mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #156] DeepSeek-R1-Q4_K_M throwing KeyError: 'blk.0.attn_q_a.weight' #86
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#86
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 @hetong007 on GitHub (Feb 12, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/156
I compiled
ktransformersfollowing https://github.com/kvcache-ai/ktransformers/blob/main/doc/en/DeepseekR1_V3_tutorial.md#v02-showcase. GGUF downloaded from https://huggingface.co/bartowski/DeepSeek-R1-GGUF/tree/main/DeepSeek-R1-Q4_K_M.Env: python 3.11, cuda 12.4, ubuntu 22.04
Is there something on my side to fix?
@KMSorSMS commented on GitHub (Feb 12, 2025):
Seems, it has blk.0.attn_q_a.weight in the gguf. You can check if your cached gguf file is correct (by check the hash number). You can also redownload it.
@hetong007 commented on GitHub (Feb 12, 2025):
Thanks for the quick reply! Indeed.
I fixed the gguf file, and the original error was gone. However it seems to by-default offload all weights into GPU and reported CUDA out of memory error:
I briefly looked at the script, seems it loads some config from
ktransformers/optimize/optimize_rules/*.yaml. Can I assume these config files needs to be modified locally (and carefully) to achieve best CPU/GPU balance? My hardware is multi-GPU with 8x48G VRAM. A pointer to a detail documentation is also appreciated, thanks!@KMSorSMS commented on GitHub (Feb 12, 2025):
This is abnormal. In fact we offload the weight of experts to CPU ( this process doesn't print out the log). So I guess if there is other process on your device use GPU? We only need 16G VRAM for Q4.
Furthermore, if you want to use multi GPU, you can set the arg:
--optimize_rule_path <the path of ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-multi-gpu.yaml>. And also you can modify the yml file to fit your case (most of time modify it like change KLinearMarlin to KLinearTorch if your GPU is too old to support marlin or offload some experts layer to GPU if you don't have DRAM larger than 382G ).@hetong007 commented on GitHub (Feb 12, 2025):
BTW it might be that the layers are not named exactly as the matching rules in yamls. Would you please provide the source of your Q4 model files? I can double check if there's a discrepancy.
@KMSorSMS commented on GitHub (Feb 12, 2025):
Sure:http://huggingface.co/unsloth/DeepSeek-R1-GGUF/tree/main/DeepSeek-R1-Q4_K_M
@hetong007 commented on GitHub (Feb 12, 2025):
I've got it resolved -- turned out to be other process taking GPU RAM. I compared 1 or 2 GPU's speed, they are similarly with impressive speed at 10 tokens/sec. This is about the same speed I achieve with dynamic quantization across all 8 GPUs.
Thanks for this great work!