-
Notifications
You must be signed in to change notification settings - Fork 335
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
Add system prompt #1366
Add system prompt #1366
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/1366
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 29cdf96 with merge base 4ae950b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torchtune/data/_messages.py
Outdated
self, | ||
train_on_input: bool = False, | ||
column_map: Optional[Dict[str, str]] = None, | ||
system_prompt: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need some way to convey that this will either add or override the given system prompt:
new_system_prompt
?
torchtune/datasets/_grammar.py
Outdated
@@ -19,6 +19,7 @@ def grammar_dataset( | |||
source: str = "liweili/c4_200m", | |||
column_map: Optional[Dict[str, str]] = None, | |||
train_on_input: bool = False, | |||
system_prompt: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these need to be updated to or at least the documentation stating that this will override any system prompt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oi, missed these
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1366 +/- ##
=======================================
Coverage ? 72.69%
=======================================
Files ? 271
Lines ? 12805
Branches ? 0
=======================================
Hits ? 9308
Misses ? 3497
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Context
What is the purpose of this PR? Is it to
Enable adding an optional system prompt in our built-in message transforms. Expose this parameter in our dataset builders. Any user dataset that uses our common message transforms can leverage this feature.
Addresses #1328
Test plan
Please make sure to do each of the following if applicable to your PR. (If you're not sure about any one of these just ask and we will happily help. We also have a contributing page for some guidance on contributing.)
pre-commit install
)pytest tests
pytest tests -m integration_test
UX
If your function changed a public API, please add a dummy example of what the user experience will look like when calling it.
Example of docstring:
torchtune/torchtune/modules/vision_transformer.py
Line 285 in 6a7951f
Example in our docs: https://pytorch.org/torchtune/main/tutorials/qat_finetune.html#applying-qat-to-llama3-models