Skip to content

Fix ChatTemplateParser import in SFT trainer#428

Merged
listar2000 merged 1 commit into
mainfrom
fix/sft-chat-template-parser-import
Mar 6, 2026
Merged

Fix ChatTemplateParser import in SFT trainer#428
listar2000 merged 1 commit into
mainfrom
fix/sft-chat-template-parser-import

Conversation

@listar2000
Copy link
Copy Markdown
Collaborator

@listar2000 listar2000 commented Mar 6, 2026

Summary

Fix ModuleNotFoundError: No module named 'verl.utils.parser' when using the SFT trainer (#426). The import pointed to a non-existent verl module instead of rllm's own ChatTemplateParser.

Type of change

  • Fix

What changed

  • Changed sft_dataset.py to import ChatTemplateParser from rllm.parser instead of verl.utils.parser.chat_template_parser
  • This aligns with every other file in the codebase (18 files all import from rllm.parser)
  • The rllm implementation has the same API (get_parser(), parse() with is_first_msg and add_generation_prompt params)

Validation

  • pre-commit run --all-files
  • Manual validation performed

Validation details:

  • Verified rllm's ChatTemplateParser has identical API surface: get_parser(tokenizer) factory method and parse(messages, add_generation_prompt, is_first_msg) signature
  • Pre-commit hooks (ruff lint + format) pass

Breaking changes / migration notes

  • None

Docs / examples

  • Not needed

Related issues / PRs

Screenshots / logs

N/A

Use rllm's own ChatTemplateParser instead of the non-existent
verl.utils.parser module. This aligns with every other file in the
codebase which imports from rllm.parser.

Fixes #426

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@listar2000 listar2000 merged commit 40cd263 into main Mar 6, 2026
2 checks passed
@listar2000 listar2000 deleted the fix/sft-chat-template-parser-import branch March 6, 2026 18:39
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.

Import Errior of ModuleNotFoundError: No module named 'verl.utils.parser' in SFT

1 participant