ktransformers icon indicating copy to clipboard operation
ktransformers copied to clipboard

Support for DeepseekV3 680B

Open sorasoras opened this issue 1 year ago • 113 comments

https://huggingface.co/deepseek-ai/DeepSeek-V3-Base well, that's a beast.

sorasoras avatar Dec 25 '24 16:12 sorasoras

+1

fengyang95 avatar Dec 26 '24 09:12 fengyang95

Does ktransformers depend on HF transformers support for a for a model arch? If so we are going to have to wait until DeepSeek-V3 supports HF transformers as it does not yet and I don't see a PR from the DeepSeek team yet.

Nottlespike avatar Dec 26 '24 23:12 Nottlespike

The ktransformer backend is an old commit of llama.cpp iirc

Edit: 6 months old https://github.com/ggerganov/llama.cpp/tree/a94e6ff8774b7c9f950d9545baf0ce35e8d1ed2f

ghost avatar Dec 27 '24 00:12 ghost

The ktransformer backend is an old commit of llama.cpp iirc

Edit: 6 months old https://github.com/ggerganov/llama.cpp/tree/a94e6ff8774b7c9f950d9545baf0ce35e8d1ed2f

Is it just me or is this not promising... I mean I'm patient but this means that transformers needs to support DeepSeek-V3 then llama.cpp needs to suppport DeepSeek-V3 then ktransformers needs to support llama.cpp's DeepSeek-V3 implementation....

Nottlespike avatar Dec 27 '24 00:12 Nottlespike

The ktransformer backend is an old commit of llama.cpp iirc

Edit: 6 months old https://github.com/ggerganov/llama.cpp/tree/a94e6ff8774b7c9f950d9545baf0ce35e8d1ed2f

Is it just me or is this not promising... I mean I'm patient but this means that transformers needs to support DeepSeek-V3 then llama.cpp needs to suppport DeepSeek-V3 then ktransformers needs to support llama.cpp's DeepSeek-V3 implementation....

I heard that it s not hard to support V3 on llama cpp due to been resemblance to v2

sorasoras avatar Dec 27 '24 07:12 sorasoras

The ktransformer backend is an old commit of llama.cpp iirc Edit: 6 months old https://github.com/ggerganov/llama.cpp/tree/a94e6ff8774b7c9f950d9545baf0ce35e8d1ed2f

Is it just me or is this not promising... I mean I'm patient but this means that transformers needs to support DeepSeek-V3 then llama.cpp needs to suppport DeepSeek-V3 then ktransformers needs to support llama.cpp's DeepSeek-V3 implementation....

I heard that it s not hard to support V3 on llama cpp due to been resemblance to v2

Sadly this is not the case in two ways. Firstly V3 from the technical report is far far more complex than V2. Second V2 never actually got a HF transformers implementation sadly only a stale draft PR. This is an issue that shows the problem in action https://github.com/huggingface/transformers/issues/34335 This is the stale attempt at V2 integration https://github.com/huggingface/transformers/pull/31976

Nottlespike avatar Dec 27 '24 09:12 Nottlespike

The ktransformer backend is an old commit of llama.cpp iirc Edit: 6 months old https://github.com/ggerganov/llama.cpp/tree/a94e6ff8774b7c9f950d9545baf0ce35e8d1ed2f

Is it just me or is this not promising... I mean I'm patient but this means that transformers needs to support DeepSeek-V3 then llama.cpp needs to suppport DeepSeek-V3 then ktransformers needs to support llama.cpp's DeepSeek-V3 implementation....

I heard that it s not hard to support V3 on llama cpp due to been resemblance to v2

Sadly this is not the case in two ways. Firstly V3 from the technical report is far far more complex than V2. Second V2 never actually got a HF transformers implementation sadly only a stale draft PR. This is an issue that shows the problem in action huggingface/transformers#34335 This is the stale attempt at V2 integration huggingface/transformers#31976

well. kt do support DS2 so it should be just a upgrade with next gen moe router

sorasoras avatar Dec 27 '24 17:12 sorasoras

The ktransformer backend is an old commit of llama.cpp iirc Edit: 6 months old https://github.com/ggerganov/llama.cpp/tree/a94e6ff8774b7c9f950d9545baf0ce35e8d1ed2f

