标签: google-cloud-ml-engine

Google Cloud - 计算引擎与机器学习

有谁知道使用Google Cloud Machine Learning与Google Cloud Engine中的虚拟机实例相比有什么区别?

我正在使用Keras和Python 3并且感觉GML更受限制(使用python 2.7,旧版本的TensorFlow,必须遵循给定的结构......).我猜他们在GCE中使用GML而不是VM的好处,但我想知道它们是什么.

python machine-learning google-compute-engine tensorflow google-cloud-ml-engine

14
推荐指数
1
解决办法
1698
查看次数

使用存储在Google Cloud上的培训TFRecords

我的目标是在本地运行Tensorflow培训应用程序时使用存储在Google云端存储上的培训数据(格式:tfrecords).(为什么在本地?:我在测试之前将其转换为Cloud ML的培训包)

基于这个线程我不应该做任何事情,因为底层的Tensorflow API应该能够读取gs://(url)

然而事实并非如此,我看到的错误是格式:

2017-06-06 15:38:55.589068:I tensorflow/core/platform/cloud/retrying_utils.cc:77]操作失败,将在1.38118秒内自动重试(尝试10分之一),原因是:不可用:执行HTTP请求时出错(HTTP响应代码0,错误代码6,错误消息'无法解析主机'元数据'')

2017-06-06 15:38:56.976396:I tensorflow/core/platform/cloud/retrying_utils.cc:77]操作失败,将在1.94469秒(尝试2个满10个)中自动重试,原因是:不可用:执行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,错误消息'无法解析主机'元数据'')

我无法跟踪我必须开始调试此错误的位置.

这是一个重现问题的片段,还显示了我正在使用的tensorflow 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, …
Run Code Online (Sandbox Code Playgroud)

tensorflow google-cloud-ml google-cloud-ml-engine

13
推荐指数
1
解决办法
3720
查看次数

使用实例键进行培训和预测

我能够训练我的模型并使用ML Engine进行预测,但我的结果不包括任何识别信息.这在一次提交一行进行预测时工作正常但在提交多行时我无法将预测连接回原始输入数据.该GCP文件讨论了使用实例密钥,但我无法找到训练和使用实例密钥预测任何示例代码.采用GCP人口普查示例如何更新输入函数以通过图表传递唯一ID并在训练期间忽略它并返回带预测的唯一ID?或者,如果有人知道已经使用了也有帮助的键的另一个例子.

来自Census Estimator Sample

def serving_input_fn():
    feature_placeholders = {
      column.name: tf.placeholder(column.dtype, [None])
      for column in INPUT_COLUMNS
    }

    features = {
      key: tf.expand_dims(tensor, -1)
      for key, tensor in feature_placeholders.items()
    }

    return input_fn_utils.InputFnOps(
      features,
      None,
      feature_placeholders
    )


def generate_input_fn(filenames,
                  num_epochs=None,
                  shuffle=True,
                  skip_header_lines=0,
                  batch_size=40):

    def _input_fn():
        files = tf.concat([
          tf.train.match_filenames_once(filename)
          for filename in filenames
        ], axis=0)

        filename_queue = tf.train.string_input_producer(
          files, num_epochs=num_epochs, shuffle=shuffle)
        reader = tf.TextLineReader(skip_header_lines=skip_header_lines)

        _, rows = reader.read_up_to(filename_queue, num_records=batch_size)

        row_columns = tf.expand_dims(rows, -1)
        columns = tf.decode_csv(row_columns, record_defaults=CSV_COLUMN_DEFAULTS)
        features …
Run Code Online (Sandbox Code Playgroud)

tensorflow google-cloud-ml-engine

12
推荐指数
1
解决办法
2635
查看次数

在谷歌云机器学习中阅读文件

我尝试在google cloud ml-engine上运行tensorflow-wavenet,gcloud ml-engine jobs submit training但是在尝试读取json配置文件时云作业崩溃了:

with open(args.wavenet_params, 'r') as f:
   wavenet_params = json.load(f)
Run Code Online (Sandbox Code Playgroud)

