Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python TensorFlow:最低限度程序在分布式模式下失败_Python_Tensorflow - Fatal编程技术网

Python TensorFlow:最低限度程序在分布式模式下失败

Python TensorFlow:最低限度程序在分布式模式下失败,python,tensorflow,Python,Tensorflow,我编写了一个非常简单的程序,在没有分发的情况下运行得很好,但是在分布式模式下挂起了CheckpointSaverHook(不过我的本地主机上的所有东西!)。我看到有一些关于在分布式模式下挂起的问题,但没有一个与我的问题相匹配 以下是脚本(与新层API一起制作): 这将阻止服务器在本地模式下为工作程序启动。。。有人知道这是一个bug还是我遗漏了什么吗?所以这已经在中得到了回答:。最后,对于任何分布式操作,都应该使用云。这一点已在中得到了回答:。最后,对于任何分布式操作,都应该使用CLOUD。注意,

我编写了一个非常简单的程序,在没有分发的情况下运行得很好,但是在分布式模式下挂起了
CheckpointSaverHook
(不过我的本地主机上的所有东西!)。我看到有一些关于在分布式模式下挂起的问题,但没有一个与我的问题相匹配

以下是脚本(与新层API一起制作):


这将阻止服务器在本地模式下为工作程序启动。。。有人知道这是一个bug还是我遗漏了什么吗?

所以这已经在中得到了回答:。最后,对于任何分布式操作,都应该使用

这一点已在中得到了回答:。最后,对于任何分布式操作,都应该使用
CLOUD

注意,如果我在两个单独的虚拟机中运行相同的脚本,它们也无法运行它。。。所以这并不是因为两者都生活在本地主机上。在TensorFlow存储库上打开了一个github问题:请注意,如果我在两个单独的VM中运行相同的脚本,它们也无法运行它。。。因此,这并不是因为两者都生活在本地主机上。在TensorFlow存储库上打开了一个github问题:
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn.python.learn import learn_runner
from tensorflow.contrib import layers

DATA_SIZE=10
DIMENSION=5
FEATURES='features'

def generate_input_fn():
    def _input_fn():
        mid = int(DATA_SIZE/2)

        data = np.array([np.ones(DIMENSION) if x < mid else -np.ones(DIMENSION) for x in range(DATA_SIZE)])
        labels = ['0' if x < mid else '1' for x in range(DATA_SIZE)]

        table = tf.contrib.lookup.string_to_index_table_from_tensor(tf.constant(['0', '1']))
        label_tensor = table.lookup(tf.convert_to_tensor(labels, dtype=tf.string))

        return dict(zip([FEATURES], [tf.convert_to_tensor(data, dtype=tf.float32)])), label_tensor
    return _input_fn

def build_estimator(model_dir):
    features = layers.real_valued_column(FEATURES, dimension=DIMENSION)
    return tf.contrib.learn.DNNLinearCombinedClassifier(
        model_dir=model_dir,
        dnn_feature_columns=[features],
        dnn_hidden_units=[20,20])

def generate_exp_fun():
    def _exp_fun(output_dir):
        return tf.contrib.learn.Experiment(
            build_estimator(output_dir),
            train_input_fn=generate_input_fn(),
            eval_input_fn=generate_input_fn(),
            train_steps=100
        )
    return _exp_fun

if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.DEBUG)
    learn_runner.run(generate_exp_fun(), 'job_dir')
# Start the server, if needed. It's important to start the server before
# we (optionally) sleep for the case where no device_filters are set.
# Otherwise, the servers will wait to connect to each other before starting
# to train. We might as well start as soon as we can.
config = self._estimator.config
if (config.environment != run_config.Environment.LOCAL and
    config.environment != run_config.Environment.GOOGLE and
    config.cluster_spec and config.master):
  self._start_server()