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
39aea35f
Commit
39aea35f
authored
Aug 22, 2019
by
Ayush Dubey
Committed by
A. Unique TensorFlower
Aug 22, 2019
Browse files
Add flags to run BERT with MultiWorkerMirroredStrategy.
PiperOrigin-RevId: 264935345
parent
b3ee015d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
official/bert/common_flags.py
official/bert/common_flags.py
+3
-3
official/bert/run_squad.py
official/bert/run_squad.py
+2
-0
No files found.
official/bert/common_flags.py
View file @
39aea35f
...
...
@@ -32,10 +32,10 @@ def define_common_bert_flags():
'init_checkpoint'
,
None
,
'Initial checkpoint (usually from a pre-trained BERT model).'
)
flags
.
DEFINE_enum
(
'strategy_type'
,
'mirror'
,
[
'tpu'
,
'mirror'
],
'strategy_type'
,
'mirror'
,
[
'tpu'
,
'mirror'
,
'multi_worker_mirror'
],
'Distribution Strategy type to use for training. `tpu` uses '
'TPUStrategy for running on TPUs, `mirror` uses GPUs with '
'
sing
le host.'
)
'TPUStrategy for running on TPUs, `mirror` uses GPUs with
single host,
'
'
`multi_worker_mirror` uses CPUs or GPUs with multip
le host
s
.'
)
flags
.
DEFINE_integer
(
'num_train_epochs'
,
3
,
'Total number of training epochs to perform.'
)
flags
.
DEFINE_integer
(
...
...
official/bert/run_squad.py
View file @
39aea35f
...
...
@@ -321,6 +321,8 @@ def main(_):
strategy
=
None
if
FLAGS
.
strategy_type
==
'mirror'
:
strategy
=
tf
.
distribute
.
MirroredStrategy
()
elif
FLAGS
.
strategy_type
==
'multi_worker_mirror'
:
strategy
=
tf
.
distribute
.
experimental
.
MultiWorkerMirroredStrategy
()
elif
FLAGS
.
strategy_type
==
'tpu'
:
# Initialize TPU System.
cluster_resolver
=
tpu_lib
.
tpu_initialize
(
FLAGS
.
tpu
)
...
...
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