arg.wavenet_params只是我上传到谷歌云存储桶的json文件的文件路径.文件路径如下所示:gs://BUCKET_NAME/FILE_PATH.json.

我仔细检查了文件路径是否正确,我确信这部分是导致崩溃的原因,因为我注释掉了其他所有内容.

崩溃日志文件没有提供有关发生的事情的大量信息:

Module raised an exception for failing to call a subprocess Command '['python', '-m', u'gcwavenet.train', u'--data_dir', u'gs://wavenet-test-data/VCTK-Corpus-Small/', u'--logdir_root', u'gs://wavenet-test-data//gcwavenet10/logs']' returned non-zero exit status 1.
Run Code Online (Sandbox Code Playgroud)

我替换wavenet_params = json.load(f)f.close(),我仍然得到相同的结果.

当我在本地运行时,一切都有效gcloud ml-engine local train.

我认为问题在于gcloud ml-engine一般读取文件或者我无法从python文件中访问google云端桶gs://BUCKET_NAME/FILE_PATH.

google-cloud-ml google-cloud-ml-engine

7
推荐指数
1
解决办法
2278
查看次数

无法将作业重新提交到ml-engine,因为"具有此ID的作业已存在"

我正在尝试向gcloud ml-engine提交一份工作.作为参考,该作业正在使用Google提供的此示例

它经历了第一次,但是与此问题无关的错误,现在我正在尝试在纠正错误后重新发出命令:

gcloud ml-engine jobs submit training $JOB_NAME \
                                    --stream-logs \
                                    --runtime-version 1.0 \
                                    --job-dir $GCS_JOB_DIR \
                                    --module-name trainer.task \
                                    --package-path trainer/ \
                                    --region us-east1 \
                                    -- \
                                    --train-files $TRAIN_GCS_FILE \
                                    --eval-files $EVAL_GCS_FILE \
                                    --train-steps $TRAIN_STEPS
Run Code Online (Sandbox Code Playgroud)

,其中$JOB_NAME= census.不幸的是,似乎我不能重新提交作业,除非我改变继续$JOB_NAME成为像census2,然后census3,等每一个新的工作.

以下是我收到的错误:

ERROR: (gcloud.ml-engine.jobs.submit.training) Project [my-project-name]
is the subject of a conflict: Field: job.job_id Error: A job with this
id already exists.
Run Code Online (Sandbox Code Playgroud)

这部分设计是否无法使用相同的工作名称重新提交,或者我遗漏了什么?

tensorflow google-cloud-ml-engine

7
推荐指数
1
解决办法
783
查看次数

tensorflow每次运行发现多个图形事件

我正在为在本地模式下运行的ml引擎实验加载张量板,并收到以下警告:

"Found more than one graph event per run, or there was a metagraph containing a graph_def, as well as one or more graph events.  Overwriting the graph with the newest event.
W0825 19:26:12.435613 Reloader event_accumulator.py:311] Found more than one metagraph event per run. Overwriting the metagraph with the newest event."
Run Code Online (Sandbox Code Playgroud)

