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
7544efc9
Unverified
Commit
7544efc9
authored
Nov 17, 2021
by
Antonio Carlos Falcão Petri
Committed by
GitHub
Nov 17, 2021
Browse files
[Gradient checkpoining] Update Wav2Vec scripts (#14036)
Co-authored-by:
Stas Bekman
<
stas@stason.org
>
parent
c6c07554
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
examples/research_projects/jax-projects/wav2vec2/run_wav2vec2_pretrain_flax.py
...jects/jax-projects/wav2vec2/run_wav2vec2_pretrain_flax.py
+4
-4
No files found.
examples/research_projects/jax-projects/wav2vec2/run_wav2vec2_pretrain_flax.py
View file @
7544efc9
...
...
@@ -48,9 +48,6 @@ class ModelArguments:
freeze_feature_extractor
:
Optional
[
bool
]
=
field
(
default
=
True
,
metadata
=
{
"help"
:
"Whether to freeze the feature extractor layers of the model."
}
)
gradient_checkpointing
:
Optional
[
bool
]
=
field
(
default
=
False
,
metadata
=
{
"help"
:
"Whether to freeze the feature extractor layers of the model."
}
)
verbose_logging
:
Optional
[
bool
]
=
field
(
default
=
False
,
metadata
=
{
"help"
:
"Whether to log verbose messages or not."
},
...
...
@@ -356,7 +353,6 @@ def main():
config
=
Wav2Vec2Config
.
from_pretrained
(
model_args
.
model_name_or_path
,
cache_dir
=
model_args
.
cache_dir
,
gradient_checkpointing
=
model_args
.
gradient_checkpointing
,
)
if
not
config
.
do_stable_layer_norm
or
config
.
feat_extract_norm
!=
"layer"
:
...
...
@@ -366,6 +362,10 @@ def main():
model
=
FlaxWav2Vec2ForPreTraining
(
config
,
seed
=
training_args
.
seed
,
dtype
=
getattr
(
jnp
,
model_args
.
dtype
))
# Activate gradient checkpointing if needed
if
training_args
.
gradient_checkpointing
:
model
.
gradient_checkpointing_enable
()
data_collator
=
FlaxDataCollatorForWav2Vec2Pretraining
(
model
=
model
,
feature_extractor
=
feature_extractor
,
pad_to_multiple_of
=
data_args
.
pad_to_multiple_of
)
...
...
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