[PR #156] Wrap a DeepSeek-VL2 user turn with the sft markers #153

Open
opened 2026-10-26 21:12:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepSeek-VL2/pull/156
Author: @SashaMIT
Created: 9/28/2026
Status: 🔄 Open

Base: main ← Head: codered-v2-user-turn


📝 Commits (1)

  • 781426a Wrap a DeepSeek-VL2 user turn with the sft markers.

📊 Changes

2 files changed (+36 additions, -1 deletions)

View changed files

📝 deepseek_vl2/models/conversation.py (+1 -1)
➕ tests/test_deepseekv2_prompt.py (+35 -0)

📄 Description

Hello! came back as Hello!<|end▁of▁sentence|>. The deepseekv2 template only wraps a user turn when the role is the literal User. The registered role is |<User>|, so that check never matches and the user text is stored with the assistant end marker.

The check now uses the template's own user role. Hello! is wrapped as <|sft▁begin|>\nHello! and then the sft end marker. Hi! still ends with <|end▁of▁sentence|>. The deepseek v1 template still starts with <|User|>: Hello! and still ends with <|Assistant|>:.

Test plan

  • python -m unittest tests.test_deepseekv2_prompt (red on tip: Hello!<|end▁of▁sentence|>Hi!<|end▁of▁sentence|> vs the wrapped user turn; green after: 2 tests pass)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepSeek-VL2/pull/156 **Author:** [@SashaMIT](https://github.com/SashaMIT) **Created:** 9/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codered-v2-user-turn` --- ### 📝 Commits (1) - [`781426a`](https://github.com/deepseek-ai/DeepSeek-VL2/commit/781426a52a59e7b6e1a658c4a0fb5fbb1cc1c978) Wrap a DeepSeek-VL2 user turn with the sft markers. ### 📊 Changes **2 files changed** (+36 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `deepseek_vl2/models/conversation.py` (+1 -1) ➕ `tests/test_deepseekv2_prompt.py` (+35 -0) </details> ### 📄 Description `Hello!` came back as `Hello!<|end▁of▁sentence|>`. The deepseekv2 template only wraps a user turn when the role is the literal `User`. The registered role is `|<User>|`, so that check never matches and the user text is stored with the assistant end marker. The check now uses the template's own user role. `Hello!` is wrapped as `<|sft▁begin|>\nHello!` and then the sft end marker. `Hi!` still ends with `<|end▁of▁sentence|>`. The deepseek v1 template still starts with `<|User|>: Hello!` and still ends with `<|Assistant|>:`. ## Test plan - [x] `python -m unittest tests.test_deepseekv2_prompt` (red on tip: `Hello!<|end▁of▁sentence|>Hi!<|end▁of▁sentence|>` vs the wrapped user turn; green after: 2 tests pass) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-VL2#153
No description provided.