mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #50] How to properly disable offloading MoE layers to CPU? #27
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#27
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 @molamooo on GitHub (Aug 21, 2024).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/50
@Azure-Tang commented on GitHub (Aug 22, 2024):
Regarding your question on disabling the offloading of MoE layers to the CPU, I’ve provided a brief explanation in my earlier response (#46 ). Please take a look there for detailed instructions.
@molamooo commented on GitHub (Aug 22, 2024):
I tried using custom rule file to put all layers on GPU, but KTransformer triggers oom when dequantizing parameters. I use a 24GB 4090 to run deepseek-v2-lite-chat with q8_0 quantization. It should only takes ~16GB memory. Other systems like llama.cpp can run without issue.
@ELigoP commented on GitHub (Aug 22, 2024):
This is hardly possible.
What is your model size? With q8 quantization it should be >200 GB. If you
no wonder it OOMs. Llama.cpp automatically offloads layers in to CPU suboptimal way. If you force it to offload everything to GPU it will also OOM.
E.g. with my setup I get 7.5 tps with suboptimal llama.cpp CPU offload and 9 tps with ktransformers (even that it utilizies VRAM suboptimally).
@molamooo commented on GitHub (Aug 22, 2024):
I mentioned that I use deepseek-v2-lite-chat, which is a 16B model. It shouldn't oom.
@Azure-Tang commented on GitHub (Aug 22, 2024):
I see, if you are using KExpertsTorch as backend, it will dequant the weights to model's default dtype, for deepseek this is bf16. So this is why it oom. Maybe you can try marlin backend? But we didn't optimise this operator in generate phase.