Skip to content

fix(examples): handle missing SFT chat template#5626

Open
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/sftdataset-chat-template-fallback
Open

fix(examples): handle missing SFT chat template#5626
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/sftdataset-chat-template-fallback

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

  • Guard the DeepSeek/R1 chat template rewrite when a tokenizer has no chat_template.
  • Use the matching dataset prompt template string as the fallback instead of assigning the whole template map.
  • Keep the existing hard failure when neither the tokenizer nor the dataset provides a valid template.

Validation

  • python3 -m py_compile examples/post_training/modelopt/finetune.py
  • ruff check --no-fix examples/post_training/modelopt/finetune.py
  • git diff --check
  • BASE_REF=main CHECK_ONLY=true SKIP_DOCS=false bash tools/autoformat.sh
  • Stubbed constructor regression for missing-template fallback, unknown-dataset failure, and DeepSeek template rewrite.

Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci marked this pull request as draft July 2, 2026 18:04
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

This PR has been automatically converted to draft because all PRs must start as drafts.

When you are ready for review, click Ready for Review to begin the review process. This will:

  1. Add the oncall reviewer (optional reviewer)
  2. Add required review teams based on your changes

See the contribution guide for more details.

@fallintoplace fallintoplace marked this pull request as ready for review July 2, 2026 18:04
@svcnvidia-nemo-ci svcnvidia-nemo-ci requested a review from a team July 2, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants