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

[Trainer / GC] Add gradient_checkpointing_kwargs in trainer and training arguments #27068

Merged
merged 6 commits into from
Oct 30, 2023

Conversation

younesbelkada
Copy link
Contributor

What does this PR do?

Partially fixes: huggingface/trl#912

Following #27020 it is important to propagate gradient_checkpointing_kwargs in Trainer as well

cc @ArthurZucker

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 25, 2023

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

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Thank 🔥

gradient_checkpointing_kwargs: dict = field(
default=None,
metadata={
"help": "Gradient checkpointing key word arguments. Will be passed to `torch.utils.checkpoint.checkpoint` through `model.gradient_checkpointing_enable`."
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you add why anyone would want to pass antyhing and what is supported?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And a small small test!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@ArthurZucker
Copy link
Collaborator

Also why does it partially fix the issue

@younesbelkada younesbelkada marked this pull request as draft October 27, 2023 20:53
@younesbelkada younesbelkada marked this pull request as ready for review October 30, 2023 09:01
@younesbelkada
Copy link
Contributor Author

It partially fixes the issue because I need huggingface/peft#1036 to be merged to fix the bug with respect to PEFT models

@younesbelkada younesbelkada merged commit 5fbed2d into huggingface:main Oct 30, 2023
@younesbelkada younesbelkada deleted the trainer-fix-gc branch October 30, 2023 11:42
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 19, 2023
… training arguments (huggingface#27068)

* add `gradient_checkpointing_kwargs` in trainer and training arguments

* add comment

* add test - currently failing

* now tests pass
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