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
ModelZoo
ResNet50_tensorflow
Commits
a4235e26
Commit
a4235e26
authored
Sep 27, 2022
by
Chen Qian
Committed by
A. Unique TensorFlower
Sep 27, 2022
Browse files
Optimizer change to get compatible for an incoming Keras optimizer migration.
PiperOrigin-RevId: 477217857
parent
10673875
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
official/projects/mobilebert/distillation.py
official/projects/mobilebert/distillation.py
+3
-0
official/projects/mobilebert/distillation_test.py
official/projects/mobilebert/distillation_test.py
+1
-1
No files found.
official/projects/mobilebert/distillation.py
View file @
a4235e26
...
...
@@ -238,6 +238,9 @@ class BertDistillationTask(policies.ProgressivePolicy, base_task.Task):
})
opt_factory
=
optimization
.
OptimizerFactory
(
params
)
optimizer
=
opt_factory
.
build_optimizer
(
opt_factory
.
build_learning_rate
())
if
isinstance
(
optimizer
,
tf
.
keras
.
optimizers
.
experimental
.
Optimizer
):
optimizer
=
tf
.
keras
.
__internal__
.
optimizers
.
convert_to_legacy_optimizer
(
optimizer
)
return
optimizer
...
...
official/projects/mobilebert/distillation_test.py
View file @
a4235e26
...
...
@@ -153,7 +153,7 @@ class DistillationTest(tf.test.TestCase, parameterized.TestCase):
eval_dataset
=
bert_distillation_task
.
get_eval_dataset
(
stage_id
=
0
)
eval_iterator
=
iter
(
eval_dataset
)
optimizer
=
tf
.
keras
.
optimizers
.
SGD
(
lr
=
0.1
)
optimizer
=
tf
.
keras
.
optimizers
.
legacy
.
SGD
(
learning_rate
=
0.1
)
# test train/val step for all stages, including the last pretraining stage
for
stage
in
range
(
student_block_num
+
1
):
...
...
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