NeMo icon indicating copy to clipboard operation
NeMo copied to clipboard

SFT Script with HuggingFace chat template support

Open jenchen13 opened this issue 9 months ago • 2 comments

[!IMPORTANT]
The Update branch button must only be pressed in very rare occassions. An outdated branch is never blocking the merge of a PR. Please reach out to the automation team before pressing that button.

What does this PR do ?

Support using the HuggingFace tokenizer apply_chat_template during SFT with chat-style datasets, and update distillation script to support finetuning for chat datasets as well as SFT distillation.

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

TODO

# Add a code snippet demonstrating how to use this 

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR. To re-run CI remove and add the label again. To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

Before your PR is "Ready for review"

Pre checks:

  • [ ] Make sure you read and followed Contributor guidelines
  • [ ] Did you write any new necessary tests?
  • [ ] Did you add or update any necessary documentation?
  • [ ] Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • [ ] Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • [ ] New Feature
  • [ ] Bugfix
  • [ ] Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed. Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

jenchen13 avatar Apr 25 '25 21:04 jenchen13

LGTM too, after my last thread is resolved :)

AAnoosheh avatar May 12 '25 20:05 AAnoosheh

Hey there! I have an approved MR here that tackles a similar problem but does it slightly differently. We are using the {% generation %} tags from the template and passing chat templates in.

This approach conflicts from what's in this MR, can we set up a slack hangout to make sure we are both getting what we need out of the GPTSFTChatDataset class?

soluwalana avatar May 13 '25 19:05 soluwalana

[🤖]: Hi @jenchen13 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully.

So it might be time to merge this PR or get some approvals.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

github-actions[bot] avatar May 14 '25 16:05 github-actions[bot]

@soluwalana we discussed offline and agreed to merge this PR first, then rebase #13367 to add additional features

jenchen13 avatar May 14 '25 17:05 jenchen13