[GH-ISSUE #8502] Requesting support for DeepSeek-R1-Distill series models #51991

Closed
opened 2026-04-28 21:30:59 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @CberYellowstone on GitHub (Jan 20, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8502

Image
source: https://github.com/deepseek-ai/DeepSeek-R1#deepseek-r1-distill-models

Originally created by @CberYellowstone on GitHub (Jan 20, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8502 ![Image](https://github.com/user-attachments/assets/1c499601-0c22-45bc-970a-1b74648f43d5) source: https://github.com/deepseek-ai/DeepSeek-R1#deepseek-r1-distill-models
GiteaMirror added the model label 2026-04-28 21:30:59 -05:00
Author
Owner

@Dango233 commented on GitHub (Jan 20, 2025):

https://github.com/ggerganov/llama.cpp/pull/11310
upstream llama.cpp support merged!

<!-- gh-comment-id:2602734137 --> @Dango233 commented on GitHub (Jan 20, 2025): https://github.com/ggerganov/llama.cpp/pull/11310 upstream llama.cpp support merged!
Author
Owner

@rick-github commented on GitHub (Jan 20, 2025):

https://ollama.com/library/deepseek-r1

<!-- gh-comment-id:2603227565 --> @rick-github commented on GitHub (Jan 20, 2025): https://ollama.com/library/deepseek-r1
Author
Owner

@tbiehn commented on GitHub (Jan 21, 2025):

DeepSeek R1 templates have an interesting quirk where they drop previously used <think> blocks.
Support for this type of logic is in my PR: #8511

For ref an auto-translated template for DeepSeek R1 Distill Qwen is;

TEMPLATE """
{{- $is_first := false -}}
{{- $is_tool := false -}}
{{- $is_output_first := true -}}
{{- $system_prompt := "" -}}

{{/* Capture any system message from .Messages */}}
{{- range $i, $msg := .Messages }}
  {{- if eq $msg.Role "system" }}
    {{- $system_prompt = $msg.Content -}}
  {{- end -}}
{{- end -}}
{{ $system_prompt }}
{{- /* Iterate over user/assistant/tool messages to replicate Qwen’s special tokens */ -}}
{{- range $i, $msg := .Messages }}

  {{- if eq $msg.Role "user" }}
    {{- $is_tool = false -}}
    <|User|>{{ $msg.Content }}

  {{- else if and (eq $msg.Role "assistant") (eq $msg.Content "") }}
    {{- /* No content means we’re displaying tool calls */ -}}
    {{- $is_tool = false -}}
    {{- if $msg.ToolCalls }}
      {{- range $j, $tool := $msg.ToolCalls }}
        {{- if not $is_first }}
<|Assistant|><|tool▁calls▁begin|><|tool▁call▁begin|>{{ $tool.Type }}<|tool▁sep|>{{ $tool.Function.Name }}
```json
{{ $tool.Function.Arguments }}
```
<|tool▁call▁end|>
          {{- $is_first = true -}}
        {{- else }}
<|tool▁call▁begin|>{{ $tool.Type }}<|tool▁sep|>{{ $tool.Function.Name }}
```json
{{ $tool.Function.Arguments }}
```
<|tool▁call▁end|><|tool▁calls▁end|><|end▁of▁sentence|>
        {{- end }}
      {{- end }}
    {{- end }}

  {{- else if eq $msg.Role "assistant" }}
    {{- if $is_tool }}
<|tool▁outputs▁end|>{{ $msg.Content }}<|end▁of▁sentence|>
      {{- $is_tool = false -}}
    {{- else }}
      {{- $content := $msg.Content -}}
      {{- /* Only strip chain-of-thought if we detect `</think>` via `contains` */ -}}
      {{- if (contains $content "</think>") }}
        {{- $parts := split $content "</think>" -}}
        {{- if gt (len $parts) 1 }}
          {{- $content = index $parts 1 -}}
        {{- end }}
      {{- end }}
<|Assistant|>{{ $content }}<|end▁of▁sentence|>
    {{- end }}

  {{- else if eq $msg.Role "tool" }}
    {{- /* Tool messages => <|tool▁outputs▁begin|> blocks */ -}}
    {{- if not $is_tool }}
      {{- $is_tool = true -}}
      {{- if $is_output_first }}
<|tool▁outputs▁begin|><|tool▁output▁begin|>{{ $msg.Content }}<|tool▁output▁end|>
        {{- $is_output_first = false -}}
      {{- else }}
\n<|tool▁output▁begin|>{{ $msg.Content }}<|tool▁output▁end|>
      {{- end }}
    {{- else }}
\n<|tool▁output▁begin|>{{ $msg.Content }}<|tool▁output▁end|>
    {{- end }}
  {{- end }}

{{- end }}

{{- /* If a tool block is still open, close it */ -}}
{{- if $is_tool }}
<|tool▁outputs▁end|>
{{- end }}
<|Assistant|>
"""
<!-- gh-comment-id:2603424599 --> @tbiehn commented on GitHub (Jan 21, 2025): DeepSeek R1 templates have an interesting quirk where they drop previously used `<think>` blocks. Support for this type of logic is in my PR: #8511 For ref an auto-translated template for DeepSeek R1 Distill Qwen is; ```` TEMPLATE """ {{- $is_first := false -}} {{- $is_tool := false -}} {{- $is_output_first := true -}} {{- $system_prompt := "" -}} {{/* Capture any system message from .Messages */}} {{- range $i, $msg := .Messages }} {{- if eq $msg.Role "system" }} {{- $system_prompt = $msg.Content -}} {{- end -}} {{- end -}} {{ $system_prompt }} {{- /* Iterate over user/assistant/tool messages to replicate Qwen’s special tokens */ -}} {{- range $i, $msg := .Messages }} {{- if eq $msg.Role "user" }} {{- $is_tool = false -}} <|User|>{{ $msg.Content }} {{- else if and (eq $msg.Role "assistant") (eq $msg.Content "") }} {{- /* No content means we’re displaying tool calls */ -}} {{- $is_tool = false -}} {{- if $msg.ToolCalls }} {{- range $j, $tool := $msg.ToolCalls }} {{- if not $is_first }} <|Assistant|><|tool▁calls▁begin|><|tool▁call▁begin|>{{ $tool.Type }}<|tool▁sep|>{{ $tool.Function.Name }} ```json {{ $tool.Function.Arguments }} ``` <|tool▁call▁end|> {{- $is_first = true -}} {{- else }} <|tool▁call▁begin|>{{ $tool.Type }}<|tool▁sep|>{{ $tool.Function.Name }} ```json {{ $tool.Function.Arguments }} ``` <|tool▁call▁end|><|tool▁calls▁end|><|end▁of▁sentence|> {{- end }} {{- end }} {{- end }} {{- else if eq $msg.Role "assistant" }} {{- if $is_tool }} <|tool▁outputs▁end|>{{ $msg.Content }}<|end▁of▁sentence|> {{- $is_tool = false -}} {{- else }} {{- $content := $msg.Content -}} {{- /* Only strip chain-of-thought if we detect `</think>` via `contains` */ -}} {{- if (contains $content "</think>") }} {{- $parts := split $content "</think>" -}} {{- if gt (len $parts) 1 }} {{- $content = index $parts 1 -}} {{- end }} {{- end }} <|Assistant|>{{ $content }}<|end▁of▁sentence|> {{- end }} {{- else if eq $msg.Role "tool" }} {{- /* Tool messages => <|tool▁outputs▁begin|> blocks */ -}} {{- if not $is_tool }} {{- $is_tool = true -}} {{- if $is_output_first }} <|tool▁outputs▁begin|><|tool▁output▁begin|>{{ $msg.Content }}<|tool▁output▁end|> {{- $is_output_first = false -}} {{- else }} \n<|tool▁output▁begin|>{{ $msg.Content }}<|tool▁output▁end|> {{- end }} {{- else }} \n<|tool▁output▁begin|>{{ $msg.Content }}<|tool▁output▁end|> {{- end }} {{- end }} {{- end }} {{- /* If a tool block is still open, close it */ -}} {{- if $is_tool }} <|tool▁outputs▁end|> {{- end }} <|Assistant|> """ ````
Author
Owner

@olumolu commented on GitHub (Jan 21, 2025):

https://huggingface.co/deepseek-ai/DeepSeek-R1-Zero
https://huggingface.co/deepseek-ai/DeepSeek-R1
R1 and zero support please

<!-- gh-comment-id:2603530714 --> @olumolu commented on GitHub (Jan 21, 2025): https://huggingface.co/deepseek-ai/DeepSeek-R1-Zero https://huggingface.co/deepseek-ai/DeepSeek-R1 R1 and zero support please
Author
Owner

@Shiven-saini commented on GitHub (Jan 21, 2025):

R1 support is already provided in the ollama.

<!-- gh-comment-id:2603797241 --> @Shiven-saini commented on GitHub (Jan 21, 2025): R1 support is already provided in the ollama.
Author
Owner

@olumolu commented on GitHub (Jan 21, 2025):

but r1 zero is not available

<!-- gh-comment-id:2603863112 --> @olumolu commented on GitHub (Jan 21, 2025): but r1 zero is not available
Author
Owner

@rick-github commented on GitHub (Jan 21, 2025):

DeepSeek-R1-Zero encounters challenges such as endless repetition, poor readability, and language mixing. To address these issues and further enhance reasoning performance, we introduce DeepSeek-R1

<!-- gh-comment-id:2603892859 --> @rick-github commented on GitHub (Jan 21, 2025): > DeepSeek-R1-Zero encounters challenges such as endless repetition, poor readability, and language mixing. To address these issues and further enhance reasoning performance, we introduce DeepSeek-R1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#51991