|
46 | 46 | "metadata.")
|
47 | 47 |
|
48 | 48 | # 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.") |
53 | 49 | tf.flags.DEFINE_string("data_dir", "",
|
54 | 50 | "Path to directory containing the MNIST dataset")
|
55 | 51 | tf.flags.DEFINE_string("model_dir", None, "Estimator model_dir")
|
@@ -136,24 +132,14 @@ def main(argv):
|
136 | 132 | del argv # Unused.
|
137 | 133 | tf.logging.set_verbosity(tf.logging.INFO)
|
138 | 134 |
|
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 | + ) |
153 | 140 |
|
154 | 141 | run_config = tf.contrib.tpu.RunConfig(
|
155 |
| - master=tpu_grpc_url, |
156 |
| - evaluation_master=tpu_grpc_url, |
| 142 | + cluster=tpu_cluster_resolver, |
157 | 143 | model_dir=FLAGS.model_dir,
|
158 | 144 | session_config=tf.ConfigProto(
|
159 | 145 | allow_soft_placement=True, log_device_placement=True),
|
|
0 commit comments