Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DeepSeek-R1 Qwen #3431

Merged
merged 4 commits into from
Jan 29, 2025
Merged

Support DeepSeek-R1 Qwen #3431

merged 4 commits into from
Jan 29, 2025

Conversation

cebtenzzre
Copy link
Member

This PR adds DeepSeek-R1 Qwen support by:

  • Rebasing llama.cpp on a slightly newer upstream commit (ggml-org/llama.cpp@a39ab216a from Oct 2 instead of ggml-org/llama.cpp@95bc82fbc from Sep 26)
  • Cherry-picking the one-line change required to load the DeepSeek GGUF
  • Adding a prompt template substitution that doesn't rely on things like namespace and str.split which Jinja2Cpp doesn't implement
  • Implementing a regex_replace function compatible with others seen in the wild to support the necessary text manipulation in the DeepSeek template.

Tested on DeepSeek-R1 Qwen 7B. Will update with results with 14B and 32B soon.

Note that the replacement prompt template removes the {{ bos_token }} from the Jinja template to avoid a double BOS, since at least the bartowski GGUF I tried specifies tokenizer.ggml.add_bos_token of true already.

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
@cebtenzzre cebtenzzre marked this pull request as ready for review January 28, 2025 21:36
@cebtenzzre
Copy link
Member Author

cebtenzzre commented Jan 28, 2025

The 14B and 32B models also work as expected. All three models (7B, 14B, 32B) work on both CUDA and Kompute.
edit: Also tested 1.5B successfully.

@cebtenzzre cebtenzzre requested a review from manyoso January 28, 2025 21:40
@WuShichao
Copy link

How about Vulkan backend? I can ran CUDA with DeepSeek-R1-Distill-Llama-8B-Q4.

@manyoso manyoso merged commit 343a4b6 into main Jan 29, 2025
4 of 13 checks passed
cgivre pushed a commit to cgivre/gpt4all that referenced this pull request Feb 4, 2025
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
@cebtenzzre cebtenzzre deleted the deepseek-r1 branch February 10, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants