Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
e737446e
Unverified
Commit
e737446e
authored
Dec 15, 2023
by
Younes Belkada
Committed by
GitHub
Dec 15, 2023
Browse files
[`Modeling` / `Mixtral`] Fix GC + PEFT issues with Mixtral (#28061)
fix for mistral
parent
1e209317
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/transformers/models/mixtral/modeling_mixtral.py
src/transformers/models/mixtral/modeling_mixtral.py
+7
-7
No files found.
src/transformers/models/mixtral/modeling_mixtral.py
View file @
e737446e
...
...
@@ -1016,6 +1016,13 @@ class MixtralModel(MixtralPreTrainedModel):
past_key_values_length
=
0
if
self
.
gradient_checkpointing
and
self
.
training
:
if
use_cache
:
logger
.
warning_once
(
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
)
use_cache
=
False
if
use_cache
:
use_legacy_cache
=
not
isinstance
(
past_key_values
,
Cache
)
if
use_legacy_cache
:
...
...
@@ -1058,13 +1065,6 @@ class MixtralModel(MixtralPreTrainedModel):
hidden_states
=
inputs_embeds
if
self
.
gradient_checkpointing
and
self
.
training
:
if
use_cache
:
logger
.
warning_once
(
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
)
use_cache
=
False
# decoder layers
all_hidden_states
=
()
if
output_hidden_states
else
None
all_self_attns
=
()
if
output_attentions
else
None
...
...
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