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

Remove unnecessary columns for all dataset types in Trainer #17166

Merged
merged 7 commits into from
May 11, 2022

Conversation

Yard1
Copy link
Contributor

@Yard1 Yard1 commented May 10, 2022

What does this PR do?

As discussed with @sgugger offline, this PR adds automatic removal of unnecessary columns for arbitrary dataset types. This mimics the already present logic for removing unnecessary columns from datasets.Datasets, but uses a wrapper around the data collation function to enable it for other datasets. The end result is intended to be the same for both cases.

The implementation is a bit more complex than it really has to be, in order to facilitate the same logging UX as with the datasets.Dataset case.

Tests have been added/updated where applicable.

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 or the forum? Please add a link
    to it if that's the case.
    Discussed on Slack!
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • 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.

@Yard1
Copy link
Contributor Author

Yard1 commented May 10, 2022

cc @sgugger

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 10, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. I'm confused as to why the check is whether the dataset is an instance of a PyTorch IterableDataset. Shouldn't it be any dataset that is not a datasets.Dataset?

src/transformers/trainer.py Outdated Show resolved Hide resolved
src/transformers/trainer_utils.py Outdated Show resolved Hide resolved
@Yard1
Copy link
Contributor Author

Yard1 commented May 10, 2022

Ah, yeah, we don't need to check whether it's an iterable dataset! Let me fix that

@Yard1 Yard1 changed the title Remove unnecessary columns in IterableDatasets in Trainer Remove unnecessary columns for all dataset types in Trainer May 10, 2022
@Yard1 Yard1 requested a review from sgugger May 10, 2022 23:51
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks a lot for iterating through this!

@sgugger sgugger merged commit edcc66d into huggingface:main May 11, 2022
@Yard1 Yard1 deleted the remove_columns_for_iterable_dataset branch May 11, 2022 15:54
Narsil pushed a commit to Narsil/transformers that referenced this pull request May 12, 2022
…gface#17166)

* Remove unneeded columns for IterableDataset

* Add test

* Update trainer tests

* Edit docstring

* Lint

* Apply feedback

* Apply feedback
ArthurZucker pushed a commit to ArthurZucker/transformers that referenced this pull request May 12, 2022
…gface#17166)

* Remove unneeded columns for IterableDataset

* Add test

* Update trainer tests

* Edit docstring

* Lint

* Apply feedback

* Apply feedback
elusenji pushed a commit to elusenji/transformers that referenced this pull request Jun 12, 2022
…gface#17166)

* Remove unneeded columns for IterableDataset

* Add test

* Update trainer tests

* Edit docstring

* Lint

* Apply feedback

* Apply feedback
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.

3 participants