[PR #157] Fix system prompt propagation in conversation inputs #154

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

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepSeek-VL2/pull/157
Author: @qorud02
Created: 10/5/2026
Status: 🔄 Open

Base: main ← Head: fix-conversation-system-prompt


📝 Commits (1)

  • 1489a56 Fix system prompt propagation in conversation inputs

📊 Changes

2 files changed (+160 additions, -2 deletions)

View changed files

📝 deepseek_vl2/models/processing_deepseek_vl_v2.py (+2 -2)
➕ tests/test_system_prompt.py (+158 -0)

📄 Description

Passing system_prompt to the processor with conversations currently changes the displayed sft_format, but leaves the actual input_ids unchanged. Forward it through the existing systems argument to format_messages_v2 and use it for the first conversation turn. Preserve empty/default template behavior and the precedence of an explicit first system or deepseekapi-sys message.

Fixes #134.

Validation:

  • python -m unittest discover -s tests -v: 6 tests pass; the original code fails the missing-system-token assertions.
  • python -m compileall -q deepseek_vl2 tests inference.py web_demo.py: passes.
  • CPU environment: Python 3.10.20, torch 2.0.1+cpu, torchvision 0.15.2+cpu, transformers 4.38.2.

The tests execute the actual processor and PyTorch tensor paths with a small character tokenizer. They cover first-turn propagation, label masking, explicit-system precedence, template defaults and batched output. Model generation, real Llama tokenization and image processing were not exercised.


🔄 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/157 **Author:** [@qorud02](https://github.com/qorud02) **Created:** 10/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-conversation-system-prompt` --- ### 📝 Commits (1) - [`1489a56`](https://github.com/deepseek-ai/DeepSeek-VL2/commit/1489a56993aacc311513fadc59543a5c6f99e538) Fix system prompt propagation in conversation inputs ### 📊 Changes **2 files changed** (+160 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `deepseek_vl2/models/processing_deepseek_vl_v2.py` (+2 -2) ➕ `tests/test_system_prompt.py` (+158 -0) </details> ### 📄 Description Passing `system_prompt` to the processor with `conversations` currently changes the displayed `sft_format`, but leaves the actual `input_ids` unchanged. Forward it through the existing `systems` argument to `format_messages_v2` and use it for the first conversation turn. Preserve empty/default template behavior and the precedence of an explicit first `system` or `deepseekapi-sys` message. Fixes #134. Validation: - `python -m unittest discover -s tests -v`: 6 tests pass; the original code fails the missing-system-token assertions. - `python -m compileall -q deepseek_vl2 tests inference.py web_demo.py`: passes. - CPU environment: Python 3.10.20, torch 2.0.1+cpu, torchvision 0.15.2+cpu, transformers 4.38.2. The tests execute the actual processor and PyTorch tensor paths with a small character tokenizer. They cover first-turn propagation, label masking, explicit-system precedence, template defaults and batched output. Model generation, real Llama tokenization and image processing were not exercised. --- <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#154
No description provided.