Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
9094abe8
Unverified
Commit
9094abe8
authored
Feb 20, 2024
by
Arthur
Committed by
GitHub
Feb 20, 2024
Browse files
[`gradient_checkpointing`] default to use it for torch 2.3 (#28538)
* default to use it * style
parent
49c0b293
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+1
-1
No files found.
src/transformers/modeling_utils.py
View file @
9094abe8
...
@@ -2092,7 +2092,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -2092,7 +2092,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
raise
ValueError
(
f
"
{
self
.
__class__
.
__name__
}
does not support gradient checkpointing."
)
raise
ValueError
(
f
"
{
self
.
__class__
.
__name__
}
does not support gradient checkpointing."
)
if
gradient_checkpointing_kwargs
is
None
:
if
gradient_checkpointing_kwargs
is
None
:
gradient_checkpointing_kwargs
=
{}
gradient_checkpointing_kwargs
=
{
"use_reentrant"
:
True
}
gradient_checkpointing_func
=
functools
.
partial
(
checkpoint
,
**
gradient_checkpointing_kwargs
)
gradient_checkpointing_func
=
functools
.
partial
(
checkpoint
,
**
gradient_checkpointing_kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment