Skip to content
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

Default dataset_text_field to "text" #2078

Merged
merged 14 commits into from
Oct 4, 2024
Merged

Default dataset_text_field to "text" #2078

merged 14 commits into from
Oct 4, 2024

Conversation

qgallouedec
Copy link
Member

@qgallouedec qgallouedec commented Sep 18, 2024

What does this PR do?

Most datasets use “text” for the text field. Moreover, this is the column we document in trl as [standard language modeling] (https://huggingface.co/docs/trl/en/dataset_formats#overview-of-the-dataset-formats-and-types).
Consequently, it makes sense to use this column by default for dataset_text_field.
On the other hand, it allows us to drop # needs dummy text field as here:

training_args.dataset_text_field = "" # need a dummy field

Implications

  • The dataset_text_field can no longer be None in the SFTConfig. We then use the following logic in SFTTrainer: if formatting_func is provided, use it, otherwise, use dataset_text_field.
  • Things are a little different in ConstantLengthDataset where formatting_func and dataset_text_field are None by default, and only one of them can be supplied.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec qgallouedec marked this pull request as ready for review October 2, 2024 10:48
@qgallouedec qgallouedec merged commit a9cffc7 into main Oct 4, 2024
10 checks passed
@qgallouedec qgallouedec deleted the dataset_text_field branch October 4, 2024 08:55
@@ -445,9 +445,9 @@ def _prepare_dataset(
dataset,
tokenizer,
packing,
dataset_text_field,
dataset_text_field: str,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not super important, but maybe we should type the rest of the function signature for consistency?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree in general, but I didn't want to spend to much time on it since I plan to refactor SFT data preprocessing, to be more aligned with what's done in other trainers (which is clearer IMO)

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.

5 participants