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

add gather_use_object arguments #31514

Merged
merged 12 commits into from
Jun 28, 2024

Conversation

SangbumChoi
Copy link
Contributor

@SangbumChoi SangbumChoi commented Jun 20, 2024

What does this PR do?

Fixes #30766 (issue)
I have described the problem and the solution at the issue!

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.
  • 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.

@muellerzr and @SunMarc

Copy link
Member

@qubvel qubvel 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 working on this 🤗

src/transformers/training_args.py Outdated Show resolved Hide resolved
Copy link
Member

@SunMarc SunMarc 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 the PR @SangbumChoi ! I left a comment

src/transformers/trainer.py Outdated Show resolved Hide resolved
@SangbumChoi SangbumChoi requested a review from SunMarc June 22, 2024 07:09
Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

LGTM ! Just one final nit

src/transformers/trainer.py Outdated Show resolved Hide resolved
@SangbumChoi SangbumChoi requested a review from SunMarc June 25, 2024 03:00
Copy link
Member

@SunMarc SunMarc 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 iterating ! I left a small suggestion !

src/transformers/trainer.py Outdated Show resolved Hide resolved
@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.

@SangbumChoi
Copy link
Contributor Author

@SunMarc Thanks for the clean code!

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

LGTM ! Thanks for iterating !

@SunMarc SunMarc requested a review from amyeroberts June 26, 2024 14:18
Copy link
Collaborator

@amyeroberts amyeroberts 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 working on this!

Logic looks OK, but we should move where it happens. A test should be added too, to make sure this argument can be passed and is respected

src/transformers/training_args.py Outdated Show resolved Hide resolved
src/transformers/trainer.py Outdated Show resolved Hide resolved
src/transformers/trainer.py Outdated Show resolved Hide resolved
@SangbumChoi
Copy link
Contributor Author

@amyeroberts For the test part where should I add for the extra kwargs or arguments?

https://github.com/huggingface/transformers/blob/main/tests/trainer/test_trainer.py

Maybe here?

@amyeroberts
Copy link
Collaborator

@SangbumChoi Yep - test_trainer.py is perfect 👌 It might be hard to verify if the argument is respected, but if we can pass eval_use_gather_object=True, have the trainer do a run (small model, dataset etc.) and evaluate I think it's good enough

@SangbumChoi
Copy link
Contributor Author

SangbumChoi commented Jun 27, 2024

@amyeroberts @SunMarc Even though the CI says pass the test I'm little bit skeptical about where did the test_trainer.py exactly correspends in the CI... I can't see it from the tests_torch.
https://app.circleci.com/pipelines/github/huggingface/transformers/96590/workflows/8552cb16-a227-4ef5-9919-308482684d63/jobs/1275319

Do I need some extra flag or commit for this?

@amyeroberts
Copy link
Collaborator

@SangbumChoi The test_trainer.py tests should run in the test_torch run. If you look at the test artefacts e.g. the test_outputs.txt for the parallel run 1, you can find the test_trainer.py tests have run

@SangbumChoi
Copy link
Contributor Author

@amyeroberts I think I don't have access to test_outputs.txt for the parallel run 1, but I confirmed that the CI passed. Thanks again for the detail description!

[gw5] [ 83%] PASSED tests/trainer/test_trainer.py::TrainerIntegrationTest::test_eval_use_gather_object 
tests/trainer/test_trainer.py::TrainerIntegrationTest::test_evaluate 

@SangbumChoi SangbumChoi requested a review from SunMarc June 28, 2024 00:22
Copy link
Collaborator

@amyeroberts amyeroberts 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 adding this feature + tests!

Copy link
Member

@SunMarc SunMarc 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 iterating !

@amyeroberts amyeroberts merged commit cb29897 into huggingface:main Jun 28, 2024
21 checks passed
Copy link
Contributor

@muellerzr muellerzr 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 didn't get a chance to take a look at this as I was OOO. Please see my comments here as I think we need a follow-up to avoid bad practices + clarify this very, very specific use-case

src/transformers/training_args.py Show resolved Hide resolved
src/transformers/training_args.py Show resolved Hide resolved
src/transformers/trainer.py Show resolved Hide resolved
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.

For multiple GPUs: torch.cuda.empty_cache() stuck forever
6 participants