Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f7a5fa

Browse files
author
Taylor Robie
authored
Replicate internal cluster changes in official mnist tpu example (tensorflow#4020)
1 parent 26aded5 commit 9f7a5fa

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

official/mnist/mnist_tpu.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@
4646
"metadata.")
4747

4848
# Model specific parameters
49-
tf.flags.DEFINE_string(
50-
"master", default=None,
51-
help="GRPC URL of the master (e.g. grpc://ip.address.of.tpu:8470). You "
52-
"must specify either this flag or --tpu.")
5349
tf.flags.DEFINE_string("data_dir", "",
5450
"Path to directory containing the MNIST dataset")
5551
tf.flags.DEFINE_string("model_dir", None, "Estimator model_dir")
@@ -136,24 +132,14 @@ def main(argv):
136132
del argv # Unused.
137133
tf.logging.set_verbosity(tf.logging.INFO)
138134

139-
if FLAGS.master is None and FLAGS.tpu is None:
140-
raise RuntimeError('You must specify either --master or --tpu.')
141-
if FLAGS.master is not None:
142-
if FLAGS.tpu is not None:
143-
tf.logging.warn('Both --master and --tpu are set. Ignoring '
144-
'--tpu and using --master.')
145-
tpu_grpc_url = FLAGS.master
146-
else:
147-
tpu_cluster_resolver = (
148-
tf.contrib.cluster_resolver.TPUClusterResolver(
149-
FLAGS.tpu,
150-
zone=FLAGS.tpu_zone,
151-
project=FLAGS.gcp_project))
152-
tpu_grpc_url = tpu_cluster_resolver.get_master()
135+
tpu_cluster_resolver = tf.contrib.cluster_resolver.TPUClusterResolver(
136+
FLAGS.tpu,
137+
zone=FLAGS.tpu_zone,
138+
project=FLAGS.gcp_project
139+
)
153140

154141
run_config = tf.contrib.tpu.RunConfig(
155-
master=tpu_grpc_url,
156-
evaluation_master=tpu_grpc_url,
142+
cluster=tpu_cluster_resolver,
157143
model_dir=FLAGS.model_dir,
158144
session_config=tf.ConfigProto(
159145
allow_soft_placement=True, log_device_placement=True),

0 commit comments

Comments
 (0)