How to enable optimize rules?
There are already some optimize_rules for DeepSeek-R1/V3 in the latest v0.2 Release.
root@ccd23aad1a14:/usr/local/lib/python3.11/dist-packages/ktransformers/optimize# ll optimize_rules/
total 72
drwxr-xr-x 2 root root 4096 Feb 12 13:01 ./
drwxr-xr-x 4 root root 82 Feb 12 16:33 ../
-rw-r--r-- 1 root root 8158 Feb 12 13:01 DeepSeek-V2-Chat-multi-gpu-4.yaml
-rw-r--r-- 1 root root 4231 Feb 12 13:01 DeepSeek-V2-Chat-multi-gpu.yaml
-rw-r--r-- 1 root root 1946 Feb 12 13:01 DeepSeek-V2-Chat.yaml
-rw-r--r-- 1 root root 4141 Feb 12 13:01 DeepSeek-V2-Lite-Chat-multi-gpu.yaml
-rw-r--r-- 1 root root 1946 Feb 12 13:01 DeepSeek-V2-Lite-Chat.yaml
-rw-r--r-- 1 root root 4824 Feb 12 13:01 DeepSeek-V3-Chat-multi-gpu-marlin.yaml
-rw-r--r-- 1 root root 4824 Feb 12 13:01 DeepSeek-V3-Chat-multi-gpu.yaml
-rw-r--r-- 1 root root 2155 Feb 12 13:01 DeepSeek-V3-Chat.yaml
-rw-r--r-- 1 root root 771 Feb 12 13:01 Internlm2_5-7b-Chat-1m.yaml
-rw-r--r-- 1 root root 1495 Feb 12 13:01 Mixtral.yaml
-rw-r--r-- 1 root root 3779 Feb 12 13:01 Qwen2-57B-A14B-Instruct-multi-gpu.yaml
-rw-r--r-- 1 root root 1923 Feb 12 13:01 Qwen2-57B-A14B-Instruct.yaml
But it seems like they are not enabled since my second GPU is not used. I've read the Injection tutorial and other relevant issues , but still confused about how to enable the rules.
So by the way, which optimize_rule can be used for DeepSeek-R1 ? 😂 I am quite confused when I want to run a local DeepSeek-R1 but I cannot find proper rule file 😂
So by the way, which
optimize_rulecan be used for DeepSeek-R1 ? 😂 I am quite confused when I want to run a local DeepSeek-R1 but I cannot find proper rule file 😂
you can specify the --optimize_rule_path arg (for local_chat.py). We have set default rule path, but you can switch to a new or even customize yours. See optional files [here] (https://github.com/kvcache-ai/ktransformers/tree/main/ktransformers/optimize/optimize_rules)
So by the way, which
optimize_rulecan be used for DeepSeek-R1 ? 😂 I am quite confused when I want to run a local DeepSeek-R1 but I cannot find proper rule file 😂you can specify the
--optimize_rule_patharg (for local_chat.py). We have set default rule path, but you can switch to a new or even customize yours. See optional files [here] (https://github.com/kvcache-ai/ktransformers/tree/main/ktransformers/optimize/optimize_rules)
😂 Thanks a lot for your reply. Well, I still don't find any filename contain "DeepSeek-R1" . Do you mean that I can just use like DeepSeek-V3-Chat.yaml for DeepSeek-R1? That seems a bit weird 😂 I guess I need to replace some name of some class in it?
我是cli运行的,应该使用哪个优化规则文件
python -m ktransformers.local_chat --model_path deepseek-ai/DeepSeek-R1 --gguf_path ./gguf_file --optimize_rule_path /home/user/app/ktransformers/ktransformers/optimize/optimize_rules
So by the way, which
optimize_rulecan be used for DeepSeek-R1 ? 😂 I am quite confused when I want to run a local DeepSeek-R1 but I cannot find proper rule file 😂you can specify the
--optimize_rule_patharg (for local_chat.py). We have set default rule path, but you can switch to a new or even customize yours. See optional files [here] (https://github.com/kvcache-ai/ktransformers/tree/main/ktransformers/optimize/optimize_rules)😂 Thanks a lot for your reply. Well, I still don't find any filename contain "DeepSeek-R1" . Do you mean that I can just use like
DeepSeek-V3-Chat.yamlfor DeepSeek-R1? That seems a bit weird 😂 I guess I need to replace some name of someclassin it?
the same question. Can anyone give DeepSeek-R1.yaml? I use DeepSeek-R1-Distill-Qwen-7B model
So by the way, which
optimize_rulecan be used for DeepSeek-R1 ? 😂 I am quite confused when I want to run a local DeepSeek-R1 but I cannot find proper rule file 😂you can specify the
--optimize_rule_patharg (for local_chat.py). We have set default rule path, but you can switch to a new or even customize yours. See optional files [here] (https://github.com/kvcache-ai/ktransformers/tree/main/ktransformers/optimize/optimize_rules)😂 Thanks a lot for your reply. Well, I still don't find any filename contain "DeepSeek-R1" . Do you mean that I can just use like
DeepSeek-V3-Chat.yamlfor DeepSeek-R1? That seems a bit weird 😂 I guess I need to replace some name of someclassin it?the same question. Can anyone give DeepSeek-R1.yaml? I use DeepSeek-R1-Distill-Qwen-7B model
seems that ktransformers do not ever support qwen model
So by the way, which
optimize_rulecan be used for DeepSeek-R1 ? 😂 I am quite confused when I want to run a local DeepSeek-R1 but I cannot find proper rule file 😂you can specify the
--optimize_rule_patharg (for local_chat.py). We have set default rule path, but you can switch to a new or even customize yours. See optional files [here] (https://github.com/kvcache-ai/ktransformers/tree/main/ktransformers/optimize/optimize_rules)😂 Thanks a lot for your reply. Well, I still don't find any filename contain "DeepSeek-R1" . Do you mean that I can just use like
DeepSeek-V3-Chat.yamlfor DeepSeek-R1? That seems a bit weird 😂 I guess I need to replace some name of someclassin it?
Yes, you just need to use DeepSeek-V3-Chat.yaml as v3 and r1's architectures are the same.
我用了一台4卡的A40(4*A40),我的命令: python ./ktransformers/local_chat.py --model_path /nas_data/DeepSeek-R1/ --gguf_path /nas_data/DeepSeek-R1-GGUF/DeepSeek-R1-Q8_0/ --force_think true --cpu_infer 65 --max_new_tokens 4096 --optimize_rule_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-multi-gpu-4.yaml,但是结果还是只启动了一张GPU,为什么?还有什么参数需要修改吗
我用了一台4卡的A40(4*A40),我的命令: python ./ktransformers/local_chat.py --model_path /nas_data/DeepSeek-R1/ --gguf_path /nas_data/DeepSeek-R1-GGUF/DeepSeek-R1-Q8_0/ --force_think true --cpu_infer 65 --max_new_tokens 4096 --optimize_rule_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-multi-gpu-4.yaml,但是结果还是只启动了一张GPU,为什么?还有什么参数需要修改吗
目前这个参数名称改为了 --optimize_cofig_path, 你可以在这里看到它的名称
我用了一台4卡的A40(4*A40),我的命令: python ./ktransformers/local_chat.py --model_path /nas_data/DeepSeek-R1/ --gguf_path /nas_data/DeepSeek-R1-GGUF/DeepSeek-R1-Q8_0/ --force_think true --cpu_infer 65 --max_new_tokens 4096 --optimize_rule_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-multi-gpu-4.yaml,但是结果还是只启动了一张GPU,为什么?还有什么参数需要修改吗
目前这个参数名称改为了 --optimize_cofig_path, 你可以在这里看到它的名称
感谢回复,改了参数之后可以看到启动了4张GPU,但是好像每个GPU上加载的显存变成了原来的1/4,对于我的int8版本的模型来说,还是空间不够,请问有什么办法可以增大模型加载到GPU显存上吗?
我用了一台4卡的A40(4*A40),我的命令: python ./ktransformers/local_chat.py --model_path /nas_data/DeepSeek-R1/ --gguf_path /nas_data/DeepSeek-R1-GGUF/DeepSeek-R1-Q8_0/ --force_think true --cpu_infer 65 --max_new_tokens 4096 --optimize_rule_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-multi-gpu-4.yaml,但是结果还是只启动了一张GPU,为什么?还有什么参数需要修改吗
目前这个参数名称改为了 --optimize_cofig_path, 你可以在这里看到它的名称
感谢回复,改了参数之后可以看到启动了4张GPU,但是好像每个GPU上加载的显存变成了原来的1/4,对于我的int8版本的模型来说,还是空间不够,请问有什么办法可以增大模型加载到GPU显存上吗?
可以修改yaml里面具体的每个模块的的计算方式,以及对应的设备,这个教程参考在这里