2017-06-06 9 views
4

私の目標は、Tensorflow Training Appをローカルで実行するときにGoogle Cloudストレージに保存されているトレーニングデータ(形式:tfrecords)を使用することです。 (なぜローカル:なぜクラウドMLのトレーニングパッケージにする前にテストしていますか?)Google Cloudに保存されているTraining TFRecordsを使用する

this thread基礎となるTensorflow APIがgs://を読み取ることができるため、何もする必要はありません

2017年6月6日15:38:55.589068:I tensorflow /コア/プラットフォーム/クラウド/ retrying_utils(URL)

ただし場合、私は参照エラーが形式のものではないthatsの.cc:77]操作 は失敗し、1.38118秒で自動的に再試行されます(1035のうち1つを試みます) :使用不可:38:56.976396:HTTPリクエスト を実行エラー

2017年6月6日15(HTTP応答コード0、エラーコード6、エラーメッセージメタデータ ' '' ホストを解決できませんでした')私は使用できません:HTTP要求の実行中にエラーが発生しました (HTTPレスポンスの実行中にエラーが発生しました)(HTTPレスポンスの実行中にエラーが発生しました。コード0、エラーコード6、エラーメッセージ ' ホスト'メタデータ ''を解決できませんでした)

2017-06-06 15:38:58.925964:I tensorflow /core/platform/cloud/retrying_utils.cc:77]操作 が失敗し、自動的に2.76491秒後に再試行されます(原因:3 :10)。使用不可:HTTP要求の実行中にエラーが発生しました。 (HTTP応答コード0私は、このエラーのデバッグを開始する必要がある場合は、エラーコード6、エラーメッセージは、私は従うことができないんだけど、メタデータ「『)

』 ホストを解決できませんでした」。

ここでは、問題を再現したスニペットと、私が使用しているテンソルフローAPIを示します。

def _preprocess_features(features): 
     """Function that returns preprocessed images""" 

def _parse_single_example_from_tfrecord(value): 
    features = (
     tf.parse_single_example(value, 
           features={'image_raw': tf.FixedLenFeature([], tf.string), 
              'label': tf.FixedLenFeature([model_config.LABEL_SIZE], tf.int64) 
              }) 
     ) 
    return features 

def _read_and_decode_tfrecords(filename_queue): 
    reader = tf.TFRecordReader() 
    # Point it at the filename_queue 
    _, value = reader.read(filename_queue) 
    features = _parse_single_example_from_tfrecord(value) 
    # decode the binary string image data 
    image, label = _preprocess_features(features) 
    return image, label 

def test_tfread(filelist): 
    train_filename_queue = (
    tf.train.string_input_producer(filelist, 
            num_epochs=None, 
            shuffle=True)) 
    image, label = (
    _read_and_decode_tfrecords(train_filename_queue)) 
    return image 

images= test_tfread(["gs://test-bucket/t.tfrecords"]) 
sess = tf.Session(config=tf.ConfigProto(
       allow_soft_placement=True, 
       log_device_placement=True)) 
coord = tf.train.Coordinator() 
threads = tf.train.start_queue_runners(sess=sess, coord=coord) 
try: 
    for step in range(model_config.MAX_STEPS): 
     _ = sess.run([images]) 
finally: 
    # When done, ask the threads to stop. 
    coord.request_stop() 
# Finally, wait for them to join (i.e. cleanly shut down) 
coord.join(threads) 

答えて

7

次のコマンドを

gcloud auth application-default login

+0

恐ろしいを実行してください!これは動作します - ありがとう! Google Cloud MLにデプロイされているときにトレーニングパッケージをプログラムで実行する方法を教えてください。 – wrecktangle

+0

CloudMLで実行しているときには不要なはずです。問題がある場合は、報告してください。 (しかし、FWIWでは、常に 'サブプロセス.check_call([" gcloud "、" auth "、" application-default "、" login "])')を使用することができます。 – rhaertel80

+0

あなたはそうです、 – wrecktangle

関連する問題