Skip to content

[New Model] Devstral support #6547

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

Merged
merged 13 commits into from
May 27, 2025

Conversation

JustinTong0323
Copy link
Collaborator

@JustinTong0323 JustinTong0323 commented May 23, 2025

Serve with command:

python3 -m sglang.launch_server \
    --model-path mistralai/Devstral-Small-2505 \
    --tool-call-parser mistral

Motivation

Modifications

  • Add auto chat template matching for devstral
  • Add system prompt from model files (from here) to chat template
  • Directly use mistral's tokenizer
  • Add tool_call_separator to mistral and qwen25 tool call parser

Checklist

Signed-off-by: Xinyuan Tong <[email protected]>
@JustinTong0323

This comment was marked as resolved.

@JustinTong0323 JustinTong0323 requested review from HaiShaw and Copilot May 25, 2025 06:28
Copy link

@Copilot 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

Adds support for the new Devstral model by pulling in its system prompt, wiring up a conversation template, and handling its tokenizer.

  • Introduces utilities to locate a local HF repo and read its SYSTEM_PROMPT.txt
  • Registers a “devstral” conversation template and matching function
  • Applies a temporary tokenizer fallback for Devstral in the HF Transformers helper

Reviewed Changes

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

Show a summary per file
File Description
python/sglang/srt/utils.py Added find_local_repo_dir and read_system_prompt_from_file utilities
python/sglang/srt/hf_transformers_utils.py Mapped Devstral tokenizer to a Mistral Instruct tokenizer
python/sglang/srt/function_call/qwen25_detector.py Added tool_call_separator argument in EBNF builder call
python/sglang/srt/function_call/mistral_detector.py Added tool_call_separator argument in EBNF builder call
python/sglang/srt/conversation.py Imported prompt reader; registered Devstral template and matcher
Comments suppressed due to low confidence (1)

python/sglang/srt/utils.py:2190

  • Consider adding unit tests for find_local_repo_dir and read_system_prompt_from_file (including edge cases like missing cache or files) to ensure this logic remains robust.
def read_system_prompt_from_file(model_name: str) -> str:

@zhyncs zhyncs self-assigned this May 25, 2025
@JustinTong0323 JustinTong0323 force-pushed the new_model_devstral_support branch from 1e42b65 to 3fafcfd Compare May 26, 2025 03:02
@JustinTong0323
Copy link
Collaborator Author

Revert change with tool detector, which would be improved in #6597

@hnyls2002
Copy link
Collaborator

@JustinTong0323 Please fix lint error

Signed-off-by: Xinyuan Tong <[email protected]>
@JustinTong0323
Copy link
Collaborator Author

@JustinTong0323 Please fix lint error

fixed, but it seems from main? Maybe a quick fix commit to main is better for all PRs

@zhyncs zhyncs merged commit d6864ce into sgl-project:main May 27, 2025
0 of 20 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.

3 participants