Skip to content

Conversation

@qianlihuang
Copy link
Contributor

@qianlihuang qianlihuang commented Jan 1, 2026

Motivation

This PR adds chat template support for DeepSeek V3.2. https://huggingface.co/deepseek-ai/DeepSeek-V3.2

Modifications

  • Register deepseek-v32 chat template in specforge/data/template.py
  • Add fallback rendering logic in specforge/data/parse.py for tokenizers without built-in chat_template (DeepSeek V3.2 tokenizer does not provide one)
  • Add unit test and reference for DeepSeek V3.2 in tests/test_data/test_parsers.py and tests/test_data/test_references/deepseek-v32_ref.json

Related Issues

Roadmap #374

Accuracy Test

Benchmark & Profiling

Checklist

Copilot AI review requested due to automatic review settings January 1, 2026 04:35
@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds chat template support for DeepSeek V3.2 by registering a new template configuration and implementing fallback rendering logic for tokenizers that lack built-in chat templates.

Key Changes

  • Registers the deepseek-v32 chat template with thinking parser support
  • Adds fallback rendering logic to manually construct conversation strings when tokenizer's apply_chat_template fails
  • Adds unit test for DeepSeek V3.2 template with reference data

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
specforge/data/template.py Registers new deepseek-v32 template with thinking parser type, similar headers to deepseek-v3 but with empty system prompt
specforge/data/parse.py Adds try-except fallback in GeneralParser.parse to manually construct conversation strings when tokenizer lacks chat_template
tests/test_data/test_parsers.py Adds test_deepseek_v32 test method following existing test patterns
tests/test_data/test_references/deepseek-v32_ref.json Adds reference data for regression testing (identical to deepseek-v3 for standard test messages)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Register 'deepseek-v32' template with thinking mode support
- Add fallback rendering for tokenizers without chat_template
- Add test case and reference for DeepSeek V3.2

The DeepSeek V3.2 tokenizer does not include a built-in chat template,
so we added a fallback that manually renders conversations using the
ChatTemplate fields when tokenizer.apply_chat_template() fails.
@qianlihuang qianlihuang force-pushed the deepseek-v32-chat-template branch from 0029452 to dafa625 Compare January 1, 2026 04:44
@sleepcoo sleepcoo merged commit 51ab210 into sgl-project:main Jan 11, 2026
2 of 8 checks passed
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.

2 participants