Skip to content

Commit

Permalink
CLI: Expose chat template in data options (#1582)
Browse files Browse the repository at this point in the history
## Describe your changes
Provide `--use_chat_template` option in the CLI to use the default chat
template instead of text_template or text_field.

## Checklist before requesting a review
- [ ] Add unit tests for this change.
- [ ] Make sure all tests can pass.
- [ ] Update documents if necessary.
- [ ] Lint and apply fixes to your code by running `lintrunner -a`
- [ ] Is this a user-facing change? If yes, give a description of this
change to be included in the release notes.
- [ ] Is this PR including examples changes? If yes, please remember to
update [example
documentation](https://github.com/microsoft/Olive/blob/main/docs/source/examples.md)
in a follow-up PR.

## (Optional) Issue link
  • Loading branch information
jambayk authored Jan 30, 2025
1 parent 4a76579 commit d98186d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions olive/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ def add_dataset_options(sub_parser, required=True, include_train=True, include_e
type=unescaped_str,
help=r"Template to generate text field from. E.g. '### Question: {prompt} \n### Answer: {response}'",
)
text_group.add_argument("--use_chat_template", action="store_true", help="Use chat template for text field.")
dataset_group.add_argument(
"--max_seq_len",
type=int,
Expand Down Expand Up @@ -526,6 +527,7 @@ def update_dataset_options(args, config):
),
((*preprocess_key, "text_cols"), args.text_field),
((*preprocess_key, "text_template"), args.text_template),
((*preprocess_key, "chat_template"), args.use_chat_template),
((*preprocess_key, "max_seq_len"), args.max_seq_len),
((*preprocess_key, "add_special_tokens"), args.add_special_tokens),
((*preprocess_key, "max_samples"), args.max_samples),
Expand Down

0 comments on commit d98186d

Please sign in to comment.