最初,我怀疑这是因为我没有清除自己的信息--logdir=$OUTPUT_PATH(如其他帖子所建议的-但是,即使我执行了操作,rm -rf $OUTPUT_PATH/*我仍然会在本地火车上收到此错误。该错误是否表明我的图表中存在更大的问题?

google-cloud-platform tensorflow tensorboard google-cloud-ml-engine

7
推荐指数
1
解决办法
8989
查看次数

部署重新训练的开始SavedModel到谷歌云ml引擎

我正在尝试在google cloud ml-engine上部署一个初始模型的重新训练版本.从SavedModel文档,此参考和rhaertel80的这篇文章中收集信息,我成功地将我的再培训模型导出到SavedModel,将其上传到存储桶并尝试将其部署到ml-engine版本.

最后一个任务实际上创建了一个版本,但它输出了这个错误:

Create Version failed. Bad model detected with error: "Error loading the model: Unexpected error when loading the model"

当我尝试通过命令行从模型中获得预测时,我收到以下错误消息: "message": "Field: name Error: Online prediction is unavailable for this version. Please verify that CreateVersion has completed successfully."

我曾经多次尝试,尝试不同的method_nametag选择,但没有奏效.

添加到原始初始代码的代码是

  ### DEFINE SAVED MODEL SIGNATURE

  in_image = graph.get_tensor_by_name('DecodeJpeg/contents:0')
  inputs = {'image_bytes': tf.saved_model.utils.build_tensor_info(in_image)}

  out_classes = graph.get_tensor_by_name('final_result:0')
  outputs = {'prediction': tf.saved_model.utils.build_tensor_info(out_classes)}

  signature = tf.saved_model.signature_def_utils.build_signature_def(
      inputs=inputs,
      outputs=outputs,
      method_name='tensorflow/serving/predict'
  )


  ### …
Run Code Online (Sandbox Code Playgroud)

google-cloud-ml google-cloud-ml-engine

6
推荐指数
1
解决办法
1816
查看次数

将图形 (pb) 转换为 SavedModel 以用于 gcloud ml-engine predict

根据Google 的 Derek Chow 最近在 Google Cloud Big Data And Machine Learning Blog 上的帖子,我使用 Cloud Machine Learning Engine 训练了一个对象检测器,现在想使用 Cloud Machine Learning Engine 进行预测。

说明包括将 Tensorflow 图导出为 output_inference_graph.pb 的代码,但不包括如何将 protobuf 格式 (pb) 转换为 gcloud ml-engine predict 所需的 SavedModel 格式。

我查看了Google 的 @rhaertel80关于如何转换“Tensorflow For Poets”图像分类模型的答案,以及 Google 的 @MarkMcDonald 提供的关于如何转换“Tensorflow For Poets 2”图像分类模型的答案,但似乎都不适用于博客文章中描述的对象检测器图 (pb)。

请如何转换该对象检测器图 (pb) 以便可以使用它或 gcloud ml-engine 预测?

object-detection tensorflow google-cloud-ml google-cloud-ml-engine

5
推荐指数
1
解决办法
1326
查看次数

加载预先训练的word2vec以在Estimator model_fn中初始化embedding_lookup

我正在解决文本分类问题.我使用Estimator自己的类定义了我的分类器model_fn.我想使用Google的预训练word2vec嵌入作为初始值,然后针对手头的任务进一步优化它.

我看到这篇文章:在TensorFlow中使用预先训练的单词嵌入(word2vec或Glove),
它解释了如何在'原始'TensorFlow代码中进行处理.但是,我真的很喜欢Estimator上课.

作为扩展,我想在Cloud ML Engine上训练此代码,是否有一种传递具有初始值的相当大的文件的好方法?

假设我们有类似的东西:

def build_model_fn():
    def _model_fn(features, labels, mode, params):
        input_layer = features['feat'] #shape=[-1, params["sequence_length"]]
        #... what goes here to initialize W

        embedded = tf.nn.embedding_lookup(W, input_layer)
        ...
        return predictions

estimator = tf.contrib.learn.Estimator(
    model_fn=build_model_fn(),
    model_dir=MODEL_DIR,
    params=params)
estimator.fit(input_fn=read_data, max_steps=2500)
Run Code Online (Sandbox Code Playgroud)

word2vec tensorflow google-cloud-ml-engine

5
推荐指数
1
解决办法
1657
查看次数

Google Cloud ML Engine GPU利用率

如果我在Google Cloud ML Engine作业中使用--scale-tier BASIC GPU,如何查看GPU利用率?我可以在“作业详细信息”选项卡上查看CPU利用率和内存利用率,但我想知道GPU的利用率是多少。这是否仅包含在CPU使用率中,还是有另一个选项卡可以查看GPU使用率?

此外,是否有任何方法可以查看哪些操作占用了大部分CPU使用率?我的CPU使用率非常高,内存非常低,并且输入生成器总是很满(100%),因此我试图更好地了解所花的时间,以便尝试优化模型性能。

google-cloud-platform tensorflow google-cloud-ml-engine

5
推荐指数
1
解决办法
1004
查看次数