Is it just me or is this not promising... I mean I'm patient but this means that transformers needs to support DeepSeek-V3 then llama.cpp needs to suppport DeepSeek-V3 then ktransformers needs to support llama.cpp's DeepSeek-V3 implementation....

I heard that it s not hard to support V3 on llama cpp due to been resemblance to v2

Sadly this is not the case in two ways. Firstly V3 from the technical report is far far more complex than V2. Second V2 never actually got a HF transformers implementation sadly only a stale draft PR. This is an issue that shows the problem in action huggingface/transformers#34335 This is the stale attempt at V2 integration huggingface/transformers#31976

well. kt do support DS2 so it should be just a upgrade with next gen moe router

What they do is use remote code. There is no native HF transformers implemenation. Feel free to find it if you think I am incorrect. If people wish to use this for enterprise deployment letting a model run what is functionally arbitrary code on your servers is 100% a no go like it is for my startup.

Nottlespike avatar Dec 27 '24 17:12 Nottlespike

+1

mahald avatar Dec 28 '24 06:12 mahald

+1

lzumot avatar Dec 29 '24 16:12 lzumot

Supporting this seems easy; however, it requires approximately 400g of RAM for even q4km?

Azure-Tang avatar Dec 30 '24 08:12 Azure-Tang

Supporting this seems easy; however, it requires approximately 400g of RAM for even q4km?

Does ktransformers not need transformers or llama.cpp support for a a model? https://github.com/huggingface/transformers/issues/35425 Back of the napkin math is more like 5XXGB of VRAM/RAM would be needed given context.

Nottlespike avatar Dec 30 '24 11:12 Nottlespike

Supporting this seems easy; however, it requires approximately 400g of RAM for even q4km?

Does ktransformers not need transformers or llama.cpp support for a a model? huggingface/transformers#35425 Back of the napkin math is more like 5XXGB of VRAM/RAM would be needed given context.

Yes, we need transformers‘ modeling.py.

Azure-Tang avatar Dec 31 '24 07:12 Azure-Tang

Just spitballing. Would it be possible to do some speculative decoding with a smaller model (dense or moe) and then on the larger moe just use nvme for some of the experts? Why do we need all experts loaded into ram at all times instead of selecting experts as necessary?

Again just throwing an idea out there from where my understanding is at. I'd like to understand better why this would not work.

16x3b avatar Dec 31 '24 14:12 16x3b

Just spitballing. Would it be possible to do some speculative decoding with a smaller model (dense or moe) and then on the larger moe just use nvme for some of the experts? Why do we need all experts loaded into ram at all times instead of selecting experts as necessary?

Again just throwing an idea out there from where my understanding is at. I'd like to understand better why this would not work.

why would you need smaller model speculative decoding when you can do it via MTP?

sorasoras avatar Jan 01 '25 11:01 sorasoras

@Azure-Tang We are basically done with integrating DeepSeek-V3 into llama.cpp via a very very elegant solution from @fairydreaming
https://github.com/ggerganov/llama.cpp/issues/10981#issuecomment-2568349563 Can you see if you can try what they did?

Nottlespike avatar Jan 02 '25 20:01 Nottlespike

For those looking for an update on this I've to forked it and I think I know how to get this working but no ETA.

Nottlespike avatar Jan 06 '25 23:01 Nottlespike

Supporting this seems easy; however, it requires approximately 400g of RAM for even q4km?

I manage to fit in Q3_K_M quant within 96GB VRAM + 256GB RAM. Q4_K_M is out of my reach.

ELigoP avatar Jan 09 '25 14:01 ELigoP

Supporting this seems easy; however, it requires approximately 400g of RAM for even q4km?

I manage to fit in Q3_K_M quant within 96GB VRAM + 256GB RAM. Q4_K_M is out of my reach.

Wow. Great news. What would be the mininum specs to be able to run a Q4_K_M with 96 GB VRAM? 512 GB of RAM plus that VRAM would be enough? I have that much VRAM but I will upgrade my RAM for that. Thanks!

hvico avatar Jan 09 '25 14:01 hvico

why would you need smaller model speculative decoding when you can do it via MTP?

I don't see how MTP helps me. I'm suggesting speculative decoding because we can get faster inference from a smaller model and only refer to the larger model if confidence is low. No need to call the large model if the small one has a confident answer.

16x3b avatar Jan 12 '25 10:01 16x3b