Fix MNIST downloading problems in parameter server examples. (#1457)

* Fix MNIST downloading problems in parameter server examples.

* Improve seeding.

* Fixes.
This commit is contained in:
Robert Nishihara
2018-01-25 14:14:37 -08:00
committed by Richard Liaw
parent 0a01d3c71f
commit e96acc26f7
3 changed files with 18 additions and 11 deletions
+12
View File
@@ -8,6 +8,18 @@ from __future__ import print_function
import ray
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import time
def download_mnist_retry(seed=0, max_num_retries=20):
for _ in range(max_num_retries):
try:
return input_data.read_data_sets("MNIST_data", one_hot=True,
seed=seed)
except tf.errors.AlreadyExistsError:
time.sleep(1)
raise Exception("Failed to download MNIST.")
class SimpleCNN(object):